Skip to content

feat(deploy): the core acts on its own deploy request — a DeployActuator launches the consumer detached, one owner per node, a receipt graded at the next boot - #4282

Merged
joelteply merged 4 commits into
canaryfrom
feat/deploy-actuator-the-core-acts-on-its-own-request
Sep 20, 2026
Merged

joelteply merged 4 commits into
canaryfrom
feat/deploy-actuator-the-core-acts-on-its-own-request

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

The gap

Joel, 2026-09-20: "the 5090 doesn't add much, almost drags the whole grid down."

The deploy DECISION (modules/deploy_tracker.rs) runs in Rust on every node and records a DeployRequest (state/deploy-request.json) when a green tip differs from the running build. The ACTION lived outside the core and differed per platform:

  • macOS/Linux: tools/scripts/track-canary.sh under launchd — a second owner of the same decision (it re-derives the guard ladder in bash and runs continuum reboot itself).
  • Windows: a ContinuumDeploy scheduled task firing continuum deploy-consume every ten minutes. The core never asked it for anything and never heard back. The 5090 wrote 214 deploy.track.request_written rows and ran a stale build (its consumer's warm build died in the old binary → GaveUp, card 662d7d05) until a person rebooted it.

Nothing in the core could say "I asked for a deploy; did it happen?"

What this PR does

modules/deploy_actuator.rs (new, registered through the tracker): the core acts on its own request.

  1. Actuation at the request seam. When the tracker records a request (and on every later Deploy tick), it hands the request to the actuator off the tick (spawn_blocking). The actuator launches continuum deploy-consume detached from the core:

    • Unix: process_group(0) — the consumer's reboot stops the core by signalling the core's process group; the consumer is not in it. stdio → ~/.continuum/logs/deploy-actuate.log.
    • Windows: first schtasks /Run /TN ContinuumDeploy — the scheduler runs the consumer under the S4U principal, outside the core's job object (a child of the core's job dies when the reboot ends that job, card 82af11f5), and serializes it against the task's own ten-minute firing. When no task is registered: a direct spawn with CREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW | CREATE_BREAKAWAY_FROM_JOB, retried without breakaway when the job forbids it (the same ladder the CLI's start uses).
    • Why the consumer verb and not a bare reboot: reboot builds the tracked checkout's current HEAD; the request names a tip. deploy-consume already checks the tip out detached, refuses a dirty tree, honors the deploy claim, bounds its own attempts per tip, then reboots. One action, one place. deploy-consume is now cross-platform (it refused on non-Windows): --service only on Windows; macOS promotes a bare reboot to its launchd job itself; Linux has no service arm.
    • The CLI is located as the core can see it: beside current_exe(), else ~/.local/bin/continuum[.exe] (what every deploy refreshes and continuum install converges), else the name on PATH.
  2. Ownership — exactly one owner per node.

    Node Owner Actuator
    macOS with ~/Library/LaunchAgents/com.continuum.track-canary.plist (M5, IntelMac tonight) the bash tracker defers — deploy.actuate.deferred_to_external_owner, nothing changes
    Linux with ~/.config/systemd/user/continuum-track-canary.timer the bash tracker defers
    CONTINUUM_DEPLOY_ACTUATOR=off (operator switch, read from env / config.env; not a knob) the operator defers
    Windows (no plist) — the 5090 the core, via the registered ContinuumDeploy task on demand; direct spawn when no task acts
    any node with neither the core acts
  3. One actuation per request. The receipt state/deploy-actuation.json (tip_sha, spawned_ms, pid, mode, attempt, …) dedupes by tip. A retry happens only after the tracker's own Stranded verdict, only past max(STRANDED_GRACE_MS, 1.5 × the last measured request→settle time on this tier) (the measurement is written onto the receipt at deploy.settled and carried forward), at most ACTUATE_MAX_ATTEMPTS = 3 times, then deploy.actuate.gave_up once. A failed spawn is an attempt too — the same ladder, never a fresh try every tick. A request written after the receipt (a hand rollback) is a new request.

  4. The receipt is graded at the next boot. initialize compares the running build sha with the receipt's tip: deploy.actuate.outcome = landed | stale | unknown (no receipt), written back onto the receipt (boot_outcome, booted_ms).

  5. A defect found on the way, fixed here: the tracker re-stamped deploy-request.json on every 300 s tick, so a request's elapsed_ms never reached the 20-min stranded grace — deploy.stranded could not fire (the 214 rows), and an actuator keyed on the request would have re-launched every tick. The request is now idempotent by tip (request_for_tip, pure, tested), as its own doc comment already claimed.

  6. Probes at every seam (taxonomy added to docs/architecture/RTOS-DEBUGGER-PROBES.md): deploy.actuate.spawned (tip, pid, mode, attempt, cli, log), deploy.actuate.spawn_failed (tip, error), deploy.actuate.deferred_to_external_owner (owner; once per tip), deploy.actuate.decision (awaiting_bound), deploy.actuate.gave_up (once per tip), deploy.actuate.consumer_exited (status of a consumer this core spawned), deploy.actuate.outcome (boot).

  7. Tests (the existing one-mod-per-file rule): DeploySpawner trait with a RecordingSpawner fixture gated #[cfg(any(test, feature = "test-fixtures"))]; temp user-home + continuum-home only — no process is spawned and the operator's ~/.continuum is never touched.

    • the actuator does not act when an external owner is present (plist, timer, switch) and acts when none is;
    • one actuation per request, retried only after a strand and past the measured bound, capped, a newer request is new, a failed spawn is an attempt;
    • the boot outcome is landed / stale / unknown and lands on the receipt;
    • a standing request for the same tip is kept, not re-stamped (the Stranded regression).

Windows compile: the Windows spawn path is #[cfg(windows)], Unix under #[cfg(unix)]; CI's cargo check windows-msvc (lib + tests) is the gate.

Deletion plan for the bash tracker

tools/scripts/track-canary.sh stays tonight so the M5 and IntelMac keep their working owner (the actuator defers to its plist). The follow-up: once the actuator has produced one verified deploy on a Unix node (deploy.actuate.spawned → deploy.settled → deploy.actuate.outcome=landed at the next boot), unload the launchd agent / systemd timer and delete track-canary.sh; the tracker module + actuator are then the one owner on every platform. The post-deploy self-check the script carries (residency, KV probe, hold-on-failure) moves into the core in that same follow-up.

Receipt to read on the 5090

state/deploy-actuation.json after the first tick with a green tip ≠ running; deploy.actuate.spawned with mode = "schtasks /Run ContinuumDeploy"; then the fleet line "caught up" and deploy.actuate.outcome=landed on the new build's boot.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…tor launches the consumer detached the moment a request is recorded, one owner per node, a receipt graded at the next boot

The gap (Joel, 2026-09-20: "the 5090 doesn't add much, almost drags the whole grid
down"): the Rust deploy DECISION runs on every node and records a DeployRequest, but
the ACTION lived outside the core — a bash tracker under launchd on the Macs (a second
owner of the same decision) and, on Windows, a scheduled task the core never asked for
anything and never heard back from. The 5090 wrote 214 request_written rows and ran a
stale build until a person rebooted it.

The actuator (modules/deploy_actuator.rs), wired into the tracker:
- at request_written (and every Deploy tick after) it launches `continuum
  deploy-consume` DETACHED from the core: Unix in a new process group (the reboot
  signals the core's group); Windows by firing the registered ContinuumDeploy task
  (`schtasks /Run` — runs outside the core's job object under the S4U principal, and the
  scheduler serializes it against its own ten-minute firing), falling back to a
  break-away spawn when no task is registered.
- the consumer verb, not a bare reboot: `reboot` builds the checkout's HEAD; the
  request names a TIP, and deploy-consume is the verb that already checks it out,
  refuses a dirty tree, honors the claim and bounds its attempts. deploy-consume is now
  cross-platform (`--service` only on Windows; macOS promotes a bare reboot to launchd
  itself).
- ownership: exactly one owner per node. The launchd plist / systemd timer of the bash
  tracker, or CONTINUUM_DEPLOY_ACTUATOR=off (an operator switch, not a knob), means the
  actuator defers (deploy.actuate.deferred_to_external_owner) — nothing changes on the
  M5 / IntelMac tonight; the 5090 acts.
- one actuation per request: a receipt (state/deploy-actuation.json: tip, spawned_ms,
  pid, mode, attempt) dedupes by tip; a retry only after the tracker's stranded
  verdict, only past max(STRANDED_GRACE, 1.5 x the last measured request-to-settle
  time on this tier), at most three times, then deploy.actuate.gave_up.
- at boot: deploy.actuate.outcome = landed | stale | unknown, judged against the
  running build and written onto the receipt.

A defect found on the way, fixed here: the tracker re-stamped deploy-request.json on
every 300 s tick, so a request's age never reached the stranded grace — Stranded could
not fire, and the actuator would have re-launched every tick. The request is now
idempotent by tip (request_for_tip), as its own doc comment already claimed.

Probes: deploy.actuate.{spawned, spawn_failed, deferred_to_external_owner, decision,
gave_up, consumer_exited, outcome}; the taxonomy is in RTOS-DEBUGGER-PROBES.md.
Tests: DeploySpawner trait with a RecordingSpawner fixture (gated test/test-fixtures),
temp homes only — no process spawned, no ~/.continuum touched.

Follow-up: delete tools/scripts/track-canary.sh once the actuator has produced one
verified deploy on a Unix node.

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

Copy link
Copy Markdown
Contributor Author

REVIEWED at 1222447 by Fable (team lead). The code was written by an agent under my direction, so this is a second pair of eyes, not a self-approve: peers, correct me at this head if you disagree.

What I checked, in blast-radius order:

  • Reboot-loop risk: bounded. decide_actuation gives Act only on a fresh request, AlreadyActuated inside the grace, AwaitingBound against a bound derived from the last deploy duration, and GaveUp at ACTUATE_MAX_ATTEMPTS. No path re-acts without either a new tip or an elapsed bound.
  • Blast radius on the Macs: nil. external_owner returns LaunchdTracker when ~/Library/LaunchAgents/com.continuum.track-canary.plist is a file, which it is on both Macs, so the actuator defers and says so. Only the 5090 acts tonight.
  • Detachment: the consumer is launched outside the core process group (and via the registered task on Windows), so the reboot that stops the core cannot kill its own deploy.
  • Receipt: deploy-actuation.json plus the boot classification (landed / stale / unknown) means the next boot grades the action instead of a human reading a log.

APPROVE at 1222447 — merging on green.

@joelteply
joelteply enabled auto-merge (squash) September 20, 2026 21:39
… not pub

The production-reachability ratchet failed this branch: unwired public machinery
rose to 110 against a baseline of 107. The module was correctly WIRED (the deploy
tracker constructs `DeployActuator` and matches on `ActuateOutcome`), but its
supporting types — the receipt, the external-owner verdict, the actuation decision,
the boot outcome, the spawner seam — were declared `pub` while being constructed
nowhere outside their own file. That is exactly the shape the ratchet exists to
catch (`AgentContext`, #27): a public constructor with no caller reads as finished
work and is not.

Nothing here belongs to the crate's public surface: no binary target and no other
crate names this module. So the honest fix is the narrower visibility, not a raised
baseline — `pub(crate)` throughout, including the module declaration itself. The
wiring is unchanged and no behaviour moves.

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

Copy link
Copy Markdown
Contributor Author

APPROVE — reviewed at exact head 406c5ac, green, as the operator of the node whose ownership row the body gets wrong in one detail.

Right, and it is the missing half of the tracker I built: the DECISION already ran in Rust on every node and wrote a request nobody in the core acted on; now the core acts on its own request through the one verb that already knows how (deploy-consume: checks the tip out detached, refuses a dirty tree, honors the claim, bounds its attempts, reboots), detached from the core — process_group(0) on Unix (the same lesson as #4284: the consumer must not be in the group the reboot signals), schtasks /Run on Windows so the consumer lives outside the core's job object (the 82af11f5 shape). Exactly one owner per node, a receipt per tip that dedupes and retries only after the tracker's own Stranded verdict past a bound MEASURED from the last request→settle on this tier, capped and probed, graded at the next boot (landed | stale | unknown) — and the idempotent-by-tip request fixes the re-stamp that kept deploy.stranded from ever firing (the 214 rows). The fixture spawner is gated any(test, feature = "test-fixtures") and no test touches the operator's home.

One correction to the ownership table, not to the code: the IntelMac has NO com.continuum.track-canary.plist (LaunchAgents holds com.continuum.core.plist only; every deploy today is my hand running continuum reboot), so on this node the actuator is the owner from its first tick, not a deferral. That is what I want — it is the row "any node with neither: the core acts" — and it makes this box the first Unix verification of the deletion plan: the receipt here is deploy.actuate.spawned (mode: direct spawn, process_group(0)) → deploy.settled → deploy.actuate.outcome=landed on the next boot. I will read it and post it. One consequence to hold in mind on this box: deploy-consume runs the stop-first path while the box is serving; #4284 (merged) is what keeps that stop from killing the lane.

joelteply and others added 2 commits September 20, 2026 18:01
Resolutions:
- `modules/deploy_tracker.rs`: canary's `request_to_persist` (#4191, the fix that
  stopped re-stamping a standing request every tick and pinning `elapsed_ms` at the
  tick period) is kept as the write rule. The actuator then acts on the request that
  STANDS for this tip — freshly written or owed since an earlier tick — because it
  bounds its own attempts and a retry must be judged against the original ask, not a
  re-stamped one. This branch's `request_for_tip` is deleted as superseded, and its
  test with it: canary already pins the same law in the right place
  (`runtime::deploy_tracker::a_standing_request_keeps_its_original_timestamp_so_elapsed_is_an_age`).
- `docs/architecture/RTOS-DEBUGGER-PROBES.md`: both probe sections kept — the deploy
  actuator's and the workspace transfer's.

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

CI's warning ratchet caught three warnings my canary merge introduced (75 → 78):
an `unused_imports` on `same_commit` (left behind when `request_for_tip` was
deleted as superseded by canary's `request_to_persist`), and `dead_code` on two
`ActuateOutcome` payloads the caller never read. The payloads only started
warning once this module became `pub(crate)` — a `pub` item is exempt, which is
exactly how unread machinery hides in a public surface.

Silencing either would have been the wrong fix. The honest one is that the caller
should read them: the tick now emits ONE `deploy.actuate.decision` row saying what
the action did — deferred and to which owner, spawned at which attempt and by
which mode, spawn_failed with the error, or skipped with the decision that skipped
it. A deploy that is wanted but not taken is no longer silent, which is the whole
point of the card; before this, only the spawned-with-a-child case said anything.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply merged commit 6bcd3b3 into canary Sep 20, 2026
6 checks passed
@joelteply
joelteply deleted the feat/deploy-actuator-the-core-acts-on-its-own-request branch September 20, 2026 23:40
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