Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion tools/mcp_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2014,7 +2014,19 @@ async def _discover_all():

# Per-server timeouts are handled inside _discover_and_register_server.
# The outer timeout is generous: 120s total for parallel discovery.
_run_on_mcp_loop(_discover_all(), timeout=120)
#
# Temporarily clear the interrupt flag on the current thread so that MCP
# discovery is never cancelled by a stale interrupt from a prior agent
# session (executor threads get reused and may carry old interrupt state).
from tools.interrupt import is_interrupted as _is_interrupted, set_interrupt as _set_interrupt
_was_interrupted = _is_interrupted()
if _was_interrupted:
_set_interrupt(False)
try:
_run_on_mcp_loop(_discover_all(), timeout=120)
finally:
if _was_interrupted:
_set_interrupt(True)

# Log a summary so ACP callers get visibility into what was registered.
with _lock:
Expand Down