hub (unreleased): four silent failures tell the operator (R-1383, D78)
gates / gates (push) Successful in 2m9s

A hub daily check skipped while the hub was down; an operator mail that was never sent; a signed job a box did not
take; a signed job a box refused, and the guest-power watchdog's give-up (both from the agent). Operator-only.
No new table. Not deployed.

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-11-14 17:29:53 +01:00
1 parent 88e636445a
commit 1886030782
22 files changed
+1269 -2

No files matched your search

@@ -645,6 +645,24 @@ never „now + 24 h", and the slot that ran last never runs again. On a 25-hour
arithmetic ran every job after 02:00 twice; on a 23-hour day it ran them an hour late. Pinned by `TestR1183_*` for
2026-10-25 and 2027-03-28.
### 16.6 A job that does not run, gives up, or loses its state at a restart tells the operator [FACT — built, not released: hub `main` after v0.181.0 and agent `main` after 0.174.0, 2026-11-14; D78, `09` §3 decision 299, R-1383]
Four cases, the four the ruling names. Each leaves an event row and mails the operator only
(`notify.operatorOnlyEvents`). None needs a new table: the state is the hub's time-by-key settings
(`OSAlarmRaised`), the notification log and the signed-job queue.
| Case | Who sees it | How | Event | What it does NOT do |
|---|---|---|---|---|
| A hub daily check's slot passed while the hub was down | the hub, at its next start | `monitor.DailyLedger` keeps „the slot that last ran to its end” per watched job (`deadline-check`, `offsite-key-audit`) across a restart; `scheduleDaily` asks it at its start and tells it after each run | `hub_daily_job_skipped` (warning), once per missed slot | it does not run the missed check late. The snapshot and the prune are not watched (they make up for a missed slot by themselves). A job it has never seen is watched from the first start, not judged |
| An operator mail was never sent | the hub, at its next start | `Dispatcher.ReportLostOperatorMails`: at a start no retry timer is alive, so every operator mail of the last 48 hours whose newest delivery record is `failed` was never sent. ONE mail carries each lost mail's own sentence; the scan's time is kept, so a second restart does not repeat it | `operator_mail_lost` (error) | a mail that gave up while the hub keeps running leaves an event row at once and is MAILED only at the next start. The summary is a mail like any other and can be lost too; the next start lists it. A household mail is still never retried (R-1361) |
| A signed job a box never took | the hub, on the 60 s sweep | `monitor.SignedJobWaitChecker`: a job still in the queue two hours after it was put there (a box asks every 15 minutes at the latest). The hub does not open a signed job, so it judges by age, not by the job's own end time | `signed_job_not_taken` (warning), once per job | it does not remove the job |
| A signed job a box took and refused, or whose run failed | the box's agent | the agent's clearing call (`DELETE …/jobs/<id>`) now carries `outcome` (done · rejected · failed · malformed), a `reason` from a closed list (`signedjobs.ReasonCodes`) and the op's name in its query; before, „ran” and „refused” looked the same | `signed_job_refused` (error), once per job. The two clock reasons name the box's clock | an agent older than release 3 says nothing, and nothing is raised. The box's own words never reach a mail (unknown reason → „other”) |
| The guest-power watchdog gave up | the box's agent | the host report's `guest_power_gave_up` list (vmid, since, attempts); the watchdog's record is memory | `guest_power_gave_up` (error), once per down period; `guest_power_ok` (info) when a later report shows that guest running | „gone from the list” alone never clears (an agent restart empties the list while the guest is still down) |
**Not proven on a box or a deployed hub:** all five. The tests use fakes for the mail service and the real gate
and verifier for the signed jobs (`audits/night-build-2026-11-14/B/`, 43 mutations seen red).
## 17. Operator access tokens [DESIGN — hub v0.152.0, operator ruling 2026-10-15 11:38 (`09` §3 decision 251)]
**The problem.** Scripts — Claude Code's floor step first — drove the hub with the operator's own password (HTTP Basic,
@@ -374,6 +374,11 @@ one info line beside `host_crash_restart`; `operatorOnlyEvents`, pinned by
| `tunnel_down` | error | the box's two newest host reports say the tunnel is `not_running` (more than one report cycle, 15 min) and the one before did not | the first `running` after it → `tunnel_recovered` (info) | `api/tunnel_test.go` |
| `proxmox_trust_problem` | error (warning for „the root CA copy ends within 30 days”) | **[built, not deployed — hub `main` after v0.181.0]** the host report's `proxmox_trust` stanza names a cause (`03` §12a); once per (box, cause), not at every report | the first report with no problem → `proxmox_trust_ok` (info), one for all causes | `api/proxmox_trust_test.go` |
| `box_clock_wrong` | warning | **[built, not deployed — hub `main` after v0.181.0; needs an agent that stamps `sent_at`, built and not released]** the box's clock at the moment of sending is more than **one minute** from the hub's clock at arrival, in either direction (D79, `09` §3 decision 300); told once per direction. The hub cannot tell whose clock is wrong: a second box off in the same direction makes the alarm say „check the hub's own clock first”. An agent without `sent_at` is never judged | the first report within **30 seconds** → `box_clock_ok` (info) | `api/box_clock_test.go`; agent `hub/client_sentat_test.go` |
| `hub_daily_job_skipped` | warning | **[built, not deployed — hub `main` after v0.181.0; D78, `05` §16.6]** at a hub start: the newest slot of `deadline-check` or `offsite-key-audit` passed while the hub was not running; once per missed slot | none (the next slot runs) | `monitor/daily_ledger_test.go`, `cmd/hub/r1383_wiring_test.go` |
| `operator_mail_lost` | error | **[built, not deployed — hub `main` after v0.181.0; D78, `05` §16.6]** at a hub start: operator mails of the last 48 h whose newest delivery record is `failed` — one mail for all, with each lost mail's own sentence; and a row (no mail) when three retries gave up | none | `notify/lost_operator_mail_test.go` |
| `signed_job_not_taken` | warning | **[built, not deployed — hub `main` after v0.181.0; D78, `05` §16.6]** a signed job is still in a box's queue after two hours; once per job | none (the job leaves the queue when the box takes it) | `monitor/signed_job_waits_test.go` |
| `signed_job_refused` | error | **[built, not deployed — hub `main` after v0.181.0; D78, `05` §16.6]** needs an agent of release 3: the box cleared a signed job and said it was rejected, malformed, or its run failed; the cause is one of a closed list; once per job | none | `api/r1383_box_told_test.go`; agent `signedjobs/outcome_test.go` |
| `guest_power_gave_up` | error | **[built, not deployed — hub `main` after v0.181.0; D78, `05` §16.6]** needs an agent of release 3: the host report lists a guest the guest-power watchdog stopped trying to start; once per down period | a later report shows that guest running → `guest_power_ok` (info) | `api/r1383_box_told_test.go`; agent `localapi/guestpower_test.go` |
| `os_update_stale` | warning | no successful OS leg for **7 days** while the switch is ON (agents that can run the leg only); the mail names the likely reason (box not reporting / the last leg's failure / no good night backup) | a successful leg | `TestAlarm_StaleLeg`, `TestAlarm_StaleNamesTheReason` |
| `os_reboot_needed` | warning | the host has needed a reboot for **14 days** (from the FIRST scanned report that said so) | a scanned pass that finds nothing (agent ≥ 0.141.1 scans the host every pass) | `TestAlarm_RebootNeeded`, `TestRebootNeeded_ClearedByAScannedPass` |
| `os_ring0_stalled` | error | ring 0 approved nothing for **7 days** in a layer while it has pending FAST-lane updates (a pending kernel does not count) | a new release | `TestAlarm_Ring0Stalled` |