From 7f033c685f4f7c53d64133800c2e59015e288f51 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Thu, 29 Oct 2026 17:25:01 -0400 Subject: [PATCH 1/2] Wait for the startup failure the conversation actually shows d1c65d07e unified refusal explanations, so a process that exits during startup is reported as LogAgentFail("ACP session startup failed") (agent_session.py:255), not the process-level detail. The test still asserts the behaviour it exists for: reported, never ready, process gone. Found on #1320's first hosted run (run 40956631782). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01RnH6dR85kyFKcc2tQAJLhK --- tests/app/test_agent_startup_failure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/app/test_agent_startup_failure.py b/tests/app/test_agent_startup_failure.py index 2ee84fda7..a6bcca840 100644 --- a/tests/app/test_agent_startup_failure.py +++ b/tests/app/test_agent_startup_failure.py @@ -9,7 +9,7 @@ async def test_a_process_that_exits_during_startup_is_reported(workspace): agent = command(sys.executable, "-c", "import sys; sys.stdin.readline() # exits_during_startup") async with workspace.app(size=(139, 25), binding=AgentAttached(agent)) as ui: - await ui.until_shows("ACP process closed", seconds=20) + await ui.until_shows("ACP session startup failed", seconds=20) assert not ui.agent_ready() await ui.until(lambda: not workspace.child_processes("exits_during_startup"), why="the agent process to be gone") From 56987b9baaab5000260607d636ee6734009d5174 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Thu, 29 Oct 2026 17:28:04 -0400 Subject: [PATCH 2/2] Delete the obsolete default-route lock probe from agent retirement AgentProcess.start captures a RouteSelection for its transcript root, and RouteSelection owns no route lock; Core publishers alone own route storage and its publication lock. The test flocked a default-route directory that need not exist (FileNotFoundError on a fresh runner, run 40956631782) and its launch_root fixture never published the route it claimed. Child and session retirement remain asserted for cancel, stop and EOF. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01RnH6dR85kyFKcc2tQAJLhK --- tests/model/test_agent_process_retirement.py | 31 ++------------------ 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/tests/model/test_agent_process_retirement.py b/tests/model/test_agent_process_retirement.py index 42b89a40c..fd7567459 100644 --- a/tests/model/test_agent_process_retirement.py +++ b/tests/model/test_agent_process_retirement.py @@ -1,46 +1,22 @@ -"""An agent process ends through EOF, cancellation or an explicit stop with its child gone, its session retired and the default-route lock released.""" +"""An agent process ends through EOF, cancellation or an explicit stop with its child gone and its session retired.""" import asyncio -import fcntl -import os import sys import psutil import pytest -from agent_comms.active_route import active_route_path from support.agents import command from toad.acp.agent import Agent @pytest.fixture def home(tmp_path, monkeypatch): - """The user's home is private, so the default route and its lock directory are this test's own.""" + """The user's home is private to this test.""" monkeypatch.setenv("HOME", str(tmp_path)) return tmp_path -@pytest.fixture -def launch_root(home): - """The published default root: only its borrowers take the default-route lock.""" - from agent_comms.active_route import LocalRoute - from agent_comms.launch_root import LaunchRoot - - return LaunchRoot.from_path(LocalRoute.default().root) - - -def route_lock_available(): - directory = os.open(active_route_path().parent, os.O_RDONLY | os.O_DIRECTORY) - try: - try: - fcntl.flock(directory, fcntl.LOCK_EX | fcntl.LOCK_NB) - except BlockingIOError: - return False - return True - finally: - os.close(directory) - - async def until(ui_condition, why): try: async with asyncio.timeout(8): @@ -51,7 +27,7 @@ async def until(ui_condition, why): @pytest.mark.parametrize("how", ["cancel", "stop", "eof"]) -async def test_the_child_and_session_are_retired_and_the_route_released(home, how, app_agents): +async def test_the_child_and_session_are_retired(home, how, app_agents): pid_file = home / f"{how}.pid" code = ( "import subprocess,sys,time;from pathlib import Path;" @@ -80,4 +56,3 @@ async def session(): await until(lambda: not descendant.is_running() or descendant.status() == psutil.STATUS_ZOMBIE, "the child to end") assert agent.process.process is None and agent.session.task is None assert not agent.session.responses and not agent.session.accepts_updates - assert route_lock_available(), "retired process retained the route lock"