Skip to content

fix: retry cancelled streamable-http MCP calls on isolated session#2683

Draft
elainegan-openai wants to merge 1 commit intomainfrom
dev/elainegan/mcp-streamable-http-isolated-retry
Draft

fix: retry cancelled streamable-http MCP calls on isolated session#2683
elainegan-openai wants to merge 1 commit intomainfrom
dev/elainegan/mcp-streamable-http-isolated-retry

Conversation

@elainegan-openai
Copy link
Contributor

Summary

  • retry a streamable-http MCP call_tool once on a fresh isolated session when the shared-session request is cancelled internally
  • preserve true outer task cancellation instead of masking it
  • add focused regression tests for sibling-cancellation recovery and outer-cancellation propagation

Why

The deeper issue appears to be in the shared streamable-http transport task group: one failed request can cancel sibling in-flight requests on the same session. #2682 serialized same-session requests as a blunt workaround, but that trades away same-server parallelism. This PR keeps the workaround narrow by only paying extra cost on the affected failure path.

Validation

  • python -m ruff check src/agents/mcp/server.py tests/mcp/test_client_session_retries.py
  • uv run python -m pytest tests/mcp/test_client_session_retries.py -q
  • uv run python -m pytest tests/mcp/test_mcp_util.py -q
  • make typecheck

Co-authored-by: Codex <noreply@openai.com>
@github-actions github-actions bot added bug Something isn't working feature:mcp labels Mar 16, 2026
@seratch seratch changed the title [SEVBot] Retry cancelled streamable-http MCP calls on isolated session fix: retry cancelled streamable-http MCP calls on isolated session Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:mcp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant