fix(test): widen pollWithTimeout window in mcp lifecycle abort assertions - #208
Merged
Merged
Conversation
…ions Closes #207 Three scenarios in test/mcp/lifecycle.test.ts poll for a session/transport abort signal via pollWithTimeout(), whose default window is 5 seconds (test/lib/effect.ts). Under CI-load variance that window is tight enough for legitimate (if slow) abort/teardown latency to miss it — the same class of issue already documented and fixed for subprocess timeouts in #191/#202 ("widen with headroom rather than shave to the exact miss"). Widened to 10 seconds for: - "disconnect removes protocol data and reconnect establishes a new session" (disconnected HTTP session abort) - "add() closes the old protocol session when replacing a server" (replaced HTTP session abort) — the one observed failing in CI - "remote timeout aborts both real HTTP transport attempts" (remote transport abort) Verified: `bun test test/mcp/lifecycle.test.ts --timeout 60000` passes 21/21, run 3x consecutively with 0 flakes. `bun turbo typecheck` passes. Co-Authored-By: Claude Sonnet 5 <[email protected]>
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.
Issue for this PR
Closes #207
Type of change
What does this PR do?
bun run test(the regular unit suite, nottest:httpapi) intermittently failstest/mcp/lifecycle.test.ts's "add() closes the old protocol session when replacing a server" witherror: replaced HTTP session was not aborted.Root cause: three scenarios in this file poll for a session/transport abort signal via
pollWithTimeout(), whose default window is 5 seconds (test/lib/effect.ts). Under CI-load variance that window is tight enough for legitimate (if slow) abort/teardown latency to miss it — the same class of issue already documented and fixed for subprocess timeouts in #191/#202 ("widen with headroom rather than shave to the exact miss").Widened the timeout to 10 seconds for all three affected scenarios:
Confirmed this is a legitimate-latency issue, not a genuine app-level hang: the abort does complete, just not always inside the old 5s window under load.
How did you verify your code works?
bun test test/mcp/lifecycle.test.ts --timeout 60000→ 21/21 pass, run 3x consecutively with 0 flakes.bun turbo typecheck→ all 30 packages pass.Screenshots / recordings
N/A (test-only change, no UI impact).
Checklist
🤖 Generated with Claude Code