Skip to content

The agent that grows with you

chore: address AI-review nits on _ever_connected fix

chelsealong8f517f5ca66a
diff --git a/tests/tools/test_mcp_tool.py b/tests/tools/test_mcp_tool.py
index 46ddf6db453..046b303d42f 100644
--- a/tests/tools/test_mcp_tool.py
+++ b/tests/tools/test_mcp_tool.py
@@ -1444,15 +1444,11 @@ class TestReconnection:
if run_count == 1:
# Initial connection succeeds and registers tools. Setting
# ``_ever_connected`` mirrors what the real ``_run_stdio``
- # does right after a successful ``_discover_tools()`` call;
- # guarded because the pre-fix class has no such slot.
+ # does right after a successful ``_discover_tools()`` call.
self_srv.session = MagicMock()
self_srv._tools = []
self_srv._ready.set()
- try:
- self_srv._ever_connected = True
- except AttributeError:
- pass
+ self_srv._ever_connected = True
return "reconnect"
if run_count <= 5:
# Four consecutive failures on later reconnect attempts --
diff --git a/tools/mcp_tool.py b/tools/mcp_tool.py
index 4f9078aaaa6..c1c80e5adb1 100644
--- a/tools/mcp_tool.py
+++ b/tools/mcp_tool.py
@@ -4133,6 +4133,7 @@ class MCPServerTask:
# that already registered tools once and then dropped would
# otherwise be misclassified as never having connected and
# re-enter this initial-connect ladder (#94654).
+ # ``_ever_connected`` itself is set once and never cleared.
# (Ported from Kilo Code's MCP resilience fix.)
if not self._ever_connected:
if failure_class == "permanent":