Skip to content

feat(daemon): self-update mechanism (the trigger; wire-in coordinated) - #1268

Merged
joelteply merged 1 commit into
canaryfrom
feat/daemon-auto-update
Jun 20, 2026
Merged

joelteply merged 1 commit into
canaryfrom
feat/daemon-auto-update

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Why

"No one remembers to run airc update" — and falling behind silently breaks coordination (we lived it this session: stale binaries + a lockfile drift + a gate break). Automate it.

What

The safe updater already exists (airc update --auto: rebuild → smoke-test → roll back a bad build, no-op when current). This adds daemon::auto_update — the trigger: a periodic loop that, when enabled + idle, spawns a detached airc update --auto (own process group, survives the daemon stopping itself mid-update).

  • Default-ON (the whole point), opt-out via AIRC_NO_AUTOUPDATE.
  • Long interval (AIRC_AUTOUPDATE_INTERVAL_SECS, 1h default, 300s floor).
  • Pure policy (enabled/interval/should_fire) unit-tested; gate-clean (verified against -D clippy::expect_used -D clippy::unwrap_used).

Additive — NOT yet wired into server.rs

The loop takes an is_idle predicate, and the correct signal is active mesh streams (not IPC-client idle). Wiring that + spawning the task sits on top of reliable restart/reconnect (@bigmama's transport-reliability lane) — auto-restart on a flaky restart = churn, the opposite of the goal. So the mechanism lands now; activation is a coordinated one-liner once restart is reliable. Zero effect until wired.

🤖 Generated with Claude Code

…ally

"No one remembers to run airc update" — we lived it (stale binaries, a lockfile
drift, a gate break). So automate it. The dangerous part already exists:
`airc update --auto` rebuilds, smoke-tests, and ROLLS BACK a bad build (can't
brick the node) + no-ops when current. This adds the TRIGGER.

`daemon::auto_update`: a periodic loop that, when enabled + idle, spawns a
DETACHED `airc update --auto` (own process group, so it survives the daemon
stopping itself mid-update). Default-ON (the point), opt-out via
AIRC_NO_AUTOUPDATE; long interval (AIRC_AUTOUPDATE_INTERVAL_SECS, 1h default,
300s floor). Pure policy (enabled/interval/should_fire) unit-tested; gate-clean
(no expect/unwrap, verified against -D clippy::expect_used).

ADDITIVE + NOT YET WIRED into server.rs: the loop takes an `is_idle` predicate,
and the right signal is ACTIVE MESH STREAMS (not IPC-client idle) — wiring that
+ spawning the task belongs on top of reliable restart/reconnect (BigMama's
transport-reliability lane). So the mechanism lands now; activation is the
coordinated one-liner once restart is reliable. Zero effect until then.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@joelteply
joelteply merged commit 370da57 into canary Jun 20, 2026
11 of 12 checks passed
@joelteply
joelteply deleted the feat/daemon-auto-update branch June 20, 2026 22:06
joelteply added a commit that referenced this pull request Jun 20, 2026
…1268) (#1269)

#1268 landed the self-update MECHANISM (rollback-safe detached `airc update
--auto` on a long interval) but deliberately left it unspawned, pending the
mesh-idle predicate + the startup wire-in — the reliability lane. This wires
it: spawn `auto_update::run` alongside the route-refresh + registry loops,
exiting on the shared shutdown notifier.

The idle predicate is MESH-state, not IPC-idle (per the #1268 handoff): idle =
zero live LAN peer connections (`connected_lan_peers == 0`). With no live
connection there is definitionally no in-flight mesh work an update could drop,
and control-plane reconnect after a restart is cheap + self-healing. The
updater only restarts when canary actually moved (no-op otherwise), so steady
state is a cheap periodic fetch, never connection churn. Opt out with
AIRC_NO_AUTOUPDATE=1.

Refinement TODO (documented at the call site): once stream-plane sessions are
tracked in daemon connection-state, gate on "no active TRANSFER" so a
connected-but-quiet node can still self-update.

Net: nodes self-heal their VERSION with no human in the loop — closes the
version-drift class (stale binaries / protocol skew) we just lived through
proving cross-machine LAN.

Co-authored-by: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant