Skip to content

Answer not found for requests that land mid-destroy on an MCP session - #2391

Merged
RhysSullivan merged 1 commit into
mainfrom
mcp-destroy-stale-session-meta
Oct 25, 2026
Merged

RhysSullivan merged 1 commit into
mainfrom
mcp-destroy-stale-session-meta

Conversation

@RhysSullivan

@RhysSullivan RhysSullivan commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

An MCP request that lands on a session while the session's Durable Object is being destroyed could fail with an unhandled 500 (no such table: cf_agents_mcp_servers). mcp-destroyed-session-envelope catches this intermittently on main. Vite also broadcast the server error as an overlay, which broke the next browser scenario in the same shard (health-check-rpc-ui).

Cause: the SDK's destroy() drops its tables and wipes storage, including the condemned marker, before it aborts the isolate. A validateMcpSessionOwner call in that window passed the marker check and then trusted the in-memory session meta. Because the runtime had just been closed, it restored the runtime against the dropped tables.

Once destroy() starts, loadSessionMeta no longer returns the cached meta. Such a request now gets not_found (404 "Session not found"), the same answer as after the wipe. The answer before the wipe ("terminated") is unchanged.

Tests: #2392.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing ce7d75c Commit Preview URL

Branch Preview URL
Oct 25 2026, 09:37 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud ce7d75c Oct 25 2026, 09:38 PM

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Cloudflare preview

Torn down — the PR is closed.

@pkg-pr-new

pkg-pr-new Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@executor-js/cli

npm i https://pkg.pr.new/@executor-js/cli@2391

@executor-js/config

npm i https://pkg.pr.new/@executor-js/config@2391

@executor-js/execution

npm i https://pkg.pr.new/@executor-js/execution@2391

@executor-js/sdk

npm i https://pkg.pr.new/@executor-js/sdk@2391

@executor-js/codemode-core

npm i https://pkg.pr.new/@executor-js/codemode-core@2391

@executor-js/runtime-quickjs

npm i https://pkg.pr.new/@executor-js/runtime-quickjs@2391

@executor-js/plugin-file-secrets

npm i https://pkg.pr.new/@executor-js/plugin-file-secrets@2391

@executor-js/plugin-graphql

npm i https://pkg.pr.new/@executor-js/plugin-graphql@2391

@executor-js/plugin-keychain

npm i https://pkg.pr.new/@executor-js/plugin-keychain@2391

@executor-js/plugin-mcp

npm i https://pkg.pr.new/@executor-js/plugin-mcp@2391

@executor-js/plugin-onepassword

npm i https://pkg.pr.new/@executor-js/plugin-onepassword@2391

@executor-js/plugin-openapi

npm i https://pkg.pr.new/@executor-js/plugin-openapi@2391

executor

npm i https://pkg.pr.new/executor@2391

commit: ce7d75c

@RhysSullivan
RhysSullivan force-pushed the mcp-destroy-stale-session-meta branch from ea1c60a to 5c673c0 Compare October 25, 2026 21:26
destroy() wipes the session's storage and the SDK's tables before it aborts the isolate. A request landing in between passed the condemned-marker check, since the marker was wiped too, and then trusted the in-memory session meta. It restored the runtime against the dropped tables and failed with "no such table: cf_agents_mcp_servers" as an unhandled 500. Once destroy starts, the cached meta no longer vouches for the session.
@RhysSullivan
RhysSullivan force-pushed the mcp-destroy-stale-session-meta branch from 5c673c0 to ce7d75c Compare October 25, 2026 21:36
@RhysSullivan
RhysSullivan marked this pull request as ready for review October 25, 2026 21:51
@RhysSullivan
RhysSullivan merged commit 083209a into main Oct 25, 2026
44 checks passed
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.

1 participant