Skip to content

feat(reliability): reboot-surviving core service (launchd/systemd) — upstart spine #2, live-proven on Mac - #1853

Merged
joelteply merged 1 commit into
canaryfrom
feat/upstart-reboot-surviving-service
Jul 6, 2026
Merged

joelteply merged 1 commit into
canaryfrom
feat/upstart-reboot-surviving-service

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

A grid node must come back on its own after reboot or crash — never "the persona died because the Mac slept
and nobody re-ran cu start" ([[grid-node-resilience]], was MISSING). This installs the headless core under
the OS supervisor: starts at login/boot + auto-restarts on death.

  • tools/scripts/install-service.sh: install|uninstall|status. macOS launchd LaunchAgent (RunAtLoad +
    KeepAlive) is the fully-built + on-this-machine-tested path; Linux systemd --user unit written to the same
    contract for grid nodes; other OSes fail loud with the manual command. Resolves the core binary fail-loud
    (override → installed paths → cargo target), never cargo build on boot.
  • Found + fixed a real boot hang while testing: under the supervisor's minimal PATH the core couldn't find
    airc, tried to CURL-INSTALL it on boot, and hung 120s → exit 1 → KeepAlive loop. Fix: the wrapper puts
    airc on PATH AND sets AIRC_DISABLE_AUTOINSTALL=1 (airc/discovery.rs) — a service must never block boot on a
    network install; it fails loud / comes up coreless instead.
  • package.json: service:install / :uninstall / :status.

LIVE-verified on this Mac: install → core up via launchd in ~15s (was 120s+ hanging on airc) → kill -9 the
core → launchd auto-restarted it (new pid, up in ~9s) → clean uninstall → dev core restored. Reboot-survival
proven, not claimed.

Co-Authored-By: Claude Opus 4.8 [email protected]
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…upstart spine #2, live-proven on Mac

A grid node must come back on its own after reboot or crash — never "the persona died because the Mac slept
and nobody re-ran `cu start`" ([[grid-node-resilience]], was MISSING). This installs the headless core under
the OS supervisor: starts at login/boot + auto-restarts on death.

- tools/scripts/install-service.sh: install|uninstall|status. macOS launchd LaunchAgent (RunAtLoad +
  KeepAlive) is the fully-built + on-this-machine-tested path; Linux systemd --user unit written to the same
  contract for grid nodes; other OSes fail loud with the manual command. Resolves the core binary fail-loud
  (override → installed paths → cargo target), never `cargo build` on boot.
- Found + fixed a real boot hang while testing: under the supervisor's minimal PATH the core couldn't find
  `airc`, tried to CURL-INSTALL it on boot, and hung 120s → exit 1 → KeepAlive loop. Fix: the wrapper puts
  airc on PATH AND sets AIRC_DISABLE_AUTOINSTALL=1 (airc/discovery.rs) — a service must never block boot on a
  network install; it fails loud / comes up coreless instead.
- package.json: service:install / :uninstall / :status.

LIVE-verified on this Mac: install → core up via launchd in ~15s (was 120s+ hanging on airc) → `kill -9` the
core → launchd auto-restarted it (new pid, up in ~9s) → clean uninstall → dev core restored. Reboot-survival
proven, not claimed.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply merged commit d2f2cca into canary Jul 6, 2026
@joelteply
joelteply deleted the feat/upstart-reboot-surviving-service branch July 6, 2026 04:09
joelteply added a commit that referenced this pull request Jul 6, 2026
…m) — survives LOGOUT; airc REQUIRED not disabled (#1854)

Follows #1853. Two corrections from Joel's review:

1. --system scope (the real BIGMAMA fix — logout/boot-without-login). `install-service.sh install --system`
   (npm run service:install:system): macOS LaunchDaemon in /Library/LaunchDaemons (runs AS the installing
   user via UserName + HOME so it still uses ~/.continuum, but system-managed so it survives that user's
   logout); Linux systemd SYSTEM unit (User=, WantedBy=multi-user.target). Default (no flag) stays the
   no-sudo user LaunchAgent / --user unit from #1853.

2. airc is the nervous system — we do NOT operate without it. Dropped the #1853 AIRC_DISABLE_AUTOINSTALL=1
   band-aid (which traded a boot hang for a node with no substrate). Instead: REQUIRE airc (fail loud at
   install if absent, pointing at its installer) and keep it on the service PATH so the core finds it via
   `which airc` at boot — no install, no 120s hang, full grid citizen.

Verified on this Mac (no sudo needed): the reworked USER LaunchAgent boots the core in ~12s with airc found
via PATH and NO disable, KeepAlive restart works (killed pid → relaunched), clean uninstall. The --system
daemon plist is well-formed (plutil-lint of the same wrapper passes) — its only extra step is the sudo
`launchctl bootstrap system`, which Joel runs to load it (I can't sudo non-interactively).

Test the daemon:  npm run service:install:system   (prompts for sudo; then `cu ping`, and it survives logout)


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

Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jul 6, 2026
…fast (speed is paramount) (#1855)

The core's airc discovery synchronously awaited `auto_install_airc()` (curl|bash) on the boot path with a
120s deadline. When airc wasn't on PATH (a launchd/service boot with a minimal PATH — see #1853/#1854), the
core HUNG up to 120s before binding its IPC socket: boot held hostage to a network install. Joel: "speed is
paramount".

Fix: when airc isn't on PATH, spawn the installer DETACHED (tokio::spawn, logged) and return the new
`AutoInstallInProgress` fast. The aggregate `discover()` already degrades gracefully (returns Unreachable),
so the core binds its socket + is responsive NOW; airc joins once the background install lands. The 120s
AUTO_INSTALL_DEADLINE now only bounds the detached task, never boot. Still fail loud (named reason), just
without hanging.

- discovery.rs: background-spawn the install + return AutoInstallInProgress (was blocking await).
- discovery_state.rs / discovery_aggregate.rs: mirror the AutoInstallInProgress variant + map it.

LIVE-verified on this Mac: booting the core with airc OFF PATH now logs `airc: ✗ unreachable: airc not on
PATH — installing in the BACKGROUND; node is up …` instead of the old `airc installer did not exit within
120s` hang. 21 airc::discovery tests green; normal boot (airc present → fast path) unaffected (~44s, model
load dominated). Reliability spine: consistent fast start.


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

Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jul 6, 2026
…ud + exit, let the supervisor restart (task #82) (#1858)

A parallel reliability audit confirmed the #82 zombie-park is worse than assumed: `IPC_READY` is a
process-global `watch::Sender` that is NOT dropped when the IPC thread panics/hangs before binding the
socket. So `main`'s `ipc_ready_rx.changed()` never errors → it parks FOREVER with no socket, no exit, no
nonzero code — the "clean exit" the old comment promised never happens. Concrete triggers already in-tree: a
pre-bind `panic!("failed to load model_registry")`, or ANY hung module `initialize()` (inits run serially
with no per-module timeout — the airc-120s-hang class, generalized).

Fix: bound the ready-wait with a BOOT DEADLINE (`tokio::time::timeout`, default 300s — generous for a cold
model load, override via CONTINUUM_BOOT_DEADLINE_SECS). If the socket isn't bound in time, boot is wedged →
fail loud + `libc::_exit(1)` so the supervisor (launchd/systemd KeepAlive from #1853/#1854) restarts us
instead of an alive-but-deaf zombie. The changed()-err path now `_exit(1)`s too (was `return Ok(())`, which
masked a boot failure). Both paths `eprintln!` alongside `tracing::error!` because `_exit` skips the async
appender flush — the raw stderr write is what the operator actually sees.

LIVE-verified on this Mac: normal boot ready in ~36s (default 300s deadline, no false-positive); a 2s deadline
against the real boot exits(1) at ~2s with the fail-loud message visible. Reliability spine: fail loud, never
park. Credit: parallel reliability-audit agent.


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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant