Centralize graphql queries with sendtosser#3
Draft
Avi-ADAM wants to merge 1 commit into
Draft
Conversation
Co-authored-by: aviadam.segel <aviadam.segel@gmail.com>
|
Cursor Agent can help with this pull request. Just |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Avi-ADAM
pushed a commit
that referenced
this pull request
Jul 4, 2026
Round #2 — closes finding #3 (global.botContext shared across concurrent requests) from the production-readiness review. The chat/MCP request context (userId, fetchInstance, isInternalBot, history) lived on a single process-wide `global.botContext`, so concurrent users could clobber each other's identity — an auth-context bleed and a source of non-deterministic bugs. Back the existing getMcpContext()/setMcpContext() abstraction with a Node AsyncLocalStorage instead of `global`. Each request enters its own isolated store (via enterWith) that propagates through the async chain (workflow -> agent -> tools) with no cross-request leakage. Migrated all 34 direct global.botContext sites (7 writers, 12 tool readers, cleanup sites) to the abstraction; added clearMcpContext() to replace `delete global.botContext`. Verified: svelte-check reports the same 1428 pre-existing errors as before (zero new type errors), and vite build transforms all modules and renders chunks cleanly (node:async_hooks bundles fine). Runtime propagation through the async chain still needs manual UI verification before merge — documented in the review's UI checklist. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XJKxaj1HjBtpbgWTcjUV6g
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Centralize GraphQL queries by migrating several components and server loads from direct
SendTocalls tosendToSerwith newqids.jsentries.