From a47329427dc6f9c6a0fa5f0669dc04534eab6d51 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Sat, 28 Nov 2026 12:50:03 -0500 Subject: [PATCH] Fix stale WATCH_LINE, NativePiUnavailable, and ItemStream.receive test usages --- tests/test_codex_earlier_pages.py | 5 ++++- tests/test_codex_items.py | 14 ++++++++------ tests/test_native_unknown_recovery.py | 5 +++-- tests/test_outbound_transcript_source.py | 3 ++- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/tests/test_codex_earlier_pages.py b/tests/test_codex_earlier_pages.py index a7cf026999..f571a8ff72 100644 --- a/tests/test_codex_earlier_pages.py +++ b/tests/test_codex_earlier_pages.py @@ -6,7 +6,8 @@ import pytest from aiohttp import web -from agent_comms.cli_bridges.cli_protocol import WATCH_LINE +from agent_comms.cli_bridges.cli_protocol import WatchLine +from agent_comms.cli_bridges.wire_models import WireModel from agent_comms.cli_bridges.codex import CodexBridge, CodexOptions from agent_comms.cli_bridges.codex_protocol import BusClientId, BusInput, ItemsPage from agent_comms.cli_bridges.delivery_outcome import AcceptedOutcome @@ -18,6 +19,8 @@ from agent_comms.messaging.messages import InfoKind, Message from agent_comms.nominal.field_codec import MessageId from agent_comms.projects.checkouts import Checkout + +WATCH_LINE = WireModel.adapter(WatchLine.declared_union()) from agent_comms.registry.threads import ExternalThread, NativeThread from agent_comms.transcript.external_transcript_rows import EarlierPage, ExternalItemRow from conftest import installed_comms diff --git a/tests/test_codex_items.py b/tests/test_codex_items.py index 1867c6b681..f8097eaf4b 100644 --- a/tests/test_codex_items.py +++ b/tests/test_codex_items.py @@ -100,8 +100,8 @@ def test_codex_stream_reports_activity_and_finishes_items(tmp_path): command = {"type": "commandExecution", "id": "c1", "command": "ls -la", "status": "inProgress"} def receive(method, **params): - updates = stream.receive(RpcNotification(method=method, params={"threadId": "th", **params})) - parts = tuple(part for update in updates for part in update.accumulate(output)) + update = stream.receive(RpcNotification(method=method, params={"threadId": "th", **params})) + parts = () if update is None else update.accumulate(output) return parts[0] if parts else None assert receive("turn/started", turn={"id": "t1"}) == TurnStarted() @@ -158,9 +158,9 @@ def test_deltas_require_start_and_finish_retires_the_assembly(tmp_path): output = _output(tmp_path) def receive(method, **params): - updates = stream.receive(RpcNotification(method=method, params={"threadId": "th", "turnId": "t", **params})) + update = stream.receive(RpcNotification(method=method, params={"threadId": "th", "turnId": "t", **params})) pending = [] - for update in updates: + if update is not None: update.accumulate_into(output, pending) return pending[-1] if pending else None @@ -238,13 +238,15 @@ def test_function_outputs_keep_wire_fields_and_source_clocks_in_page_and_live_de stream = ItemStream("thread") output = _output(tmp_path / name) - started, = stream.receive(RpcNotification(method="item/started", params={ + started = stream.receive(RpcNotification(method="item/started", params={ "threadId": "thread", "turnId": "turn", "startedAtMs": 1000, "item": payload, })) + assert started is not None started.accumulate(output) - complete, = stream.receive(RpcNotification(method="item/completed", params={ + complete = stream.receive(RpcNotification(method="item/completed", params={ "threadId": "thread", "turnId": "turn", "completedAtMs": 2000, "item": payload, })) + assert complete is not None finished, = complete.accumulate(output) assert finished.events == (() if item_type is SendOutputItem else ( ToolEndTranscript(position=NativeItemId("out"), tool_call_id="out", tool_name=name, diff --git a/tests/test_native_unknown_recovery.py b/tests/test_native_unknown_recovery.py index 561915a9ee..347854c9dd 100644 --- a/tests/test_native_unknown_recovery.py +++ b/tests/test_native_unknown_recovery.py @@ -14,7 +14,8 @@ import pytest from agent_comms.cli_runtime import CliInvocation -from agent_comms.cli_bridges.cli_protocol import WATCH_LINE, CoreError +from agent_comms.cli_bridges.cli_protocol import CoreError, WatchLine +from agent_comms.cli_bridges.wire_models import WireModel from agent_comms.comms import wire from agent_comms.coordination.attempt_recovery import RecoveryMonitorCapability, VerifiedOwnerLoss from agent_comms.coordination.coordinator import Coordination @@ -246,7 +247,7 @@ def test_recover_owner_refuses_a_conflicting_input_identity(released_starting, c with pytest.raises(RecoveryBlocked) as blocked: RecoveryMonitorCapability.recover_owners(wire(released_starting).owners, (owner,)) assert CliInvocation().invoke(["--root", str(released_starting), "start", "--name", "beta"], sys.stdout) == 1 - assert WATCH_LINE.validate_json(capsys.readouterr().out) == CoreError.from_exception(blocked.value) + assert WireModel.adapter(WatchLine.declared_union()).validate_json(capsys.readouterr().out) == CoreError.from_exception(blocked.value) with Coordination(released_starting / "coordination.sqlite3") as store: assert store.get(execution_id) == before assert input_evidence(store) == inputs diff --git a/tests/test_outbound_transcript_source.py b/tests/test_outbound_transcript_source.py index 3c516ff8cf..79158f83e7 100644 --- a/tests/test_outbound_transcript_source.py +++ b/tests/test_outbound_transcript_source.py @@ -16,8 +16,9 @@ ) from agent_comms.coordination.tables.assignments import WakeAssignment from agent_comms.errors import RelationViolationError +from agent_comms.execution.native_failures import NativePiUnavailable from agent_comms.execution.native_runtime_input import NativeRuntimeTable -from agent_comms.execution.transcript_sources import AssignedTranscriptSource, EarlierThan, NativePiUnavailable +from agent_comms.execution.transcript_sources import AssignedTranscriptSource, EarlierThan from agent_comms.messaging.channel_targets import CommandTarget from agent_comms.messaging.channels import AnyChannel from agent_comms.messaging.messages import Message