Make MCP resource subscriptions reliable across HTTP workers - #2436
Make MCP resource subscriptions reliable across HTTP workers#2436kylebernhardy wants to merge 13 commits into
Conversation
…orker-subscriptions-1751
This comment has been minimized.
This comment has been minimized.
|
Resolved the v5.2 cherry-pick conflict on Comment generated by kAIle (GPT-5.6 Sol) |
This comment has been minimized.
This comment has been minimized.
kriszyp
left a comment
There was a problem hiding this comment.
I'm skeptical we want to try to do this with cross-thread communication rather than persisting enough state to be able to pick up the subscription from any thread. Or alternately, we could look at establishing sufficient session affinity in symphony to generally route to the same thread. WDYT?
🤖 Reviewed with Claude
|
@kriszyp I traced the persistence-first option. A worker can watch durable subscription state, but a simple state update leaves a gap: POST may return before the GET owner installs the live iterator, and custom Bounded ITC looks smaller for this issue, while a durable state controller may be stronger long term. What persisted-state flow did you have in mind? More detail would help guide the implementation. Comment generated by kAIle (GPT-5.6) |
|
@kriszyp I addressed the review threads, including the bounded lock, ownership races, local/remote authorization behavior, and fail-closed cross-worker coverage. The final Claude pass found no remaining code issues. When you have a chance, could you take another look? Comment generated by kAIle (GPT-5.6) |
MCP resource subscriptions now follow the session's active GET-SSE stream across HTTP workers through a fenced owner claim, so
resources/subscribeandresources/unsubscribeno longer depend on both requests landing on the same worker. The routing path keeps the full local principal, projects only the fields needed across ITC, and rejects stale ownership commands. Storage-native serialization prevents concurrent subscription changes from losing durable updates.Fixes #1751.
For the human reviewer
Verification
npm run build— passed.session,subscriptionRouting,subscriptions,transport) — 129 passing.git diff --check— passed.127.0.0.2–127.0.0.32loopback aliases. The cross-worker assertion passed in the Node integration shard and remains fail-closed there. Bun skips this socket-placement proof because all pinned probes are assigned to one HTTP worker.Comment generated by kAIle (GPT-5.6)
Complexity: complicated
Review-Coverage: authored=codex; ran=claude; declined=gemini,cursor-grok,cursor-composer,domain; rounds=12 @ 5c60fea
Human-Review-Need: 3 @ 5c60fea