fix(streamable-http): reject duplicate request IDs#2756
Open
Epochex wants to merge 3 commits into
Open
Conversation
StantonMatt
reviewed
Jun 3, 2026
StantonMatt
left a comment
There was a problem hiding this comment.
Checked this on Windows at head ddd7789. The focused regression/manager run passed for me:
uv run --frozen pytest tests/issues/test_2655_streamable_http_duplicate_request_id.py tests/server/test_streamable_http_manager.py -q-> 21 passeduv run --frozen ruff check src/mcp/server/streamable_http.py tests/issues/test_2655_streamable_http_duplicate_request_id.pyuv run --frozen pyright src/mcp/server/streamable_http.py tests/issues/test_2655_streamable_http_duplicate_request_id.py
I also probed the non-JSON/SSE response path separately: held a tools/call open with id dup-sse-1, sent a second ping with the same id, and got HTTP 409 with the JSON-RPC error preserving id dup-sse-1 / -32600. After releasing the first request, the original SSE stream still completed as 200 text/event-stream with the original id and result, so the duplicate guard did not consume or close the active stream.
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.
Fixes #2655.
When a Streamable HTTP session receives a second JSON-RPC request with an id that is already in-flight, the transport used to overwrite the per-id stream slot, leaving the first request hanging until client timeout.
This change rejects the duplicate with HTTP 409 + JSON-RPC error (preserving the offending id) and leaves the original request untouched.
Tests: