{{ message }}
Backport abandoned-request resolution from 2.x to the 1.x Streamable HTTP client - #3444
Closed
zgj-ssslab wants to merge 1 commit into
Closed
zgj-ssslab wants to merge 1 commit into
zgj-ssslab wants to merge 1 commit into
Conversation
…HTTP client On the 1.x line, a pending request stays unresolved forever when the server answers its POST with 202 Accepted, when the per-request SSE stream ends without carrying a response event, or when reconnection attempts are exhausted: the caller only learns of the failure when its own deadline fires, and it surfaces as a timeout rather than a disconnect. Port the _resolve_abandoned_request mechanism from 2.x (PR modelcontextprotocol#3047) to the 1.x StreamableHTTPTransport: resolve the pending request with a synthesized JSONRPCError (CONNECTION_CLOSED, or INVALID_REQUEST for the 202 case) at the three sites where its response can never arrive. Notifications are not affected. Fixes modelcontextprotocol#3441
Contributor
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.

Summary
On the 1.x line (
v1.29.x, and thev1.xbranch), a pending request stays unresolved forever when:202 Accepted,The caller only learns of the failure when its own deadline fires, and it surfaces as a timeout rather than a disconnect.
Fix
Port the
_resolve_abandoned_requestmechanism from 2.x (#3047, shipped in v2.0.0) to the 1.xStreamableHTTPTransport, adapted to the 1.x root-model message API:202 Acceptedis resolved withINVALID_REQUEST;CONNECTION_CLOSED;CONNECTION_CLOSED;How I checked
tests/client/test_streamable_http_abandoned_request.py(no network, no real server): the three resolution paths above, plus a guard that a 202 for a notification injects nothingtests/shared/test_streamable_http.pysuite passes (58 tests), includingtest_streamable_http_multiple_reconnectionsFixes #3441