Skip to content

fix(mcp): don't trip circuit breaker on tool errors - #74718

Closed
renga-mn-agent wants to merge 1 commit into
NousResearch:mainfrom
renga-mn-agent:hotfix/mcp-tool-error-circuit-breaker
Closed

fix(mcp): don't trip circuit breaker on tool errors#74718
renga-mn-agent wants to merge 1 commit into
NousResearch:mainfrom
renga-mn-agent:hotfix/mcp-tool-error-circuit-breaker

Conversation

@renga-mn-agent

Copy link
Copy Markdown

What does this PR do?

Treats completed MCP CallToolResult(isError=True) responses as tool/domain errors rather than server connectivity failures.

A completed RPC proves the MCP transport is reachable. Counting a tool-level validation error toward the server circuit breaker can incorrectly mark a healthy MCP server as unreachable and prevent subsequent valid calls.

Related Issue

N/A

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Reset the server connectivity breaker after any completed tools/call RPC, including isError=True results.
  • Preserve completed tool/domain errors returned after OAuth recovery or session reconnect instead of reclassifying them as auth/transport failures.
  • Continue counting raised timeout, transport, and session failures toward the connectivity breaker.
  • Add regression coverage for normal calls, OAuth retries, and session-reconnect retries.

How to Test

  1. Run .venv/bin/python -m pytest tests/tools/test_mcp*.py -q -o 'addopts='.
  2. Confirm repeated CallToolResult(isError=True) responses do not open the server connectivity breaker.
  3. Confirm OAuth and session reconnect retries return completed tool errors unchanged.

Focused result: 385 passed.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Linux

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — docstrings updated
  • I've updated cli-config.yaml.example if I added/changed config keys — N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — no platform-specific APIs added
  • I've updated tool descriptions/schemas if I changed tool behavior — N/A

Screenshots / Logs

N/A

@alt-glitch alt-glitch added type/bug Something isn't working comp/tools Tool registry, model_tools, toolsets tool/mcp MCP client and OAuth P2 Medium — degraded but workaround exists labels Jul 30, 2026
@renga-mn-agent

Copy link
Copy Markdown
Author

Closing this PR to recreate it from the intended contributor account.

@renga-mn-agent

Copy link
Copy Markdown
Author

Replacement: #74795, authored by @renga-kogahara.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets 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.

2 participants