Skip to content

Centralize graphql queries with sendtosser#3

Draft
Avi-ADAM wants to merge 1 commit into
mainfrom
cursor/centralize-graphql-queries-with-sendtosser-9e13
Draft

Centralize graphql queries with sendtosser#3
Avi-ADAM wants to merge 1 commit into
mainfrom
cursor/centralize-graphql-queries-with-sendtosser-9e13

Conversation

@Avi-ADAM

@Avi-ADAM Avi-ADAM commented Aug 7, 2025

Copy link
Copy Markdown
Owner

Centralize GraphQL queries by migrating several components and server loads from direct SendTo calls to sendToSer with new qids.js entries.


Open in Cursor Open in Web

Co-authored-by: aviadam.segel <aviadam.segel@gmail.com>
@cursor

cursor Bot commented Aug 7, 2025

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel

vercel Bot commented Aug 7, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
1-0 ❌ Failed (Inspect) Aug 7, 2025 11:13pm

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants