GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(opencode): recover expired MCP sessions by rekram1-node · Pull Request #32088 · anomalyco/opencode

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Jun 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

All reactions
rekram1-node added 8 commits June 12, 2026 13:15
@rekram1-node
fix(opencode): recover expired MCP sessions
25cf78d
@rekram1-node
fix(opencode): recover expired MCP streams
a420d1c
@rekram1-node
fix(opencode): bound MCP session recovery
188308e
@rekram1-node
refactor(opencode): simplify MCP session recovery
a282e2b
@rekram1-node
fix(opencode): preserve recovered MCP session
77640d4
@rekram1-node
fix(opencode): allow stateless MCP recovery
ab75595
@rekram1-node
test(opencode): cover MCP session recovery
a2b1cb1
@rekram1-node
test(opencode): use real MCP recovery server
d2311be
@github-actions github-actions Bot mentioned this pull request Jun 13, 2026
📊 AI CLI 工具社区动态日报 2026-06-13 zx0828/big_model_radar#115
Open
@rekram1-node
rekram1-node merged commit c7dee9c into dev Jun 13, 2026
10 of 11 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node
rekram1-node deleted the mcp-session-recovery branch June 13, 2026 16:21
danzeroum added a commit to danzeroum/opencode that referenced this pull request Jun 13, 2026
@danzeroum @Hona
@opencode-agent @rekram1-node @santigc6 santiago.gonzalezcarvajcentenera @davidfierro @kameshsampath @snowflake-coco @claude
feat(core): EventV2 event log, decision.recorded event, and follow-up…
5e63eb8
… docs (#4)

* fix(app): fade overflowing titlebar tabs (anomalyco#32082)

* chore: generate

* fix(app): expand terminal resize gutter hitbox (anomalyco#32169)

* feat(app): bring v2 visibility settings to web (anomalyco#32174)

* fix(opencode): recover expired MCP sessions (anomalyco#32088)

* chore: update nix node_modules hashes

* feat(opencode): add external browser OAuth for snowflake cortex provider (anomalyco#31700)

Co-authored-by: santiago.gonzalezcarvajcentenera <[email protected]>
Co-authored-by: David Fierro <[email protected]>
Co-authored-by: Kamesh Sampath <[email protected]>
Co-authored-by: Cortex Code <[email protected]>

* chore: generate

* docs(verify): note subtask side-effects; add frontmatter table + http-recorder guidance

* feat(core): add opt-in EventV2 event log and decision.recorded event

---------

Co-authored-by: Luke Parker <[email protected]>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: Aiden Cline <[email protected]>
Co-authored-by: santigc6 <[email protected]>
Co-authored-by: santiago.gonzalezcarvajcentenera <[email protected]>
Co-authored-by: David Fierro <[email protected]>
Co-authored-by: Kamesh Sampath <[email protected]>
Co-authored-by: Cortex Code <[email protected]>
Co-authored-by: Claude <[email protected]>
This was referenced Jun 18, 2026
MCP streamable-HTTP transport: 'Session not found' from server permanently breaks tool calls (no auto-reconnect) #25137
Closed
MCP session recovery does not trigger on HTTP 400 (only 404) — breaks servers that return 400 for expired sessions #32809
Closed
davidgut1982 pushed a commit to davidgut1982/opencode that referenced this pull request Jun 19, 2026
@rekram1-node @davidgut1982
fix(opencode): recover expired MCP sessions (anomalyco#32088)
9ccf298
BenGu3 pushed a commit to BenGu3/opencode that referenced this pull request Jun 27, 2026
@rekram1-node @BenGu3
fix(opencode): recover expired MCP sessions (anomalyco#32088)
2e2630e
@coffee-tm coffee-tm mentioned this pull request Jul 18, 2026
SSE-transport remote MCP: invalid-session 404 never auto-reconnects; unrecoverable on terminal-less hosted deployments #37626
Closed
This was referenced Jul 28, 2026
fix(mcp): recover expired legacy sessions #39262
Closed
fix(mcp): recover expired SDK sessions #39265
Merged
MarsQiu007 referenced this pull request in MarsQiu007/openNovel Jul 31, 2026
@rekram1-node
fix(opencode): recover expired MCP sessions (#32088)
5099852
rldona pushed a commit to plazoleta-dev/FlupCode that referenced this pull request Sep 24, 2026
@rekram1-node
fix(opencode): recover expired MCP sessions (anomalyco#32088)
21a2567
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

MCP streamable-HTTP transport: 'Session not found' from server permanently breaks tool calls (no auto-reconnect)

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@rekram1-node
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.