fix(mcp): harden stdio transport recovery - #95290
silverstein wants to merge 6 commits into
Conversation
|
9044dcc to
5b7a366
Compare
|
Thanks for the review. I made two structural changes and addressed the concrete implementation points:
I am intentionally retaining process liveness as the default idle probe for stdio. Local stdio has no remote session TTL, and we reproduced valid SDK servers closing their transports when sent the optional MCP Verification on the rebased MCP-only head: 591 MCP tests passed, Ruff passed, and |
5b7a366 to
7eb790a
Compare
|
Heads-up: the |
|
Triage note (not a review verdict): this PR bundles several independent pieces, two of which have since landed or been salvaged elsewhere — the |
7eb790a to
c2314b9
Compare
|
Rebased onto current The overlapping Final verification on head
|
|
Split completed as requested:
Both replacement PRs are rebased onto current |
Summary
Harden stdio MCP lifecycle handling so dead children trigger a fresh transport without coroutine leaks, PID cross-contamination, event-loop restart failures, or optional-ping reconnect churn.
Slack deduplication is intentionally split into focused PR #95124.
Changes
Keepalive rationale
Local stdio transports have no remote session TTL, and observed otherwise-valid SDK servers close when sent the optional MCP
ping. Stdio therefore defaults to owned-process liveness at idle and proves protocol health through bounded real calls. HTTP/SSE retains protocol keepalive because remote session expiry cannot be inferred from a local process. An opt-in stdio protocol-probe mode can be considered separately without restoring a default known to churn valid servers.Verification
pytest tests/tools/test_mcp*.py→ 591 passedgit diff --check origin/main...HEAD→ passedRisk / rollback
Scoped to MCP transport lifecycle and tests. Revert the six PR commits to restore prior behavior.