Repository navigation
Conversation
|
This PR has been closed automatically. It's still a draft, but we close those early so you don't put in more time only to have it closed the moment you mark it ready. 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 this PR doesn't link an open issue yet.
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 |
Related to #3560 (the HTTP ReadTimeout case). This does not fix every transport error in that issue.
Contain an HTTP read timeout in its request task and return a correlated
REQUEST_TIMEOUT(-32001), so one slow POST does not cancel sibling requests or tear down the shared session.Motivation and Context
With the current streamable HTTP transport,
httpx2.ReadTimeoutwhile awaiting POST response headers or reading a JSON response escapes into the shared AnyIO task group. Other in-flight calls are cancelled and transport cleanup raises an ExceptionGroup. This was observed downstream with MCP 2.3.0, FastMCP 4.1.1 and Cortex; the SDK-only regression tests reproduce it on main at 2af9e30.The fix catches only ReadTimeout, resolves the original request through the existing response channel, and uses a fixed message rather than forwarding upstream exception details. No retry is added. Initial initialize/server-discover errors and explicit cancellation retain their existing behavior. Notification failures and other transport exception types remain outside this patch's scope.
This overlaps the ReadTimeout portion of #3584, which is closed and unmerged. This narrower patch uses REQUEST_TIMEOUT and also covers resumption-header timeouts.
How Has This Been Tested?
Final validation (Python 3.12.15, upstream frozen lockfile):
./scripts/test— 6,220 passed, 10 skipped, 1 xfailed; 100% branch coverage; strict-no-cover passed.uv run --frozen ruff check .and formatting checks on changed Python files — passed.uv run --frozen pyright src/mcp/client/streamable_http.py tests/client/test_streamable_http.py— 0 errors.uv run --frozen pyrightreports two macOSos.waitiderrors in unchangedtests/transports/stdio/test_lifecycle.py:190; no errors in changed files.Breaking Changes
A request-local HTTP ReadTimeout now reaches its caller as MCPError(REQUEST_TIMEOUT), rather than cancelling the surrounding task group and surfacing during transport cleanup. No public signatures or configuration change. Server execution may continue after the client's timeout; this fix does not make retrying mutating calls safe.
Types of changes
Checklist
Additional context
AI disclosure: Codex prepared the implementation, regression tests, and this description from the reporter's local patch and investigation. This draft awaits human review; it does not claim the author has reviewed or can personally explain all generated changes.
The linked issue has not been assigned to this author. This PR covers only its ReadTimeout case and deliberately uses a non-closing reference. Under the repository's intake policy, it may be automatically closed until a maintainer accepts and assigns the work.