GeezerVison is showing github.com — laptop-backups: durable run record for pm-dashboard-backup + a freshness watchdog that names a stopped backup (design #1024, phase 3) · Issue #1841 · developing-today/code
laptop-backups: durable run record for pm-dashboard-backup + a freshness watchdog that names a stopped backup (design #1024, phase 3) #1841DescriptionRelocated from dezren39/darwin-nix#1026 on 2026-10-28 (placement audit): laptop-backups run-record/watchdog — the implementation is the code-side port (backup modules relocated to code via code PR #1740 / nix PR #1043; implementation branch queue/1914-1026-run-record-watchdog). Original body below; issue references inside it are historical (dezren39/nix numbering).
Problem
The two jobs declared in modules/laptop-backups.nix — pm-dashboard-backup (daily 04:30) and repo-archive-backup (daily 05:15) — leave no durable, machine-readable record of their runs. A run's only traces are its journal lines and pm-dashboard-backup's .last-run-epoch, which records the journal window, not run health. #976 verified on 2026-10-27 that neither timer had ever fired, and its acceptance asks for "a freshness check exists so a stopped backup gets named" — there is still no artefact such a check could read, so a backup that stops (timer broken, script failing nightly, laptop job silently exiting 0 per #1021/#1023's class) is discovered at restore time.
Part of design #1024 ("a backup that can prove itself"), phase 3. Parent coverage issue: #976.
Scope
modules/pm-dashboard-backup.sh: on every exit path (complete and failed), write one JSON run record at a fixed path beside .last-run-epoch (e.g. $ROOT/.last-run.json — at the backup root, never inside a dated day dir, so no retention prune can remove it; local prune iterates only 20??-??-?? dirs). Fields: job name, date argument, start/finish timestamps, result (complete / failed), the failing step(s) when failed, archive sha256 when built, and per-destination (local / R2 / Drive) results.
modules/laptop-backups.nix: a laptop-backups-watchdog systemd user service + timer (runs a few times a day) that checks (a) the dashboard run record — last result is complete and its finish time is within the threshold — and (b) both backup timers' last-trigger times against the same threshold. On any violation it exits non-zero with a line naming the job and the age/result. The threshold is a module option (services.laptop-backups.watchdog.maxAgeHours or similar), default a little over one daily period (26h). The watchdog changes nothing and attempts no repair.
- The repo-archive job is covered via its timer's last-trigger time only: its script (
~/tools/repo-archive-backup.sh) and restic credentials live outside this repo, so no run record is required of it in this issue — that limitation is stated in the module comment.
Acceptance criteria
- A complete pm-dashboard-backup run leaves
.last-run.json (or the chosen fixed path) with result: complete, the archive sha256, and all three destination results.
- A failed run (e.g. stubbed rclone upload failure in the harness) leaves a record with
result: failed and the failing step named — the record is written on the failure path too.
- With a stale or failed dashboard record, the watchdog exits non-zero naming
pm-dashboard-backup and the age; with a fresh complete record and recently-fired timers, it exits 0.
- With a backup timer whose last trigger exceeds the threshold, the watchdog exits non-zero naming that timer/job.
- Test coverage in the repo's established style: a watchdog test suite (stubbed record files + timestamps) wired as a flake check, plus a pm-dashboard-backup suite scenario asserting the record's contents on success and on failure.
- Existing behaviour unchanged: schedule, retention, destinations, cursor semantics; the watchdog is additive and read-only.
🤖 Agent note · state: filed
Activitydeveloping-today commented on Oct 28, 2026 dezren39 commented on Oct 28, 2026 History carried over from dezren39/darwin-nix#1026 (verbatim, oldest first):
@dezren39 · 2026-10-28T14:50:55Z
🤖 Agent note · triage confirmed
- Agent: repo-worker-nix (lane A)
- Session / ID: task 1889, repo-queue-worker-shift-nix run 2026-10-28 09:47 CDT
- Verdict: CONFIRMED on current main
2aebfa908c8ecde88b5f17bec9446156693aedb2 — neither job writes a run record, no watchdog exists, exactly as filed.
- Evidence:
modules/laptop-backups.nix verified directly on current main this run: exactly two services+timers (pm-dashboard-backup 04:30, repo-archive-backup 05:15), no watchdog unit/timer, no OnFailure, no threshold option. modules/pm-dashboard-backup.sh (268 lines): the only durable outputs are the archive, its manifest, and .last-run-epoch (MARKER at :33, written at :266 as the journal-window cursor only after all legs succeed) — no .last-run.json or equivalent anywhere in the script.
- Design pins for the fix: (1) the record hook already exists — the single EXIT trap
on_exit (:47-52) sees every exit path; extend it rather than adding a second trap (bash traps replace, not stack — the opencode: pool effort remap — wired rungs, capability order, meta refresh #1010 lesson documented at :40-45). (2) $ROOT/.last-run.json is prune-safe, verified: local prune iterates only $ROOT/20??-??-?? (:227-232) and prune_remote purges only dated dirs matching ^20[0-9]{2}- (:240-250). (3) Test style exists to extend: pm-dashboard-backup.test.sh / -prune / -date suites are wired as flake checks in flake.nix. (4) fix(cold-store-reaper): curl fallback for S3 downloads urllib cannot deliver #976's 2026-10-28 update says both timers have now fired for the first time with Result=success, so the watchdog's timer check has real LastTrigger data to read.
- Routing: follow-up fix enqueued as task 1914 (
repo-health:v1:fix:dezren39/nix:issue:1026, kind small_fix) — run record on every exit path, watchdog service+timer with services.laptop-backups.watchdog.maxAgeHours (default 26), watchdog suite + record scenario wired as flake checks. Sequencing: PR OpenClaw: connect chat channels (Slack, Telegram, WhatsApp) #1029 (opencode: pool pass 2 — contributor seats, variant remaps, speed pool #1023), PR id(web): adjacent bullet lists with different markers accumulate '<!-- end list -->' comments and html fences on every save — non-fixpoint, grows per save #1032 (fix(id-web): degrade unsupported table-cell content instead of panicking on save (#1017) #1021), and the feat(home): install OpenClaw gateway via nix-openclaw #1025 fix (task 1895) all touch pm-dashboard-backup.sh and land first — semantically phase 3 is independent of phase 2 per this issue, the sequencing is only to avoid same-file conflicts.
- Links: design design(backups): a backup that can prove itself — an expected-set completion contract for the laptop backup jobs (#976) dezren39/darwin-nix#1024 · issue laptop-backups: durable run record for pm-dashboard-backup + a freshness watchdog that names a stopped backup (design #1024, phase 3) dezren39/darwin-nix#1026 · parent laptop non-git data has no routine backup — restic covers only ~/repo-archive and its timer has never fired dezren39/darwin-nix#976
@dezren39 · 2026-10-28T14:52:16Z
🤖 Agent note · parked on sequencing
- Agent: repo-worker-nix (lane A)
- Session / ID: task 1914, repo-queue-worker-shift-nix run 2026-10-28 09:47 CDT
- State: PARKED 1h — sequencing gate not met. PR OpenClaw: connect chat channels (Slack, Telegram, WhatsApp) #1029 (opencode: pool pass 2 — contributor seats, variant remaps, speed pool #1023) and PR id(web): adjacent bullet lists with different markers accumulate '<!-- end list -->' comments and html fences on every save — non-fixpoint, grows per save #1032 (fix(id-web): degrade unsupported table-cell content instead of panicking on save (#1017) #1021) are both still OPEN (fresh check this run), and the feat(home): install OpenClaw gateway via nix-openclaw #1025 fix (task 1895) is itself parked behind opencode: pool pass 2 — contributor seats, variant remaps, speed pool #1023. All three touch
modules/pm-dashboard-backup.sh; this fix starts from a main that includes them.
- Resume: when PR OpenClaw: connect chat channels (Slack, Telegram, WhatsApp) #1029 and PR id(web): adjacent bullet lists with different markers accumulate '<!-- end list -->' comments and html fences on every save — non-fixpoint, grows per save #1032 have merged and task 1895 (feat(home): install OpenClaw gateway via nix-openclaw #1025) has landed, claim task 1914 and implement per its packet: run record at
$ROOT/.last-run.json via the existing EXIT trap, laptop-backups-watchdog service+timer with maxAgeHours default 26, suites wired as flake checks, validation on the laptop.
- Triage: task 1889 CONFIRMED this issue on main
2aebfa9 — see the triage verdict comment above.
@dezren39 · 2026-10-28T16:40:44Z
🤖 Agent note · state: parked (CI pending)
- Agent: repo-queue-worker-shift-nix lane A
- Task: task 1914
- Did: Sequencing gate cleared this shift (PR OpenClaw: connect chat channels (Slack, Telegram, WhatsApp) #1029, PR id(web): adjacent bullet lists with different markers accumulate '<!-- end list -->' comments and html fences on every save — non-fixpoint, grows per save #1032, PR fix(id-web): carry tight on task_list so loose task items stop fusing on save (#1036) #1041's predecessor PR 🎨 Palette: Enhance accessibility and keyboard navigation in image browser dialog #1039 all merged — 🎨 Palette: Enhance accessibility and keyboard navigation in image browser dialog #1039 at 2026-10-28T16:25:17Z, CI green). Implemented phase 3 on laptop branch
queue/1914-1026-run-record-watchdog: .last-run.json run record via the existing EXIT trap (suppressed until DATE validation passes, per Fix /today 500: tolerate string-shaped progressedSinceLastRun #989; SKIP leaves no record), the laptop-backups-watchdog script + service/timer with services.laptop-backups.watchdog.maxAgeHours (default 26), and record + watchdog test suites wired as flake checks. All pre-existing pm suites pass and all 7 related flake checks pass on the laptop; module evaluated via a scratch home-manager config.
- Outcome: PR fix(id-web): carry tight on task_list so loose task items stop fusing on save (#1036) #1041 opened — feat(laptop-backups): pm-dashboard-backup run record (.last-run.json) + freshness watchdog (#1026) dezren39/darwin-nix#1041 (CI
nix build queued at park time)
- Resume: when PR fix(id-web): carry tight on task_list so loose task items stop fusing on save (#1036) #1041's CI is green, merge it, verify this issue closes, then complete task 1914.
@dezren39 · 2026-10-28T17:37:15Z
🤖 Agent note · blocked — target moved out of this repo
dezren39 commented on Oct 31, 2026 dezren39 commented on Oct 31, 2026 🤖 Agent note · done
- Agent: queue worker (repo-worker-code), lane B
- Session / ID: queue task 3057, lane B shift 2026-10-31 06:44 CDT
- Found via: queue claim (resume from park)
- Task: PR 2989 merged — laptop-backups run record (.last-run.json on every exit path) + freshness watchdog (service/timer, maxAgeHours default 26), ported from dezren39/nix branch queue/1914-1026-run-record-watchdog @ 55c636f, superseding nix task 1914.
- Expectation: met — CI green (mcpx-docs build pass on head 0fd4f55), Codex clean on current head with 0 unresolved threads (all prior Codex/CodeRabbit findings dispositioned in-thread), merge commit 661582d.
- Links: PR nixos/home: laptop-backups run record + freshness watchdog (#1841) #2989 (merged)
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|