GeezerVison is showing github.com — fix(opencode): recover expired MCP sessions by rekram1-node · Pull Request #32088 · anomalyco/opencode
Conversation
Summary
- locally patch
@modelcontextprotocol/[email protected] to reinitialize a Streamable HTTP session after a POST carrying a session ID receives 404
- coalesce concurrent stale-session failures into one initialization and retry each rejected POST at most once
- support replacement servers that initialize without issuing another optional session ID
- prevent delayed responses from an expired session from overwriting the replacement session state
- avoid replaying a request that timed out or was aborted while recovery was running
- close the client if replacement initialization fails
- add a focused regression test using the real SDK transport against a loopback HTTP server
This is intentionally limited to the POST failure reported in #25137. It does not infer session expiry from optional GET/SSE failures and does not retry ambiguous network failures. Recovery uses fresh request options rather than retaining the original connection signal. The patch can be removed after an equivalent SDK release is adopted.
Closes #25137.
Related to master MCP issue #28567.
Validation
bun test test/mcp/session-recovery.test.ts from packages/opencode
bun test test/mcp from packages/opencode
bun typecheck from packages/opencode
bun install --frozen-lockfile
- regression test verifies over real loopback HTTP that the stale request receives 404, replacement initialization omits the expired session header, and the original request retries once with the replacement session
- manually verified concurrent failures share one initialization, timed-out requests are not replayed, stateless replacement initialization succeeds, delayed stale responses cannot replace the recovered session, and GET 404 does not trigger recovery
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Jun 18, 2026
This was referenced Jul 28, 2026
rldona
pushed a commit
to plazoleta-dev/FlupCode
that referenced
this pull request
Sep 24, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.