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
6 changes: 5 additions & 1 deletion src/toad/screens/commander.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from __future__ import annotations

import time

from agent_comms.commander_hud import (
BoardRow, CommanderHud, CommanderUnit, HudRow, QuietUnits,
)
Expand Down Expand Up @@ -204,7 +206,9 @@ def reconcile_units(self) -> None:
def present(self, hud: CommanderHud) -> None:
self.hud = hud
self.heading.update(f"Commander {hud.commander.name}")
self.status.update("\n".join(hud.header))
self.status.update("\n".join((
str(hud.load), *hud.heartbeat.aged_line("heartbeat", time.time()),
)))
self.footer.update("\n".join(
line for row in hud.rows() for line in self.row_text.lines(row)
))
Expand Down
24 changes: 5 additions & 19 deletions tests/textual/test_commander_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
CommanderFrame, CommanderHud, CommanderUnit, CodexUsage, UnreadableUsage,
)
from agent_comms.thread_identity import RecordedThreadIncarnation
from agent_comms.service_passes import ServicePassStore
from agent_comms.ui_model.observation import ObserveCommanderHud
from agent_comms.ui_model.unit_state import Detached, PendingClock
from textual.widgets import Static
Expand All @@ -25,10 +24,10 @@ async def test_commander_page_survives_unreadable_frames_and_recovers(workspace)
PendingClock(1.0, 1.0), (), 1, (), (),
)
hud = CommanderHud(
commander=RecordedThreadIncarnation("claude-code", 1.0), units=(unit,), phases=(),
load=OverloadDegradation.from_orders((), 0, 0),
forks=(RecordedThreadIncarnation("fork-hud", 2.0),),
usage=CodexUsage(UnreadableUsage(reason="not requested")),
RecordedThreadIncarnation("claude-code", 1.0), (unit,), (),
OverloadDegradation.from_orders((), 0, 0),
(RecordedThreadIncarnation("fork-hud", 2.0),),
CodexUsage(UnreadableUsage(reason="not requested")),
)
CommanderFrame.replace_all(workspace.comms.root, (hud,))
frame, = CommanderFrame.matching_in(workspace.comms.root)
Expand Down Expand Up @@ -67,20 +66,7 @@ async def test_commander_page_survives_unreadable_frames_and_recovers(workspace)
# refusal must stay in the disclosure while observation keeps working.
await ui.until_shows("Original details unavailable:")
assert str(view.heading.render()) == "Commander claude-code"
assert str(view.status.render()) == '\n'.join(view.hud.header)
retained_frame = frame.read_bytes()
services = ServicePassStore.at(workspace.comms.root)
services.failed('CommanderHeartbeat', KeyError('retained-ui failure'))
await ui.until_shows('retained-ui failure')
assert 'retained-ui failure' in str(view.status.render()).splitlines()[0]
assert 'elapsed' in str(view.status.render()).splitlines()[0]
assert 'STALE retained' in str(view.status.render())
assert frame.read_bytes() == retained_frame
services.passed('CommanderHeartbeat')
await ui.until(lambda: 'retained-ui failure' not in str(view.status.render()),
why='service-only recovery to update the open frame')
assert rows.query_one(CommanderFrameView) is view
assert not card.collapsed and title.has_focus
assert str(view.status.render()).startswith(str(hud.load))
assert hud.usage.line() in str(view.footer.render())
assert "forks: fork-hud" in str(view.footer.render())

Expand Down
Loading