Skip to content

fix(mcp): report configured timeout in MCP call errors#21281

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-b625eb32
May 7, 2026
Merged

fix(mcp): report configured timeout in MCP call errors#21281
teknium1 merged 2 commits into
mainfrom
hermes/hermes-b625eb32

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

@teknium1 teknium1 commented May 7, 2026

Salvage of #10439 by @masonjames onto current main. Cherry-picked clean.

Summary

When an MCP call exceeds its configured timeout, the error now reports both the wall-clock elapsed time and the configured timeout. Previously the timeout path returned future.result(timeout=0) which raises a bare concurrent.futures.TimeoutError with an empty string — the model saw a silent failure with no context.

Also cancels the in-flight future on timeout so the coroutine doesn't keep running in the background after the caller gives up.

Before / after

str(exc) model sees
Before '' nothing — silent TimeoutError()
After MCP call timed out after 30.0s (configured timeout: 30.0s) actionable

Changes

  • tools/mcp_tool.py _run_on_mcp_loop: track start_time, cancel future on timeout, raise descriptive TimeoutError. +8 / -2.
  • tests/tools/test_mcp_tool.py: +37 lines of timeout-diagnostics regression coverage.
  • scripts/release.py: AUTHOR_MAP entry for @masonjames.

Validation

Result
scripts/run_tests.sh tests/tools/test_mcp_tool.py 183/183 passed
E2E positive: 5-second coroutine with 0.3s timeout raises TimeoutError: MCP call timed out after 0.3s (configured timeout: 0.3s), wall-clock elapsed 0.30s
E2E non-regression: fast coroutine with 5s timeout returns result cleanly
Negative control: old future.result(timeout=0) pattern raises bare TimeoutError() with empty message — confirms bug was real

Closes #10439. @masonjames's authorship preserved via rebase-merge.

masonjames and others added 2 commits May 7, 2026 06:26
Track elapsed wall time in _run_on_mcp_loop, cancel the in-flight future when a timeout expires, and raise a descriptive TimeoutError that includes the elapsed and configured timeout. Add regression coverage for the new timeout diagnostics.
@teknium1 teknium1 merged commit 8aa3040 into main May 7, 2026
9 of 11 checks passed
@teknium1 teknium1 deleted the hermes/hermes-b625eb32 branch May 7, 2026 13:28
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

🔎 Lint report: hermes/hermes-b625eb32 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 7531 on HEAD, 7531 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 3953 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have tool/mcp MCP client and OAuth labels May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have 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