Repository navigation
fix(mcp): surface resolved tool failures to clients - #126472
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 19, 2026, 7:30 PM ET / 23:30 UTC. ClawSweeper reviewWhat this changesProjects OpenClaw’s canonical resolved tool-failure classification into the MCP Merge readinessKeep this maintainer-labeled PR open: current main still omits the MCP failure signal for resolved tool failures, while the proposed shared-boundary projection matches the existing canonical classifier and has no blocking defect found. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherOpenClaw’s MCP servers expose registered tools to MCP clients. Their shared handler executes a tool, converts its content into MCP blocks, and returns a protocol result that clients use to distinguish success from failure. flowchart LR
A[MCP client] --> B[MCP server]
B --> C[Shared tool handler]
C --> D[OpenClaw tool]
D --> E[Canonical failure classifier]
E --> F[MCP result]
F --> G[Client recovery]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests +61. Total +64 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep failure policy in Do we have a high-confidence way to reproduce the issue? Yes: current main’s shared handler returns resolved failed results without Is this the best way to solve the issue? Yes: projecting the existing canonical classification at the one shared MCP framing boundary avoids duplicate policy and covers all MCP server callers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1762f43a34c5. LabelsLabel 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
|
|
Land-ready proof for
Best-fix verdict: this is the canonical shared-boundary repair. An MCP-local status list would duplicate policy, and changing each server caller separately would leave divergent sibling behavior. |
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where MCP clients could receive a resolved OpenClaw tool failure as an ordinary successful tool result. Plugin tools, built-in OpenClaw tools, and Codex supervision tools share this server path, so a failed or blocked tool could be shown to the calling agent without MCP's failure signal.
Why This Change Was Made
The shared MCP handler now projects OpenClaw's canonical resolved tool-result failure classification into MCP's
isError: truefield while preserving the original result content. Successful results remain unchanged, including the intentional contract that a completed shell result with a nonzero exit code is not automatically a tool failure.This reuses the existing
isToolResultErrorowner instead of introducing a second MCP-specific classifier.User Impact
MCP clients can now distinguish resolved tool failures from successful tool results and let the agent respond or self-correct appropriately. There is no configuration, protocol-version, storage, or migration change.
Evidence
Exact PR head:
38f5444305723e2058b8958339bce17c314ba1adExact-head CI: run 32313158695 is green, including
openclaw/ci-gate: https://github.com/openclaw/openclaw/actions/runs/32313158695isErrorwas absent.node scripts/run-vitest.mjs src/mcp/plugin-tools-serve.test.ts src/mcp/plugin-tools-mcp-client.test.ts— 21/21 passed on the exact head.node scripts/run-vitest.mjs src/mcp— 66/66 passed on the exact head, covering all current MCP server surfaces after rebasing ontoorigin/main.@modelcontextprotocol/sdkin-memory client/server test proves the error bit survives real MCP framing while result content remains intact.node scripts/check-changed.mjs -- src/mcp/plugin-tools-handlers.ts src/mcp/plugin-tools-mcp-client.test.ts src/mcp/plugin-tools-serve.test.ts— passed, including core/core-test types, targeted lint, boundary guards, dead-export checks, and import-cycle architecture../node_modules/.bin/oxfmt --check src/mcp/plugin-tools-handlers.ts src/mcp/plugin-tools-mcp-client.test.ts src/mcp/plugin-tools-serve.test.ts— passed.git diff --check origin/main...HEAD— passed.AI-assisted: yes. I reviewed the complete handler, its three server callers, adjacent tests, the MCP SDK contract, and the Codex MCP client behavior, and I understand the change.