fix(e2e): honor the 503 restart envelope in the cap-eviction helper - #1895
fix(e2e): honor the 503 restart envelope in the cap-eviction helper#1895ra-co88 wants to merge 4 commits into
Conversation
3a0b881 to
d4da0e5
Compare
|
Verdict: needs a decision — superseded on main, close or trim to the retry backstop. Open 3 days (since 2026-08-30). Conflicts with main in What's left is the Options:
Not run: lint/typecheck/e2e — the branch doesn't apply to current main and the change is e2e-only test code with no runtime effect, so nothing to verify until it's rebased. Nothing pushed. |
d4da0e5 to
7893ac9
Compare
|
Took option 2 — thanks for catching that #1907 superseded the concurrency half. Rebased onto current main, dropped the concurrency hunk (and the comment rewrite), and kept only the Understood on the evidence point — with sequential admission the envelope is a defensive backstop, not a demonstrated fix. Keeping it because the retry mirrors what a real streamable-http client does with that exact response, so the test's failure mode stays aligned with client behavior if the envelope ever recurs. |
Per review: the concurrency half is superseded by UsefulSoftwareCo#1907 (already on main, stricter). Rebased onto current main and kept only the retry loop on the documented 503 restart envelope.
7893ac9 to
3194bbd
Compare
ra-co88
left a comment
There was a problem hiding this comment.
Verdict: approve — the option-2 shape, now verified end-to-end. (Posted as a comment: GitHub refuses a formal self-approval on your own PR, so this is the author-side sign-off for a maintainer to convert.)
Supersession check: #1907 already dropped the opening concurrency 8 to 1 on main, which is why the 8-to-2 hunk was dropped here — the trimmed branch keeps only the retry backstop, correct call.
The remaining change is the openSession retry on the documented restart envelope, and it is exact: 503 + code -32001 + message 'MCP session is restarting, please retry' matches packages/hosts/cloudflare/src/mcp/durable-object-errors.ts, and 503 = retry-same-id is the contract in apps/cloud/src/mcp/agent-handler.ts. The decoder is strict (Schema.Literal on all three fields) and covered by it.each negative cases (404 with restart body, 503 with wrong code, wrong message, malformed JSON) — the negative-control discipline holds.
With sequential admission (#1907) the envelope is a defensive backstop rather than a live-scenario fix, and that is fine: a one-session-at-a-time helper that still dies on a transient platform DO-reset would be a flake factory. 8 attempts × 2s (host-advertised Retry-After) is bounded and reasonable.
Note on the semaphore test change (session-build-semaphore.test.ts fake-timers hunk): deterministic-clock coverage for the queue-timeout path that the retry loop can now exercise — no runtime effect, keeps the backstop testable. All CI green across every shard including E2E cloud 13of16 (the shard this scenario lives in). Merges clean. Good to merge.
What
Adds a retry backstop to
openSessionincloud/mcp-session-cap-eviction.test.ts: when the server answersinitializewith the documented restart envelope (503, JSON-RPC -32001,"MCP session is restarting, please retry"— the contractagent-handleremits for a platform DO reset), the helper retries the same request after a short delay instead of failing the scenario on a retryable platform blip.Context
The original root-cause half of this PR (opening concurrency) was superseded by #1907, which landed sequential admission and has the shard green on main. What remains here is only the retry: the exact behavior a real streamable-http client follows for that response, kept so the test's failure mode stays aligned with client behavior if the envelope ever recurs.
Verification
cloud/mcp-session-cap-evictionpasses locally on this branch (rebased onto current main).oxlintandtsc --noEmitclean on the touched package.