Skip to content

fix(mcp): keep tool errors out of transport breaker - #91086

Closed
0xdewy wants to merge 1 commit into
NousResearch:mainfrom
TBC-wealth:fix/mcp-tool-errors-dont-trip-breaker
Closed

0xdewy wants to merge 1 commit into
NousResearch:mainfrom
TBC-wealth:fix/mcp-tool-errors-dont-trip-breaker

Conversation

@0xdewy

@0xdewy 0xdewy commented Aug 20, 2026

Copy link
Copy Markdown

Summary

Keep MCP tool-level isError results out of the per-server transport circuit breaker.

An isError result arrives only after a completed RPC round-trip, so it proves the transport is healthy. The current outer handler serializes that result to {"error": ...}, sees the generic error key, and increments _server_error_counts. Three ordinary validation/domain errors can therefore make a healthy server report "unreachable" for the cooldown period.

The handler now records when the error came from the MCP tool itself and resets the transport breaker for that completed round-trip. Transport exceptions continue to increment and open the breaker.

Tests

  • four consecutive tool errors all reach the server and leave the breaker closed
  • a tool error resets two prior transport strikes
  • existing half-open, reconnect, and transport-failure behavior remains covered
  • 134 targeted MCP tests pass
  • Ruff passes

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists tool/mcp MCP client and OAuth duplicate This issue or pull request already exists labels Aug 20, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Duplicate of #74045. Both prevent completed MCP tool-level error responses from opening the transport breaker; #74045 is the broader open repair with auth/session-recovery coverage.

@teknium1

Copy link
Copy Markdown
Collaborator

Closing with a maintainer ruling rather than a quality verdict. Tool isError payloads keep counting as circuit-breaker strikes: that is #10447's original intent (a server answering errors made the model hammer it 8x in 10s) and #109180 reasserted it on main today. The real symptom behind these reports is the open-breaker message: after three rejected calls the model was told the server was "unreachable" and gave up on the task. #109245 fixes the wording ("rejected the last 3 calls — fix the arguments"), keeps the strikes, and restores "unreachable" the moment a transport strike appears. Thanks for digging into this; the symptom analysis was right, the fix landed at a different layer.

@teknium1 teknium1 closed this Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists tool/mcp MCP client and OAuth type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants