Deliver MCP responses larger than the DO storage value cap - #1503
Merged
Conversation
The DO transport persisted every outbound message for reconnect replay BEFORE writing the live SSE frame, and storage.put of a value over the 128 KiB DO cap throws — so an oversize response (the ~5MB ui://executor/shell.html resource) was neither stored nor delivered and the client hung on keepalives forever. Found live in prod after #1502 made the shell resource actually serve its bytes. - storeEvent skips persistence for messages over a 120 KiB guard, logging mcp_event_store_skipped_oversize and returning undefined; the caller delivers the live frame without a replay id. - sendOnStream treats any storeEvent failure as best-effort: log, then still write the live SSE frame. - New e2e (cloud/mcp-oversize-response.test.ts) drives resources/read of the shell over real workerd and fails on a hang. - Event-store unit tests updated for the skip contract.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
executor-cloud | 8a0d00e | Jul 30 2026, 04:34 AM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-marketing | 8a0d00e | Commit Preview URL Branch Preview URL |
Jul 30 2026, 04:33 AM |
Contributor
Cloudflare previewTorn down — the PR is closed. |
@executor-js/cli
@executor-js/config
@executor-js/execution
@executor-js/sdk
@executor-js/codemode-core
@executor-js/runtime-quickjs
@executor-js/plugin-file-secrets
@executor-js/plugin-graphql
@executor-js/plugin-keychain
@executor-js/plugin-mcp
@executor-js/plugin-onepassword
@executor-js/plugin-openapi
executor
commit: |
RhysSullivan
marked this pull request as ready for review
July 30, 2026 04:32
This was referenced Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Rendering an artifact through a remote MCP client still hung after #1502. That PR fixed what the
ui://executor/shell.htmlresource serves (the real ~5 MB shell document instead of an inert placeholder) — but the DO transport could not deliver it.sendOnStreampersisted every outbound message withstorage.putfor reconnect replay BEFORE writing the live SSE frame, and DO storage caps each value at 128 KiB, so the put threw, the live write never ran, and the client sat on keepalives forever. Confirmed against production:resources/readof the shell resource returned 200 + keepalives and never a frame, whiletools/liston the same session worked.Fix (patches/agents@0.17.3.patch)
DurableObjectEventStore.storeEventskips persistence for messages over a 120 KiB guard (headroom under the 128 KiB cap), logsmcp_event_store_skipped_oversize, and resolvesundefined— the caller then writes the live SSE frame without a replayid:. The stream sequence does not advance on a skip.sendOnStreamtreats anystoreEventfailure (cap, storage outage) as best-effort: logmcp_event_store_put_failed, surface viaonerror, and still deliver the live frame.Verification
packages/hosts/cloudflaresuite 56/56.cloud/mcp-oversize-response.test.ts: real workerd topology,resources/readof the actual shell resource with a 60 s hang guard, asserting the >128 KiB document arrives with its identity marker. Failed with a hang before the patch, passes after.