Repository navigation
fix(mcp): hide disconnected server catalogs during recovery - #165158
Conversation
Clear the per-server tool and utility inventory when its transport must be replaced. Keep the failure diagnostic and background retry while leaving healthy sibling servers available. Regression proof: original code exposed five disconnected stdio entries and an expired SSE tool. Both fail-before regressions pass with the fix; the full runtime and SSE suites pass 68 tests on Blacksmith Testbox. (cherry picked from commit be29b51c97d95c4f64a75cda0eda804923adb9cf)
…ixture Keep transport lifetime in the runtime and project unavailable catalogs through the existing catalog owner. Extract shared stdio support and the process-recovery regression so the fix respects line-cap guards without dropping coverage. Full related MCP suites pass on Blacksmith; formatter output is synchronized from the remote proof checkout. (cherry picked from commit fb28e3c40a6a4574b0869b01a80311283d23d6fa)
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. Reviewed October 4, 2026, 6:27 PM ET / 22:27 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR hides a disconnected MCP server’s tools, resources, and prompts during recovery, preserves healthy servers, and extracts shared recovery fixtures. Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this is a focused recovery fix that fetched main still needs, with no blocking correctness finding. Likely related people: steipete and Ayaan Zaidi, based on recent MCP runtime work. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s MCP runtime connects configured servers and turns their catalogs into agent tools. Per-server catalogs are combined for discovery, while transport failures trigger background recovery. flowchart TD
A[Configured MCP servers] --> B[Per-server connections]
B --> C[Connection available]
C -->|Yes| D[Loaded catalog]
C -->|No| E[Empty catalog with diagnostic]
E --> B
D --> F[Combined discovery]
E --> F
F --> G[Agent tools and utilities]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +12, Tests +93, Docs +5. Total +110 across 7 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep transport recovery in the existing runtime and expose only currently available catalogs through the shared discovery projection. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the failure path: an established transport closes or expires, and main retains its previous catalog during retry. The focused regressions exercise those triggers; this review did not execute them. Is this the best way to solve the issue? Yes. Updating the existing per-server catalog projection repairs discovery without adding a competing recovery owner, changing configuration, or replaying failed calls. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 42ebb9d73483. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…#165158) * fix(mcp): hide disconnected server catalogs during recovery Clear the per-server tool and utility inventory when its transport must be replaced. Keep the failure diagnostic and background retry while leaving healthy sibling servers available. Regression proof: original code exposed five disconnected stdio entries and an expired SSE tool. Both fail-before regressions pass with the fix; the full runtime and SSE suites pass 68 tests on Blacksmith Testbox. (cherry picked from commit be29b51c97d95c4f64a75cda0eda804923adb9cf) * refactor(mcp): separate unavailable catalog projection and recovery fixture Keep transport lifetime in the runtime and project unavailable catalogs through the existing catalog owner. Extract shared stdio support and the process-recovery regression so the fix respects line-cap guards without dropping coverage. Full related MCP suites pass on Blacksmith; formatter output is synchronized from the remote proof checkout. (cherry picked from commit fb28e3c40a6a4574b0869b01a80311283d23d6fa)
What Problem This Solves
When a connected MCP server died (a stdio process crashed, or an SSE session expired), its tools, resources, and prompts stayed in the model's tool list while recovery was in progress. The model kept calling tools that could only fail, and those failures said nothing useful about the server being down.
Why This Change Was Made
Recovery in
src/agents/agent-bundle-mcp-runtime.tskept the last successful catalog for the disconnected server (introduced in36f5e61f4eb5). The runtime now projects a disconnected server's catalog as unavailable while recovery runs. Its tools, resource, and prompt utilities are hidden through the normal gating, healthy sibling servers are unaffected, and a successful reconnect restores the catalog. This follows the repo rule that unavailable tools are hidden by gating rather than left to fail. A small extraction keeps the runtime file within the line cap and moves the recovery fixture next to its tests.User Impact
Agents stop calling tools from a crashed or expired MCP server and pick them up again when it reconnects.
Evidence