Skip to content

The heartbeat's mirror-rebuild verdict reaches no dashboard — a rebuild is fleet-visible but not human-visible, unlike its three sibling verdicts

Id: TD-PPagop-26082606 · Status: resolved · Filed: 2026-08-26 · Resolved: 2026-09-23 · Ref: https://github.com/Pullwright/agent-ops/pull/1796

Noticed while reviewing PR #817 (issue #604), which is where the mirror-rebuild verdict was added. Not a defect in that pull request: #604’s acceptance criterion 3 names the heartbeat as the channel and does not name the dashboard, and the heartbeat is exactly what shipped. This records the gap that scope leaves between “the fleet can see it” and “a human can see it”.

scripts/state-sync.sh’s push stamps heartbeat.json with a mirror field (lib/mirror-integrity.sh’s mirror_rebuild_verdict): null until this node has had to discard and rebuild its state-sync mirror, else {status: "rebuilt", count, last_rebuilt_at}. It sits alongside compose, image, switch and stage_health in the same object, and it replicates the same way — a peer’s fetch materialises the whole heartbeat, so the fact does reach every node in the fleet.

What it does not reach is the page anyone actually reads. Each of the other four verdicts is carried out of the heartbeat into data.js by scripts/publish-dashboard.sh — for this node at its --argjson block (scripts/publish-dashboard.sh:1024, :1766) and for a peer in the for hb in "$peers_dir"/*/heartbeat.json loop (:1789 for compose, :1806 for stage_health) — and rendered as a per-node badge by dashboard/index.html (switchBadge at :897, compose at :1185, image at :1217, stage health at :1351). mirror is carried by neither and rendered by neither.

So today a human learns their disk has been quietly damaging a mirror only by running jq over a file in the peers directory, having first thought to suspect it — which is close to the condition #604 was filed to end, where the damage was real for four days and nothing said so.

The count is the part with the most to say and the least chance of being read. A single rebuild is a transient worth shrugging at; count: 7 on one node is a failing disk, and distinguishing those two is the stated reason the verdict carries a count at all rather than a boolean. That distinction is only useful to whoever sees it, and the dashboard is where node facts get seen.

The same shape the other four verdicts already have, which is why this is small rather than novel:

  • scripts/publish-dashboard.sh: add mirror to the local node’s row (:1766) and to the peer row’s ($h.mirror // null) mapping (beside :1806), so a heartbeat built before this field existed yields null rather than an error.
  • dashboard/index.html: a badge on the node card, on compose’s precedent (:1185) — amber for a rebuild, with count and last_rebuilt_at in the title, and nothing at all when the verdict is null.
  • docs/DASHBOARD-SPEC.md: the node-card requirement that enumerates which verdicts a card shows.
  • test/publish-dashboard.test.sh and test/dashboard-render.test.sh, on the pattern the stage-health rows added in #774.

Worth doing together with TD-PPagop-26082605 if that one is picked up, since both end in the same two files and the same two tests.

Migrated to https://github.com/Poetic-Poems/agent-ops/issues/997.