From 3a65fdc2e02ec4bc8abe5fe425dc1a8cb99b3daf Mon Sep 17 00:00:00 2001 From: "nekomimi.pet" Date: Wed, 30 Sep 2026 01:14:15 -0400 Subject: [PATCH] test: isolate agent lookup and avoid transient boot assertions --- test/e2e/agents_python_test.py | 5 +++-- test/e2e/agents_swarm_test.py | 16 +++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/test/e2e/agents_python_test.py b/test/e2e/agents_python_test.py index 7964ac871..cfad85e0c 100644 --- a/test/e2e/agents_python_test.py +++ b/test/e2e/agents_python_test.py @@ -55,9 +55,10 @@ except AgentsError as error: print('PEEK_REFUSED', error) listed = await agents.sessions() print('LISTED', {kid!r} in [s.id for s in listed], agents.self.id in [s.id for s in listed]) -scouts = await agents.sessions('SCOUT', cwd=listed[0].cwd) +child_session = next(s for s in listed if s.id == {kid!r}) +scouts = await agents.sessions('SCOUT', cwd=child_session.cwd) scout = next(s for s in scouts if s.id == {kid!r}) -print('BY_NAME', scout.name, scout.depth, scout.model, scout.cwd == listed[0].cwd) +print('BY_NAME', scout.name, scout.depth, scout.model, scout.cwd == child_session.cwd) print('ELSEWHERE', await agents.sessions(cwd='/nowhere')) talked = await agents.sessions('COUNT TO THREE') said = next(s for s in talked if s.id == {kid!r}) diff --git a/test/e2e/agents_swarm_test.py b/test/e2e/agents_swarm_test.py index 450c6146a..cb7147210 100644 --- a/test/e2e/agents_swarm_test.py +++ b/test/e2e/agents_swarm_test.py @@ -49,7 +49,6 @@ class AgentsSwarmTests(unittest.TestCase): time.monotonic() - started, 30, "spawn must not await kernel boot" ) slowest = 0.0 - saw_starting = False deadline = time.monotonic() + 300 while time.monotonic() < deadline: answers = self.answers(app, roots) @@ -61,9 +60,7 @@ class AgentsSwarmTests(unittest.TestCase): ) for child in children[::6]: with app.api(f"/sessions/{child}/status") as response: - saw_starting |= ( - json.load(response).get("phase") == "starting" - ) + json.load(response) slowest = max(slowest, time.monotonic() - tick) if sum(answers) == ROOTS * CHILDREN: break @@ -72,7 +69,16 @@ class AgentsSwarmTests(unittest.TestCase): self.assertLess( slowest, 5, "status and tree calls must stay responsive" ) - self.assertTrue(saw_starting, "must observe at least one kernel boot") + # Fast kernels can finish before the first status poll. Their + # completed Python outputs prove every child actually booted. + completed = [ + record + for record in provider.requests + if record["request"]["messages"][-1].get("role") == "tool" + and "cell ran" + in record["request"]["messages"][-1].get("content", "") + ] + self.assertEqual(len(completed), ROOTS * CHILDREN) with app.api("/health") as response: self.assertTrue(json.load(response)["ok"]) finally: -- knotmirror 0.0.1