Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/test_codex_earlier_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
14 changes: 8 additions & 6 deletions tests/test_codex_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions tests/test_native_unknown_recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/test_outbound_transcript_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading