docs/spec/dashboard/components.md
Components (as built)
Section titled “Components (as built)”scripts/publish-dashboard.sh— the Publisher.DASHBOARD_GH_CMDnames theghit calls, and is exported soscripts/gather-findings.shresolves the same one; it exists for the test suite, which must reach no network and cannot shadow a binary by PATH (the Publisher hardens PATH for cron, and itsghruns undertimeout, which no exported shell function is visible to). Unset in production, where it is exactlygh.DASHBOARD_TODAYis a narrower seam over the sametodaythe cost roll-ups use to computespend_today_usd: it lets the test suite pin which UTC day counts as “today” without pinning every other window--nowcontrols (below), and only when--nowis absent —--nowtakes precedence over it when both are set. Unset in production, where “today” is the real UTC day. Not exported: this script is the only reader.lib/version.sh— what code this node is running: the image’s CI stamp (build-info.json) if there is one, else gitHEAD, else nothing. Shared withscripts/state-sync.sh, which publishes the answer in every heartbeat.lib/image-drift.sh— whether that code is the registry’s newest published commit (#155):image_drift_statusreadsghcr.io/pullwright/agent-ops :latest’sorg.opencontainers.image.revision/.createdlabels anonymously over the OCI Distribution API and compares againstlib/version.sh’s answer. Backed by a cache file (<state_dir>/.image-drift-cache.json,IMAGE_DRIFT_TTLseconds, 240 default) that this script andscripts/state-sync.shname identically, since unlikelib/version.shandlib/compose-drift.sha real network round trip sits behind it — one this Publisher’s 5-second tick cannot pay on every run.IMAGE_DRIFT_CURL_CMDis the test seam, followingDASHBOARD_GH_CMD.scripts/doctor.sh --unattended(agent-ops#543,docs/spec/implementation/requirementsrequirement 2.6a) — not read live by this Publisher, unlikelib/compose-drift.sh/lib/image-drift.shabove: its GitHub section costs several calls per configured repository, too much for a 5-minute heartbeat, so it runs on its own hourlycrontab.tmplline instead and writes<state_dir>/.doctor-status.json({timestamp, verdict, fails[], warns[], skips}). This Publisher reads that file verbatim intostatus.doctor;nulluntil the first hourly pass has run. The raw file itself stays local — nothing replicates it to peers — but its ownverdictnow does, folded into the heartbeat’sdoctorfield (agent-ops#1278) the same waystage_health’s does below, forlib/pager.sh’sverdict-unanimousinvariant to read fleet-wide.lib/stage-health.sh(agent-ops#662,docs/spec/implementation/requirementsrequirement 2.8) — not read live by this Publisher either, ondoctor.sh --unattended’s own precedent just above, even though (unlike doctor’s GitHub section) recomputing it here would cost no network call:agent-cycle.sh’s owncleanup()already computes and merges<state_dir>/.stage-health.json({computed_at, threshold, idle_after_hours, stages}) at the end of every cycle — andmonitor-cycle.shmerges its ownmonitorstage into the same file at the end of every monitor run that engaged its stage — so reading it keeps this Publisher and the fleet heartbeat (scripts/state-sync.sh, below) reading the identical file rather than two computations that could disagree. This Publisher reads it verbatim intostatus.stage_health;nulluntil this node’s first cycle since this check shipped has completed. Unlike.doctor-status.json, its content does reach peers — folded into the heartbeat’s ownstage_healthfield, the same waycompose/image/switchalready travel — even though the raw file itself is excluded fromscripts/state-sync.sh’s general replication, since a peer’s copy of the raw file would answer for a computation nobody there ran.lib/pager.shandlib/pager-invariants.sh(agent-ops#1278,docs/spec/implementation/requirementsrequirement 51) — unlike every component above, not a read:pager_evaluate, called from this Publisher’s ownWITH_GITHUBblock, is the one place this script writes — apager-*transition event to this node’s ownlog.jsonl, and possibly a created or closed GitHub issue.PAGER_GH/CLAIM_GHare set toDASHBOARD_GH_CMDbefore the call, so the test suite’sghstub covers pager’s own GitHub calls on the same terms as every other one this script makes.scripts/publish-revert-rate.sh(D18 issue #579,docs/spec/implementation/requirementsrequirement 2.6b) — not read live by this Publisher either, on the identical reasoning asdoctor.sh --unattendedabove: it shells out toscripts/mine-merge-history.sh(several GitHub calls per bounded window per repository), too much for a 5-minute heartbeat, so it runs on its own dailycrontab.tmplline and appends to<state_dir>/revert-rate.jsonlinstead — fleet-wide data, unlike.doctor-status.json, so this Publisher reads it through the same unionfleet_logsgiveslog.jsonl, not verbatim off this node’s own file.scripts/publish-dashboard-launcher.sh— the sub-minute heartbeat driver (cron runs it every 5 min; it self-loops on 5-second boundaries).dashboard/index.html— the page (committed source; copied beside the generateddata.jsat publish time).scripts/open-dashboard.sh— regenerate + open in the browser.scripts/serve-dashboard.sh— optional loopback-only server (file://fallback). It writes no log of its own: whatever supervises it captures its output — a container runtime keeps it in the service’s logs, and on the legacy WSL path the init script redirects it (below). The page must answer on the host’s loopback and on no network — that is the requirement, and it is a requirement rather than an accident. Where the server runs on the host, loopback is where it binds, which is the default and what a bare invocation gets. The bind address is nonetheless a setting (serve-dashboard.sh [port] [bind-address]), because inside a container the literal bind and the guarantee come apart: a server on the container’s own loopback is reachable from nothing at all, so each profile indeploy/docker/compose.yamlhas to arrange the host’s loopback its own way. Thetailnetprofile puts the server in the Tailscale sidecar’s network namespace, unchanged on127.0.0.1, so Serve can proxy to its loopback (ts-serve.json, no Funnel). Thelocalprofile binds0.0.0.0inside the container and publishes127.0.0.1:${DASHBOARD_PORT:-8787}:8787, so the only route in is the host’s loopback — the container’s own addresses being on Docker’s private bridge, which no one is on. Both land in the same place; neither widens what can reach the page.deploy/agent-ops-dashboard.init(the legacy WSL SysV path) sends the server’s output to<state_dir>/dashboard-server.log, so every artefact the dashboard produces lands understate_dirand nothing is written beside the checkout.RUNASandAPPDIRcarry no default and must be set in/etc/default/agent-ops-dashboardbefore the script will start; its remaining settings (RUNHOME,PORT,PIDFILE,LOGFILE) are defaults overridable from the same file, so a host that differs needs no edit to the installed script beyond the two required settings.- The version stamp:
ARGs and thebuild-info.jsonwrite at the foot ofdeploy/docker/Dockerfile, and the “Work out the version stamp” step of.github/workflows/build-image.ymlthat supplies them (with a check that the built image reads its own stamp back — the failure mode is otherwise silent). - The cleanup hook in
agent-cycle.sh;.gitignoreand.dockerignoreentries fordashboard/data.js,dashboard/stamp.jsandbuild-info.json; the README “Monitoring” section’s “Dashboard” subsection.