Stop evicting standalone MCP listeners - #1754
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-marketing | ccdaa36 | Commit Preview URL Branch Preview URL |
Aug 26 2026, 06:21 AM |
Contributor
Cloudflare previewTorn down — the PR is closed. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-cloud | ccdaa36 | Aug 26 2026, 06:22 AM |
RhysSullivan
marked this pull request as ready for review
August 26, 2026 06:23
RhysSullivan
added a commit
to jadch/executor
that referenced
this pull request
Aug 28, 2026
The agents@0.17.3 patch was rewritten on main by UsefulSoftwareCo#1754 (standalone listeners attach alongside each other instead of superseding, plus the _replayInFlight guard). Re-rolled this branch's change with bun patch on top of main's patched dist rather than merging the patch file textually: the Last-Event-ID branch no longer drains other streams, and the helper is now replayUndeliveredResponsesOnFreshGet, called only from the cursorless GET path. The fresh-GET fallback and its in-flight guard are unchanged.
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
Every standalone SSE listener (bare GET) on a streamable-HTTP session shares one stream id, and
handleGetRequestapplied latest-listener-wins to it: each new listener closed the previous one. Clients that hold two listeners — mcp-remote opens one at connect and a second when it forwardsnotifications/initialized— evict each other forever, since every eviction triggers the SDK reconnect that evicts the other side. One production session showed ~55,600 listener GETs over 6.75h (~2.3/s) against 106 POSTs, and the affected user saw permanent disconnect/reconnect churn. Reproduced end-to-end with stockmcp-remote 0.1.37: a 4-minute idle session settles into ~0.8 GET/s with every response delivered twice.Fix
In
patches/agents@0.17.3.patch:supersedePriorStreamConnectionsonly applies to single-owner POST streams. Dead listeners are reaped by keepalive write failures and max-age rotation.sendStandaloneroutes server-initiated messages to the newest attachment (most likely live), still exactly one stream per message.onConnectcloses the WS with 1011 when the transport is missing instead of silently dropping the request, which previously left clients hanging ~30s against a half-initialized DO.Verification
repro-listener-supersede.test.ts: two reconnecting listeners previously produced 1,581 stream opens in 15s (median life 16ms); with the fix both stay open (passes; single-listener control unchanged).mcp-remote 0.1.37, one routine deploy mid-run — 20 GETs over 6 minutes (was 1,049 in 9.5 min), tool calls keep working through the deploy, GET rate settles instead of ramping.format:check,lint,typecheck,testall green.