From e39a40f732a222b0670ca09167776a01dc1485dc Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Sun, 25 Oct 2026 00:57:10 -0400 Subject: [PATCH 1/2] Open: discover_members returns only the package's own members Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Q8rVa3cPyXzpCKyR8XvM8W From 2068b8efbdced42f00611396b20f1ca990153c05 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Sun, 25 Oct 2026 01:06:05 -0400 Subject: [PATCH 2/2] Scope HolderSeenProbe to its test so OutgoingWire never sees it The probe was declared at module level in tests/test_install_worker_holds.py, so it stayed in RuntimeProbe.__registry__ for every later test in the worker and OutgoingWire read it as an installer probe outside the package. Declare it inside the one test that uses it and pop it from the registry in finally. test_repairs' tree() fixture now writes the pyproject.toml scripts entry Package needs since #3184. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Q8rVa3cPyXzpCKyR8XvM8W --- tests/test_install_worker_holds.py | 42 +++++++++++++++++------------- tests/test_repairs.py | 1 + 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/tests/test_install_worker_holds.py b/tests/test_install_worker_holds.py index 9484e8cf28..d7697a74d1 100644 --- a/tests/test_install_worker_holds.py +++ b/tests/test_install_worker_holds.py @@ -25,12 +25,6 @@ from agent_comms.maintenance_barrier import HOLDER_NONCE, MaintenanceClaimHolder -@dataclass(frozen=True) -class HolderSeenProbe(RuntimeProbe[str]): - def run(self) -> str: - return os.environ.get(HOLDER_NONCE, "") - - @pytest.mark.parametrize("command", [StartCliCommand, StopCliCommand]) def test_owner_actions_decode_in_the_selected_worker(comms, command): runtime = LaunchRuntime.running() @@ -73,18 +67,30 @@ def test_probes_under_successive_holds_share_one_worker(): def test_worker_answers_each_request_as_that_request_s_holder(monkeypatch, tmp_path): - holders = (ClaimId.mint(), ClaimId.mint(), "") - lines = "".join(FieldCodec.compact(FieldCodec.encode(ProbeRequest(HolderSeenProbe(), holder))) - + "\n" for holder in holders) - # serve() takes over the descriptor of its stdout, so the answers need a real file. - answers = tmp_path / "answers" - monkeypatch.setattr("sys.stdin", io.StringIO(lines)) - monkeypatch.setattr("sys.stdout", answers.open("w")) - monkeypatch.setenv(HOLDER_NONCE, ClaimId.mint()) - serve() - assert [FieldCodec.decode(HolderSeenProbe().answer_type(), - FieldCodec.decode(ProbeReply, FieldCodec.parse(line)).answer) - for line in answers.read_text().splitlines()] == list(holders) + # The probe is a family member only while this test runs, so later tests reading the + # installer's probes (OutgoingWire) never see it. + @dataclass(frozen=True) + class HolderSeenProbe(RuntimeProbe[str]): + def run(self) -> str: + return os.environ.get(HOLDER_NONCE, "") + + try: + holders = (ClaimId.mint(), ClaimId.mint(), "") + lines = "".join( + FieldCodec.compact(FieldCodec.encode(ProbeRequest(HolderSeenProbe(), holder))) + "\n" + for holder in holders + ) + # serve() takes over the descriptor of its stdout, so the answers need a real file. + answers = tmp_path / "answers" + monkeypatch.setattr("sys.stdin", io.StringIO(lines)) + monkeypatch.setattr("sys.stdout", answers.open("w")) + monkeypatch.setenv(HOLDER_NONCE, ClaimId.mint()) + serve() + assert [FieldCodec.decode(HolderSeenProbe().answer_type(), + FieldCodec.decode(ProbeReply, FieldCodec.parse(line)).answer) + for line in answers.read_text().splitlines()] == list(holders) + finally: + RuntimeProbe.__registry__.pop(HolderSeenProbe.declared_name) def test_a_raising_probe_ends_its_worker_and_refuses_with_its_traceback(): diff --git a/tests/test_repairs.py b/tests/test_repairs.py index 20e4b245ae..5c82693228 100644 --- a/tests/test_repairs.py +++ b/tests/test_repairs.py @@ -24,6 +24,7 @@ def tree(root: Path) -> Path: + (root / "pyproject.toml").write_text('[project.scripts]\nac = "agent_comms.cli:main"\n') for name, source in PACKAGE.items(): path = root / "src" / "agent_comms" / name path.parent.mkdir(parents=True, exist_ok=True)