hephaestus/docs/how-to/self-update/self-update-poll-loop.md
Erich Blume e6524fddbb
All checks were successful
Build / validate (pull_request) Successful in 5m23s
C2(hephd-self-update): plan add goal + prerequisite cards for hephd self-update
Kick off the C2 Mikado chain for an opt-in (default-off) hephd
self-update mode (forge-poll -> cargo install from tag -> self-restart).
Goal card plus eight prerequisite cards, indexed from how-to.md:

  release-poll-version-check, self-update-opt-in-flag (leaves)
    -> self-update-poll-loop                 (notify-only core)
  service-env-forge-access (leaf, the cargo/forge blocker)
    + self-update-poll-loop -> cargo-install-from-tag
  service-respawn-on-clean-exit (leaf, systemd Restart=always)
    + cargo-install-from-tag -> self-restart-after-update
  verify-hub-dropout-resilience (leaf, lock in the base-case guarantee)

Grounded in research of hephd's sync loop, daemon lifecycle, the
launchd/systemd service templates, and the forge releases API.
Captured from Hephaestus task 01KTA2NSNRYT902HC3VRW00S1J.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 13:20:46 -07:00

1.2 KiB

title modified tags status requires
Self-update poll loop 2026-06-04
how-to
active
release-poll-version-check
self-update-opt-in-flag

Self-update poll loop

The background task that ties the flag to the version check. This card alone yields a working notify-only daemon ("update available: vX.Y.Z" in the log) — the apply path layers on after.

Deliverables

  • Spawn a tokio task modelled on spawn_sync_loop (crates/hephd/src/server.rs): tokio::time::interval ticking at the configured cadence, guarded so it's a no-op unless --self-update is set.
  • Each tick: run the release-poll-version-check. On "newer available", log it (and, once the apply path exists, hand off to cargo-install-from-tag).
  • Errors (forge unreachable, bad JSON) are logged and the loop continues — same resilience pattern the sync loop uses. A flaky forge must never crash or block the daemon.

Done when

With --self-update on and a stubbed/real "newer" release, the daemon logs an update-available line once per detection; with the flag off, no task runs. Requires release-poll-version-check and self-update-opt-in-flag. Part of hephd-self-update.