Skip to content

fix(client): surface streamable HTTP request failures#2523

Open
Genmin wants to merge 2 commits intomodelcontextprotocol:mainfrom
Genmin:codex/fix-streamable-http-connect-errors
Open

fix(client): surface streamable HTTP request failures#2523
Genmin wants to merge 2 commits intomodelcontextprotocol:mainfrom
Genmin:codex/fix-streamable-http-connect-errors

Conversation

@Genmin
Copy link
Copy Markdown

@Genmin Genmin commented Apr 30, 2026

Fixes #915

Summary

  • convert per-request Streamable HTTP transport failures into JSON-RPC errors for the pending request
  • keep notification transport failures contained so the transport task group does not crash
  • add regressions for direct streamable_http_client use and ClientSessionGroup.connect_to_server()

Validation

  • uv run pytest tests/client/test_notification_response.py::test_transport_error_sends_jsonrpc_error tests/client/test_notification_response.py::test_transport_error_on_notification_does_not_crash_transport tests/client/test_session_group.py::test_client_session_group_streamable_http_connect_error_is_catchable -q
  • uv run pytest tests/client/test_notification_response.py tests/client/test_session_group.py -q
  • uv run pytest tests/shared/test_streamable_http.py::test_streamable_http_client_basic_connection tests/shared/test_streamable_http.py::test_streamable_http_client_error_handling tests/client/test_transport_stream_cleanup.py::test_streamable_http_client_closes_all_streams_on_exit -q
  • uv run ruff format --check src/mcp/client/streamable_http.py tests/client/test_notification_response.py tests/client/test_session_group.py
  • uv run ruff check src/mcp/client/streamable_http.py tests/client/test_notification_response.py tests/client/test_session_group.py
  • uv run pyright src/mcp/client/streamable_http.py tests/client/test_notification_response.py tests/client/test_session_group.py
  • git diff --check

@Genmin
Copy link
Copy Markdown
Author

Genmin commented Apr 30, 2026

Pushed a small CI cleanup after inspecting the failed jobs. The original regression test covered previously excluded ClientSessionGroup cleanup/error paths, so I narrowed those coverage pragmas and reran the CI-equivalent coverage checks locally.\n\nValidation run after the update:\n- uv run pytest tests/client/test_notification_response.py tests/client/test_session_group.py -q\n- uv run ruff format --check src/mcp/client/streamable_http.py src/mcp/client/session_group.py tests/client/test_notification_response.py tests/client/test_session_group.py\n- uv run ruff check src/mcp/client/streamable_http.py src/mcp/client/session_group.py tests/client/test_notification_response.py tests/client/test_session_group.py\n- uv run pyright src/mcp/client/streamable_http.py src/mcp/client/session_group.py tests/client/test_notification_response.py tests/client/test_session_group.py\n- uv run --frozen --no-sync coverage run -m pytest -n auto && uv run --frozen --no-sync coverage combine || true; uv run --frozen --no-sync coverage report && uv run --frozen --no-sync strict-no-cover\n- UV_PROJECT_ENVIRONMENT=.venv-py314 uv run --python 3.14 pytest tests/client/test_notification_response.py::test_transport_error_sends_jsonrpc_error tests/client/test_session_group.py::test_client_session_group_streamable_http_connect_error_is_catchable -q

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exception in ClientSessionGroup if streamable_http MCP server is not available

1 participant