Commit Graph
2 Commits
Author SHA1 Message Date
CatoandClaude Opus 5 083aadc130 fix(reconciler): the clock reported healthy and would never have ticked again (#93)
The timer I installed an hour ago was active, enabled, and dead.

    systemctl is-active   -> active
    systemctl is-enabled  -> enabled
    NextElapseUSecMonotonic -> infinity

OnBootSec=5min and OnUnitActiveSec=15min are MONOTONIC. It ran fine while it
was left alone, but I stopped it to investigate a false dispatch, and on
restart systemd had no next elapse to compute: OnBootSec's trigger point was
hours in the past, and OnUnitActiveSec re-arms from an activation the restarted
timer no longer had. Persistent=true does nothing for a monotonic timer, so it
did not save it either.

So the mechanism built to end "reports healthy, does nothing" failures was
itself one, and would have gone on saying `active` indefinitely while the fleet
stopped being reconciled. Caught only because I read NextElapse instead of
trusting the word `active`.

OnCalendar=*:0/15 is absolute — :00, :15, :30, :45, computable without
reference to boot time or to any previous run, and unaffected by stop/start.
Persistent=true is now meaningful and catches up a tick missed to downtime.
RandomizedDelaySec=45 keeps it off the exact quarter hour.

And the installer no longer reports success without proving the thing will
tick: it reads NextElapseUSecRealtime and fails if there is none. It caught this
class on its first run. The check retries briefly, because the property is not
populated the instant `enable --now` returns and a guard that false-alarms is a
guard that gets ignored.

Verified on bitbaum: next elapse 13:00:44 UTC, and the 12:54 tick dispatched a
run that proved its guards (24 + 34 assertions), surveyed 21 repos and correctly
dispatched nothing.


Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 05:57:10 -07:00
CatoandClaude Opus 5 65e4104ff1 fix(reconciler): put the clock on the box, because GitHub's scheduler is not one (#90)
The reconciler I shipped this morning has never once run on schedule. Neither
has the audit. Measured today:

  deploy-freshness.yml   hourly at :37 since that morning   10:37 missed, 11:37 missed
  deploy-reconciler.yml  twice-hourly                       11:53 missed

Every run either workflow has ever had was a manual dispatch of mine.

That is the same failure that broke the twenty-five per-repo sweeps — loki 19m,
evig 151m, reparaturbonus-zh 244m, vitareba 276m since their last run, against a
stated ten-minute cadence. I diagnosed that correctly and then fixed it by
moving from twenty-five GitHub crons to one GitHub cron, which moved the problem
without fixing it. A reconciler that never fires is not a reconciler; it is a
decoration that makes the fleet look supervised.

The box's timers DO fire, on time, and have for months: security-check every
5m, host-check every 5m, watchdog every 5m, all with no drift. So the clock
moves there and GitHub only does the work.

`fleet-reconciler.timer` ticks every 15 minutes and dispatches this workflow.
The tick script deliberately holds no policy — every guard (green tip, nothing
in flight, the caps, the double read, the CI-re-run rule) stays in the workflow
where it is version-controlled and tested. A clock that also made decisions
would be a second, untested copy of the reconciler living on a box nobody reads.

It also never exits 0 on a failed dispatch, because a tick that reports success
while dispatching nothing is precisely the invisible failure this whole
mechanism exists to end: `systemctl list-timers` would show it firing happily
forever.

Installed and verified on bitbaum. First box-triggered run — and the first --go
run of any kind — proved its guards (24 + 25 assertions), surveyed 21 repos and
dispatched nothing, correctly. Next tick 12:39 UTC.

The workflow keeps its `schedule:` as a free second chance, since the run is
idempotent, but nothing depends on it and the header now says so.


Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 05:28:26 -07:00