The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
review: tighten pre-call gate comment; drop redundant _ReadyAdapter test stub
kshitij8966b0a70029
diff --git a/tests/tools/test_mcp_stdio_fastfail_reconnect.py b/tests/tools/test_mcp_stdio_fastfail_reconnect.pyindex cee7bf56041..80ae5119811 100644--- a/tests/tools/test_mcp_stdio_fastfail_reconnect.py+++ b/tests/tools/test_mcp_stdio_fastfail_reconnect.py@@ -36,16 +36,6 @@ def _install_stub_server(mcp_tool_module, name: str, call_tool_impl,ready_flag = threading.Event()ready_flag.set()- class _ReadyAdapter:- def is_set(self):- return ready_flag.is_set()-- def clear(self):- ready_flag.clear()-- def set(self):- ready_flag.set()-class _ReconnectAdapter:def __init__(self):self.set_calls = 0@@ -54,7 +44,7 @@ def _install_stub_server(mcp_tool_module, name: str, call_tool_impl,self.set_calls += 1server._reconnect_event = _ReconnectAdapter()- server._ready = _ReadyAdapter()+ server._ready = ready_flagserver._is_recycled_stdio.return_value = False# The fast-fail gate requires a callable returning a real bool# (MagicMock's truthy Mock is deliberately ignored).diff --git a/tools/mcp_tool.py b/tools/mcp_tool.pyindex 1af949a285b..6accd450a07 100644--- a/tools/mcp_tool.py+++ b/tools/mcp_tool.py@@ -6165,16 +6165,12 @@ def _make_tool_handler(server_name: str, tool_name: str, tool_timeout: float):and isinstance(_stdio_dead_result := _stdio_dead(), bool)and _stdio_dead_result):- # Dead stdio children with a stale session object: the- # transport failed WITHOUT clearing session, so the- # transport-down reconnect path above never fires.- # Signal the server task to rebuild the transport- # (respawn the subprocess) in the background and return- # a clean reconnecting error; the next call lands on- # the fresh session. The breaker resets once it- # initializes. No explicit _bump_server_error here:- # this error return flows through the handler's JSON- # parse, which already bumps once on any error payload.+ # Dead children but stale server.session, so the+ # transport-down path above never fired — signal the+ # server task to respawn and return a clean+ # reconnecting error. No explicit _bump_server_error:+ # the error return flows through the handler's JSON+ # parse, which already bumps once.if _signal_reconnect(server):return tool_error(f"MCP server '{server_name}' stdio subprocess is "