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
11 changes: 1 addition & 10 deletions src/toad/conversation_turn.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ def session_state(self) -> str | None: ...
def accepts_update(self, update) -> bool:
return update.matches_turn(IdleTurn.reported_turn)

def matches_settlement(self, turn_id) -> bool:
return not turn_id

def captured_snapshot(self, widgets: tuple[Widget, ...]):
"""Each original claim owns capture while this source is active."""
from toad.widgets.committed_presentation import CommitParticipant
Expand Down Expand Up @@ -112,9 +109,6 @@ class AgentTurn(TurnOwner):
activity_state = ActivityState.WORKING
session_state = "busy"

def matches_settlement(self, turn_id) -> bool:
return self.managed_id == turn_id

def with_activity(self, activity: str) -> TurnOwner:
return replace(self, activity=activity or "Thinking…")

Expand Down Expand Up @@ -169,9 +163,6 @@ def session_state(self):
def accepts_update(self, update) -> bool:
return update.matches_turn(self.state.active.reported_turn)

def matches_settlement(self, turn_id):
return self.state.matches(turn_id)

def with_activity(self, activity: str):
# Text, tool and heartbeat rendering cannot change backend phase.
return self
Expand Down Expand Up @@ -268,7 +259,7 @@ def accepts(self, message):
return message.event.sequence == self.sequence

def receive(self, state: TurnState):
if not state.active.phase.busy and not state.matches(self.owner.managed_id):
if not state.settles(self.owner.state.active):
return False
owner = ManagedTurn(state)
if owner == self.owner:
Expand Down
5 changes: 3 additions & 2 deletions tests/support/peers/typed_turn_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from agent_comms.agent_event_updates import AcpEventConsumer
from agent_comms.controller import SessionUpdateSink
from agent_comms.coordinator import Coordination
from agent_comms.field_codec import TurnId
from turn_source import turn_source

SESSION = "pilot"
Expand All @@ -35,14 +36,14 @@ async def produce(wire_root: Path, project: Path):
name = producer.sessions.require(SESSION)
async with AsyncExitStack() as turns:
retired_owner = await Coordination.run_worker(partial(
producer.turns.acquire_turn, turns, SESSION, name, "retired-producer", "Authored protocol; no input"))
producer.turns.acquire_turn, turns, SESSION, name, TurnId("5e7a1d0c3b2f4e6a8c9d0b1a2f3e4d5c"), "Authored protocol; no input"))
retired_lease = retired_owner.turn_lease
retired = await Coordination.run_worker(partial(producer.turns.current_turn_update, SESSION))
producer.on_connect(Pipe())
consumer = AcpEventConsumer(producer, SESSION, producer._runtime)
async with AsyncExitStack() as turns:
await Coordination.run_worker(partial(
producer.turns.acquire_turn, turns, SESSION, name, "actual-producer", "Authored protocol; no input"))
producer.turns.acquire_turn, turns, SESSION, name, TurnId("a1c2e3f4b5d6e7f8091a2b3c4d5e6f70"), "Authored protocol; no input"))
await producer.turns.publish_turn_state(consumer)
await consumer.dispatch(agent_events.CompactionStart())
await consumer.dispatch(agent_events.CompactionEnd(
Expand Down
4 changes: 2 additions & 2 deletions tests/textual/test_compaction_turn_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ async def consume_until(member):
await consume_until(CompactionChangedUpdate)
assert "Compacting context" not in view.turns.owner.activity
stale = await consume_until(TurnChangedUpdate)
assert not stale.state.active.phase.busy and not stale.state.matches(turn_id)
assert not stale.state.settles(active.state.active)
assert agent.current_turn.managed_id == view.turns.managed_id == turn_id
terminal = await consume_until(TurnChangedUpdate)
assert not terminal.state.active.phase.busy and terminal.state.matches(turn_id)
assert not terminal.state.active.phase.busy and terminal.state.settles(active.state.active)
assert agent.current_turn.managed_id is view.turns.managed_id is None
assert not agent.current_turn.busy and not view.turns.owner.busy
await consume_until(GoalChangedUpdate)
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading