Backport abandoned-request resolution from 2.x to the 1.x Streamable HTTP client - #3444
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
|
This PR has been closed automatically. This repo only keeps pull requests open when they come from a maintainer, or from a contributor a maintainer has assigned to the linked issue, and you aren't currently assigned to #3441. If a maintainer assigns you to #3441, this PR reopens on its own and there's nothing more you need to do here. Assignment is a maintainer call based on capacity; comments that only ask to be assigned don't factor in. What does help is engaging on the issue itself by confirming the repro, explaining why it matters for your use case, or describing the approach you'd take. You're welcome to keep pushing commits here (just avoid force-pushing, since GitHub can't reopen a rewritten branch), but that on its own won't get the PR reviewed or the issue assigned, and realistically most auto-closed PRs stay closed. There's no need to open a new PR either way. CONTRIBUTING.md has the full reasoning, but in short:
Maintainers: reopen, remove |
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