Uh oh!
There was an error while loading. Please reload this page.
fix: isolate streamable HTTP POST errors - #2613
Conversation
There was a problem hiding this comment.
Pull request overview
Backports main’s request-scoped handling of HTTP POST failures for the Streamable HTTP transport in the v1.x line, preventing a single request’s non-2xx POST response from escaping the per-request task and tearing down concurrent sibling requests.
Changes:
- Convert POST HTTP
>=400(non-404) responses into request-scoped JSON-RPC errors for JSON-RPC requests (and avoid synthesizing responses for notifications). - Add a concurrency regression test ensuring one failing POST does not cancel an unrelated in-flight request.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/mcp/client/streamable_http.py | Scopes POST HTTP error handling to the originating JSON-RPC request instead of raising through the shared task group. |
tests/shared/test_streamable_http.py | Adds a regression test covering concurrent requests where one receives an HTTP 400 and the other still completes successfully. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
8d17351 to
ab917f9Compareab917f9 to
cca10c2Compare
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
…ost-error-isolation
Kludex
commented
Jun 25, 2026
You've opened a duplicated pull request, please search opened PRs before creating new ones. Duplicated from #1998. |
Summary
Fixes#2604.
This targets
v1.xbecause the released 1.x branch still raises throughresponse.raise_for_status()for POST HTTP errors.mainalready has equivalent scoped>=400handling; this PR backports that behavior and adds the concurrency regression coverage for the reported failure mode.Validation
uv run --frozen pytest tests/shared/test_streamable_http.py::test_streamable_http_client_http_error_does_not_cancel_concurrent_requestuv run --frozen pytest tests/shared/test_streamable_http.py-> 52 passeduv run --frozen pytest tests/shared/test_streamable_http.py::test_streamable_http_client_http_error_does_not_cancel_concurrent_request tests/shared/test_streamable_http.py::test_streamable_http_client_session_termination tests/shared/test_streamable_http.py::test_streamable_http_client_session_termination_204 tests/client/test_notification_response.py::test_non_compliant_notification_response-> 4 passeduv run --frozen ruff check src/mcp/client/streamable_http.py tests/shared/test_streamable_http.pyuv sync --frozen --all-extras --devuv run --frozen pyright-> 0 errorsgit diff --check