Repository navigation
feat(bin): add a live, self-refreshing bearings fleet board - #54
Merged
Merged
Conversation
added 3 commits
September 30, 2026 09:37
The /bearings lavish board could only change when firstmate rebuilt it, so it went stale between builds. Add a deterministic refresh that keeps it current every minute or two with no model call. - bin/fm-bearings-board.sh refresh composes a fresh payload from the bearings snapshot and quota readers and replaces only a sibling data file; it never rewrites the page, touches the Lavish session, or binds and arms anything. It is off unless config/live-board says "on", skips until a board has been built, and steps aside during away mode. - build now also writes that data file and a private store of the Captain's Call cards firstmate composed; refresh reuses a stored card while its call stays open and shows a new hold as a clearly marked raw card that lifts the hold instead of closing the task. - The board page re-reads the data file every 30 seconds and re-renders in place, keeping by key every card the captain is using (option picked, words typed, focus, or answer queued), keeping dispatch picks that still apply, and flagging live data older than six minutes. It adds worker ages and an open pull request list. - systemd-units prints or writes a user timer for the refresh; loop covers other supervisors. Docs cover setup, limits, and optional Tailscale Serve exposure; a verification record captures the Lavish reload and queue behavior the design relies on.
Away mode is exactly when the captain watches the live board from elsewhere, but refresh stepped aside because the bearings snapshot refuses reads while the away-mode return guard is up. Add fm-bearings-snapshot.sh --unattended, which skips that guard, and have the live board refresh use it. The refresh is read-only and model-free and no captain request proceeds through it; every /bearings request still honors the guard. Tests cover the refresh during away mode and during the return catch-up, and the unattended read behind a pending return gate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Captain request (firstmate shared tracked material): a LIVE interactive fleet board that regenerates itself every 60-120s without firstmate's LLM, showing workers and their current state/age, open PRs/MRs, captain decisions (same interactive answer channel and keyed-answer intake as today's /bearings lavish board: bin/fm-captain-hold.sh binding, procevent lavish source), queued work, and quotas. The captain said on 30/09 the board must stay interactive and refresh every 1-2 minutes.
Design constraints from the brief: (1) regeneration is a deterministic script (no model call) run by a user-level systemd timer or an equivalent supervised loop documented in docs; (2) the page auto-refreshes but must NEVER lose an answer the captain is typing or has submitted but not yet delivered (preserve form state across refresh, or refresh data via fetch instead of full reload); (3) decision cards require composed captain-facing text: reuse the latest firstmate-composed card text when available (persist composed cards in a private data file that firstmate updates when it builds the board) and fall back to the raw hold reason for new holds, clearly marked; (4) merge cards keep the existing merge-click ruling guards; (5) optional Tailscale exposure documented but off by default; (6) off by default, enabled by a config flag documented in docs/configuration.md. Tests colocated, docs updated.
Later firstmate requirement (supersedes the earlier "refresh steps aside during away mode" behavior): the live board must keep refreshing during away mode - that is exactly when the captain watches it from outside. The refresh path bypasses the bearings snapshot's afk guard because it is read-only and model-free, with a test. Implemented as fm-bearings-snapshot.sh --unattended (skips the fm-afk-return.sh guard for both away mode and the return catch-up; only the live refresh uses it, every /bearings captain request still honors the guard; the existing incident regression that plain Bearings refuses behind the return gate is kept and extended).
Implementation decisions: bin/fm-bearings-board.sh gains
refresh(deterministic, off unless config/live-board's first non-blank line is exactly "on"; skips with askipped:line and exit 0 when off or when no board has been built yet),loop [--interval]for non-systemd supervisors, andsystemd-units [--interval] [--dir]that prints/writes a home-scoped user service+timer (default 90s, minimum 30s, values escaped and quoted). refresh reads the snapshot uncapped for decisions, in-flight tasks and recorded PRs (gates stay capped with charted_more). refresh never rewrites the board page, never calls lavish-axi, and never binds or arms anything: it only atomically replaces a sibling data file .lavish/bearings-board.data.js (a script calling window.fmBearingsBoardData(payload)). This was chosen over fetch because the Lavish artifact iframe is sandboxed without allow-same-origin and asset responses carry no CORS header, and it was empirically verified (docs/verification/live-board.md) that Lavish 0.1.53 hot-reloads only on a change to the page file itself; queued answers live in the Lavish chrome's sessionStorage, outside the iframe. build additionally writes the same data file and replaces the private composed-card store data/bearings-board-cards.json (fm-bearings-board-cards.v1, mode 0600, raw cards excluded). Composition: stored composed card kept while its key is still an open captain hold (merge. cards while that task is in flight with a recorded PR); malformed stored cards are filtered out individually; a new hold becomes a raw card (raw: true, badge "raw hold reason", options [], free text only, close "release" because a raw card cannot tell a question from held work - firstmate finishes the call at wake time, documented in the bearings skill). Underway = every in-flight task plus active secondmates withsincefrom status-log mtime; prs = locally recorded PRs with last reported state (no network call, deliberately); charted dispatchable only when no blocker and no gate reason. Payload schema stays fm-bearings-board.v1 with optional fields source, since, raw, prs; validation defs are shared between build and refresh. The template's renderer is re-runnable: every 30s the page reloads the data script, and Captain's Call cards are reconciled by key - a card in use (option picked, text typed, focus inside, answer queued) is never rebuilt and shows a note when newer text waits; a call that left the fleet keeps its card only while it holds unsent words; dispatch picks survive while their rows remain; live data older than six minutes is flagged. Docs: docs/configuration.md "Live fleet board" section with Tailscale Serve (never funnel) instructions, AGENTS.md layout lines, docs/scripts.md, new verification record registered in docs/documentation-audiences.json. Tests extend tests/fm-bearings-board.test.sh, its DOM harness, and tests/fm-afk-return.test.sh.What Changed
bin/fm-bearings-board.shgainsrefresh,loop [--interval]andsystemd-units.refreshis deterministic and makes no model call. It is off unlessconfig/live-boardsayson. Each run atomically rewrites only the.lavish/bearings-board.data.jsdata file. It never rewrites the board page, never calls lavish-axi and never binds anything.systemd-unitsprints or writes a user service and timer; the default interval is 90s and the minimum is 30s.buildalso writes the data file and the private composed-card storedata/bearings-board-cards.json(mode 0600). A stored composed card is reused while its hold is still open. A new hold falls back to a card marked "raw hold reason". The payload now also carries in-flight work with its age, recorded PRs and dispatchable queued work. Decisions, in-flight tasks and PRs are read uncapped.bin/fm-bearings-snapshot.shgets an--unattendedflag that skips thefm-afk-return.shguard. Only the live refresh uses it, so the board keeps updating during away mode. Every/bearingsrequest still honors the guard.docs/configuration.mdhas a new "Live fleet board" section that covers optional Tailscale Serve exposure, off by default.AGENTS.md,docs/scripts.mdand the bearings skill are updated, and a newdocs/verification/live-board.mdrecord is registered indocs/documentation-audiences.json.tests/fm-bearings-board.test.shand its DOM harness, and intests/fm-afk-return.test.sh.Risk Assessment
✅ Low: The latest change is small and does what the intent asks. Only the live refresh passes --unattended to skip the afk guard, and plain /bearings still honors it. The downstream fleet snapshot and quota readers have no second guard that would block the refresh. Findings from the earlier review rounds were already dealt with.
Testing
I ran the three targeted test files: the bearings board suite (with its DOM harness), the afk-return suite and the snapshot suite. All passed. For visual evidence I built a board, turned the live board on, ran
refresh, and rendered the resulting page in headless Chrome. The screenshot shows the header "live · updated just now". It shows a composed decision card among three Captain's Call cards, and Underway items with their ages. It also shows an Open Pull Requests section with each worker's last reported state, Charted Next with its dispatch bar and "+3 more", the quota panel, and a "live-refresh" source footer. That source footer shows the data came from the refreshed data file, not a rebuilt page. The worktree was left clean.Evidence: Built board page and refreshed data file
Source: Built board page and refreshed data file
Evidence: Board test transcript
Source: Board test transcript
Evidence: AFK return test transcript
Source: AFK return test transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-bearings-board.test.shcovers: refresh gating (off unless the config line is exactly on, skips when no board is built), refresh during away mode, the live data file and private card store, composed vs raw cards, uncapped holds and in-flight tasks, systemd unit escaping, and DOM live-update preservation of unsent, queued and dispatch-pick answersbash tests/fm-afk-return.test.sh(--unattended bypass, and plain bearings still refused behind the return gate)bash tests/fm-bearings-snapshot.test.shManual: ran test_refresh_composes_a_live_payload_without_touching_the_page alone via a temporary copy of the test script (since removed), kept its build+refresh .lavish output, and rendered bearings-board.html with headless google-chrome to a screenshot✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.