chore: address AI-review nits on _ever_connected fix

Drop the try/except AttributeError guard in the new regression test
now that the slot is always defined, and note in the run() comment
that _ever_connected is set once and never cleared.
This commit is contained in:
chelsealong
2026-08-25 13:35:20 +00:00
committed by Teknium
parent e8dc0af5b1
commit 8f517f5ca6
2 changed files with 3 additions and 6 deletions
+2 -6
View File
@@ -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 --
+1
View File
@@ -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":