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:
@@ -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 --
|
||||
|
||||
@@ -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":
|
||||
|
||||
Reference in New Issue
Block a user