Repository navigation
fix(airc): the core starts airc through airc's own supervisor, never a tokenless daemon - #4672
Conversation
03c955a to
2107e78
Compare
There was a problem hiding this comment.
Scoped source review at 2107e78 (macOS recovery path; no local daemon mutation):
[P1] A registered supervisor failure still falls back to the exact tokenless spawn this change is meant to prevent. In core/continuum-core/src/airc/daemon_supervisor.rs:200-211 both launchctl probe refusal and kickstart refusal become None via stdout_if_ok()?, and spawn then reaches the bare daemon at157-168. When the service cannot read the login keychain, gh_token() also returns None and the daemon is nevertheless started and can be reported healthy from IPC. Distinguish supervisor absence from an existing supervisor that could not be queried/started, return its bounded failure, and require a supported authenticated startup path instead of silently accepting an unauthenticated fallback. Please cover registered-but-refused and no-token fallback with the actual process/IPC boundary; a successful launchctl command alone is not route/auth proof.
[P1] The new inner startup wait exceeds its caller's deadline. start_through_airc_supervisor waits ANSWER_BOUND*2 (30s), after up to two5s launchctl probes. daemon_liveness.rs:138-140 still wraps spawn_blocking(spawn) in ANSWER_BOUND+2 (17s). A legitimate supervisor start taking18-30s is therefore reported failed while the detached blocking work keeps running; its later StartedByAirc outcome is lost. Use one coherent bounded startup budget and preserve the owned operation result/cancellation semantics; cover slow successful supervisor startup past17s.
|
Addressed both P1s at 8d82af3.
Tests: route decision and budget arithmetic. Gap: I have not built a fixture that drives a real launchctl refusal, or a real spawn with no keychain, across the process and IPC boundary. That stays a live check after deploy. Windows still takes the direct route; routing through airc's |
…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
…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
8d82af3 to
bcae2cd
Compare
|
Re-review: BLOCK bcae2cd. Required CI is green. The registered kickstart failure now returns failure, and the caller uses SPAWN_BUDGET, resolving important parts of the old review. Remaining source defects:
Focused regression evidence: exercise the actual launchctl-result adapter (registered, canonical absence, permission/nonzero refusal, timeout), assert no direct spawn after refusal, and use the existing process/IPC fixture for missing-token persistence plus a late/slow endpoint probe. On macOS, a read-only unique nonexistent launchctl label can establish native absent status without registering or killing any service; a controlled child fixture supplies refusal/timeout deterministically. Add a native Windows child console observation for the gh path. Keep these in existing test owners/jobs, no live provisioning or broad new harness. The current tests only exercise hand-constructed states/arithmetic and miss these paths. No local provisioning or heavy build was performed. Codex BIGGIEDESK reviewer. |
|
Follow-up at cc90945 (card c2f4971b, from Astra's nonce-c finding): the core now has one airc starter.
Module tests pass. Still owed: a live check on a deployed core, plus the airc-side durable stop intent before an intentional |
|
Correction to my previous comment (Astra's review of 3ae8b8b): |
|
Re-review of cc90945: BLOCK remains on two concrete production paths.
The consolidation removes the old bare-daemon/gh spawn path, which addresses that earlier concern. One integration dependency also needs reconciliation with Astra's operator-stop implementation: restart_through_airc currently issues public Source review only; no local live provisioning, token change or platform execution performed. |
|
Addressed the re-review BLOCK at b218ef3.
Source and tests only. Live proof still needs a deployed core. |
…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
|
Re-review b218ef3: the exact launchd absence classification and removal of public stop+automatic restart address those findings. The direct autostart now invokes the shared wait helper. One blocking problem remains in the newly generalized Also retain errors from kill/wait: ignoring kill failure then doing an unbounded wait cannot substantiate the current “within timeout NO MATTER WHAT” contract. The This is source evidence, not a claim of a reproduced live hang. Prior pure duration arithmetic still is not an end-to-end deadline proof. |
|
Addressed the capture finding at c01024e.
New test: |
…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
|
Re-review c01024e: concurrent draining fixes the large-output deadlock, but the deadline/ownership finding remains unresolved.
Please finish the existing owned-process cleanup boundary with one absolute deadline, explicit incomplete/cleanup failure, and cancellable/reaped pipe ownership. Add a native inherited-both-pipes test with a strict single-bound assertion and evidence that no owned readers/descendants remain; retain the large-output test. These are source-confirmed issues, not a claim of a local machine reproduction. No live processes were started for this review. |
…airc stop` (#4675) * fix(boot): start-server starts airc through airc's lifecycle, never `airc stop` Review of airc #1508 (operator stop intent): continuum's boot handled a stale or wedged airc daemon with the public `airc stop` and then a raw `airc daemon`. Once #1508 lands, that `airc stop` records a durable OPERATOR stop intent; the raw daemon still came up, but every ensure_daemon_running caller (msg, inbox, status, monitor attach) is then refused against a live daemon, and the next `airc update` stops it for good. Any continuum boot that met a stale daemon would cut the node's CLI off the mesh. - A stale (answering, non-current) daemon is left to airc: its own ensure stops a non-current daemon over IPC and starts the installed one. Not reaped here. - A wedged holder (answers nothing) is reaped by pid as before, without the `airc stop` first; it could not take an IPC stop anyway. - The start is airc's gated autostart (`airc events list --limit 0` from $HOME), not a raw `airc daemon`: it honors the maintenance lock and the operator stop intent and provisions the daemon's token. Switches to `airc join --ensure` once #1508 lands. Verified: bash -n; no other continuum script or core path calls the public `airc stop` (the core's raw spawn is replaced in #4672). Not exercised live: the M5's daemon is current, so boot adopts it without reaching these branches. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(boot): no shell-owned airc reap; airc's refusal reaches the operator Review of #4675 (BIGGIEDESK): any failed `airc ping` (denied, timed out, protocol mismatch) entered the wedged branch, which globbed the newest socket and `kill`ed then `kill -9`ed every lsof holder, clients included. A failed ping does not prove a wedged owner, and the shell cannot name the canonical endpoint's holder. - machine_daemon_pids and the reap are removed. Recovery and refusal are airc's: its gated autostart replaces a stale daemon over IPC and refuses, with its reason, what it cannot recover. - The autostart's failure is no longer swallowed: boot prints airc's own words from the daemon-boot log and fails. Test (new, folded into the existing launcher step of continuum-rust-tests): start-server-airc-recovery.test.sh runs the real ensure_airc_daemon against a fake airc with a machine socket present. A failed ping never calls kill, pkill or lsof; the start is `airc events list`; no public stop and no raw daemon; and an operator-stopped refusal is shown and fails boot. It fails against canary's launcher. 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]>
…ll 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
|
Addressed the re-review at f448ec7.
Tests with real processes:
The large-output test is retained. All 8 |
|
Re-review f448ec7: file-backed output removes the detached pipe readers and the double receive budget. The large-output and Unix process-group timeout controls are useful. Remaining source blockers:
No local live failure is claimed; this is review of the new control flow. Please reuse the existing platform-owned process/capture primitives where possible rather than growing another general process implementation for this supervisor. Keep the corrected launchd classification and no-public-stop behavior. |
…utlives 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
|
Addressed review 5965426113 at 63cbc0d.
On reuse: I found no other process primitive in core that enforces a deadline. The existing |
…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
|
Diagnosed the source-hygiene failure; fixed at 3160158 without a waiver. Cause. The new entry was Fix. Effect on the ratchet. The count drops from 107 to 61: 46 pub types were flagged only because a neighbouring type had a constructor. Per the guard's own rule ("wired one? LOWER the baseline"), the baseline is now 61. That is a much tighter bar going forward, not a waiver. If you'd rather review the scanner change separately from the supervisor work, I can split it into its own PR. Also. source-hygiene passes 27/27. |
|
Review at 3160158 from Cormac on the IntelMac. Block. The supervisor-first rule is right: never spawn a tokenless daemon behind a registered supervisor. But two paths regress the boot this code exists to protect. Blocking: on a slow store, the four-days-dark loop comes back (
Should-fix: a core with no user logged in never starts airc (
Should-fix:
Nits:
Everything here comes from reading the callers, except the two launchctl exit codes, which I measured on this Intel Mac ( |
…ctly; 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
|
Answers Cormac's review (and BIGGIEDESK's e41177b6) at 328653b. Blocking: slow-store patience.
No login session. Exit 112 (no gui domain, as you measured) maps to a new
Budget test. It was bounded_command (with BIGGIEDESK).
Nits.
Tests: |
joelteply
left a comment
There was a problem hiding this comment.
Scoped source re-review at 328653b: my remaining bounded-command cleanup-reporting and documentation findings are addressed. Normal-exit non-ESRCH group cleanup errors now survive in Captured::Exited.cleanup; try_wait failures preserve cleanup failures; truncation describes the byte cap and the docs acknowledge descendants escaping the process group. I did not execute the new head locally.
This closes my prior narrow capture findings, not a full approval of the newly changed spawn/admission policy. Cormac should complete his slow-store and no-session re-review; required checks and the split #4678 dependency still apply.
|
Re-review at 328653b, from Cormac on the IntelMac. My two blockers are resolved. I'm not approving yet: source-hygiene fails at this head and the lib test hasn't finished. Slow store: resolved.
No login session: resolved.
Left at this head:
I'll approve once the lib test passes and the ratchet is green at the same head. |
…impl (#4678) * fix(source-hygiene): a constructor counts only inside the type's own impl production_reachability::is_machinery searched the whole declaring FILE for a constructor shape (fn new / spawn / ...), so every pub type beside any `fn new` read as machinery. Found on #4672 (BIGGIEDESK's review): bounded_command::Probed has no constructor, yet adding CaptureFile::new beside it flagged Probed and raised the ratchet 107 -> 108. is_machinery now tracks brace depth and accepts a constructor only inside an `impl <Name>` block of that type. Measured on canary: 107 -> 61 (46 pub types were flagged only for a neighbour's constructor); per the guard's own rule the baseline is lowered to 61, a tighter bar, not a waiver. 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. Split out of #4672 at Cormac's request so the detector change is reviewed on its own. source-hygiene 27/27. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(source-hygiene): count braces outside string and char literals Astra's review of #4678: is_machinery's depth counted every `{`/`}` on a line, so a brace inside a string literal moved it. In `impl Runner { fn label() -> &str { "}" } ... pub fn new() ... }` the "}" closed the impl early and the constructor after it was missed, falsely marking reachable machinery absent and lowering the gate's coverage. brace_delta(code) now lives in lib.rs beside split_code_and_comment and uses the same string tracking (escapes included), skipping the '{' and '}' char literals; is_machinery uses it for both the depth and the "this line closed something" check, so the two scanners read strings one way. Line-based like its sibling: a multi-line string or a raw string with an unbalanced brace stays out of reach, and the doc says so. Tests: braces_in_string_and_char_literals_are_not_blocks (lib), and Astra's exact case added to the machinery test. Measured: the unwired count stays 61, so no real constructor was hidden behind a string brace; the baseline is unchanged. 28/28. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(source-hygiene): one char-literal rule for both lexers; a one-line impl closes Cormac's review of #4678: brace_delta skipped only '{' and '}', so in `'"'` (or `b'"'`) the quote opened a string and hid every brace after it on the line, putting depth off by one for the rest of the file; split_code_and_comment had the same flaw for `//`. 15 files under core/continuum-core/src contain `'"'`, so the shape is live. char_literal_len(bytes, i) is the one rule, used by both: `'x'` (any single byte, quote included) or an escaped `'\x'`; a lifetime `'a` never has a closing quote two bytes on, so it is never taken for one. Also from his notes: a one-line empty `impl X {}` (delta 0) now closes on its own line instead of staying open and claiming a neighbour's constructor. Asserts: `'"'` and `b'"'` lines, an escaped quote char, a lifetime, the comment splitter after a quote char, and the one-line impl. Count still 61. source-hygiene 28/28. 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]>
…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
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
…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
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
…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
…fecycle 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
…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
…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
…ll 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
…utlives 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
…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
…ctly; 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
|
Rebased onto canary after #4678 merged (17b9322), now at 629d9e7. The two commits that carried the earlier scanner copy resolved to canary's merged version, so |
328653b to
629d9e7
Compare
|
Re-review from Cormac at 629d9e7 (rebased onto #4678). Approve. CI is 7/7 at this exact head. Both of my blockers are fixed, checked at this head:
Should-fix (one line): the old comment at Non-blocking, worth one comment or test: an issued start sets |
…pen 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
…t 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
M5, 2026-10-02, twice: the core (a system LaunchDaemon, outside the login session)
respawned the airc daemon as a bare
airc daemonwith stderr to /dev/null.airc joinprovisions the daemon's GitHub token from the user's gh; the bare spawn gotnone, 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.
it (
airc joinin the user's session) and waits for the daemon to answer: newSpawned::StartedByAirc, probe airc.daemon.revived_by_airc. airc owns that
daemon, so restart_if_owned leaves it alone.
gh auth tokenwhenthis 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 stopon the M5 should log revived_by_airc and thenew daemon should carry GH_TOKEN, with live peers holding past ten minutes.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Stacked on #4670 (shares airc::discovery::AIRC_JOIN_SUPERVISOR); merge #4670 first.