Skip to content

A deploy defers on the node's in-engine training hold instead of killing the run (card 9beab2da) - #5551

Merged
joelteply merged 4 commits into
canaryfrom
9beab2da/a-deploy-defers-on-the-node-s-in-engine
Oct 28, 2026
Merged

joelteply merged 4 commits into
canaryfrom
9beab2da/a-deploy-defers-on-the-node-s-in-engine

Conversation

@joelteply

@joelteply joelteply commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

How this serves the minds: a persona's training run is unfinished work, and a deploy shouldn't kill it. With this change a deploy waits for the run instead of ending it. This advances the lifecycle work (deploys that preserve work) and goal 8, whose training runs are what was being killed.

Why (receipts from Codex, the Windows 5090, 2026-10-28)

  1. The kill: the supported consumer adopted 84386a at 02:31:56. At that moment serving/status read held_for genome-train:8b46862c (since 02:09:46, A node held for resident work says so: serving/status and the hourly health carry the hold (card a18452d6) #5543), and the run was at 41%. The job journal reads FAILED "killed-by-reboot (legacy journal receipt)".
  2. Why the guard missed it: the consumer hands off through reboot(RebootOptions { force: false, .. }) (deploy_consume.rs:371), so it inherits reboot's guards. Those knew only mlx_lm pids (processes.rs:38) and eval markers. Nothing read the engine's own hold.
  3. Why it matters most on Windows: the engine runs inside the core's KILL_ON_JOB_CLOSE job (An engine whose launch timed out but came up late is finished as the same generation (card ea6c9aff) #5545's trace), so a core restart always ends an in-engine run there.

Change (reworked at 04b1aa4 after Codex's review of 6e6a4a1)

  • ServingHold::live_work (continuum-engine serving_hold.rs): the live work a handoff would end, named by consumer, base and engine. It returns None for an unknown cause or for no work.
  • deploy_hold (continuum-cli-lifecycle, beside core_bind_guard): the pure verdict over HoldObservation { NoCore, Free, LiveWork, Unreadable }.
    • Only Free and NoCore proceed on their own.
    • LiveWork and Unreadable defer. A slow or undecodable read on a live core is unknown, never "nothing held" (Codex).
    • --force proceeds through either, and says what it ends or that it couldn't know.
  • reboot(): observe_engine_hold always reads serving/status, --force included, so a forced handoff leaves a receipt. A failed read counts as NoCore only when no core process is alive (running_core_pids); otherwise it is Unreadable.
  • PublishedCoreError::Held (continuum-cli-lifecycle) and deploy_consume::handoff_refusal: the pure charge for a refused handoff (Deferred / Blocked / Failed), extracted from the consumer pass with its behaviour unchanged. Held is Blocked: rechecked on the next pass, no attempt charged, no durable deferral.

Scoped out (named)

The race: a job admitted after the hold read and before stop_with_authority's teardown is still killed. That's card 91921d0f: the handoff closes training admission (a typed, reversible "handoff pending") before its hold read, with S7 stop-drain (card 920619c5).

Policy (Codex agreed)

The guard applies on every OS until engine preservation across a handoff is proven, and there's no time bound in it. The refusal names the work and is visible in serving/status; --force is the override.

Tests

Test What it pins
serving_hold::only_resident_work_is_live_work_a_handoff_would_end Resident work is named. An unknown cause or empty work names nothing.
deploy_hold::only_a_confirmed_absence_of_work_proceeds_and_force_names_what_it_ends Free and NoCore proceed. LiveWork and Unreadable defer. --force names the work it ends, or says it proceeds without knowing.
deploy_consume_tests::a_held_handoff_charges_no_attempt_and_keeps_no_deferral Held and SourcePending are Blocked, Artifact is Failed, and OperationalBlocked stays a durable Deferred (OperationalUncertainty).
  • Local results (macOS x86_64): engine serving_hold 7 passed; lifecycle deploy_hold 1 passed.
  • CI only: the continuum-core consumer test runs in CI only on this node.
  • Ratchets: 68/68 (exit 0).

Measured after deploy

Owner: Cormac, with Codex reading the consumer. When: the next deploy request that arrives while a node trains in-engine.

What it should show: deploy resource custody refused: the engine is held for live work (genome-train:<job> …); no build failure charged, the run finishing, and then the handoff.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

…ing the run (card 9beab2da)

The windows 5090, 2026-10-28: the supported consumer adopted 84386a at 02:31:56 while
serving/status read held_for genome-train:8b46862c (#5543), and killed its in-engine
run at 41%. The consumer hands off through reboot(force: false), whose guards knew only
mlx_lm pids and eval markers; nothing read the engine's own hold.

- ServingHold::live_work (continuum-engine): the live work a handoff would end, named
  by consumer, base and engine; None for an unknown cause (not evidence of work) or no
  work.
- reboot(): beside the trainer and eval guards, reads the running core's serving/status
  and refuses as PublishedCoreError::Held when it names live work; --force ends it. No
  core answering, or an unreadable snapshot, proceeds and says so: no running core holds
  anything this handoff could end, and the deploy may be its repair.
- PublishedCoreError::Held (continuum-cli-lifecycle): the consumer records it as a
  resource refusal with no attempt charged and no durable deferral, so it rechecks on
  its next pass (a plain error would charge HandoffFailed and give up after three).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply and others added 3 commits October 27, 2026 23:51
…hat it ends, and a Held refusal is tested to charge nothing (Codex on #5551)

At 6e6a4a1 a serving/status read that timed out or did not decode collapsed into
"nothing held", so a busy training core could still be killed because the guard's read
failed; --force skipped the read, ending work with no receipt.

- deploy_hold (continuum-cli-lifecycle, beside core_bind_guard): the pure verdict over
  HoldObservation { NoCore, Free, LiveWork, Unreadable }. Only Free and NoCore proceed
  on their own; LiveWork and Unreadable defer; --force proceeds through either and says
  what it ends, or that it could not know.
- reboot(): observe_engine_hold reads serving/status always (forced too). A failed read
  is NoCore only when no core process is alive (running_core_pids), else Unreadable.
- deploy_consume: handoff_refusal, the pure charge of a refused handoff (Deferred /
  Blocked / Failed), extracted from the pass with its behaviour unchanged; Held is
  Blocked (no attempt charged, no durable deferral).

The race between the hold read and the teardown (a job admitted in between) is scoped
to card 91921d0f, with S7 stop-drain (920619c5).

Tests: deploy_hold::only_a_confirmed_absence_of_work_proceeds_and_force_names_what_it_
ends (local); deploy_consume_tests::a_held_handoff_charges_no_attempt_and_keeps_no_
deferral (CI).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
… one (Codex on #5551)

At 04b1aa4 a serving/status hold that decoded with by = Unknown (its residency record
unreadable) went live_work -> None -> Free, so the handoff proceeded past work it could
not see. observation_of (reboot.rs, pure) maps a decoded hold: none is Free, resident
work is LiveWork, an Unknown cause is Unreadable (deferred, --force overrides).

Test: reboot_tests::a_decoded_hold_of_unknown_cause_is_unreadable_never_free, from
held_for's own wire JSON (resident, unknown, empty).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…t name (Codex on #5551)

The job's exact list held seven tests and neither new one, so a green job never ran them:
tests::reboot_tests::a_decoded_hold_of_unknown_cause_is_unreadable_never_free and
tests::deploy_consume_tests::a_held_handoff_charges_no_attempt_and_keeps_no_deferral. Each
must report '1 passed' or the job fails.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply
joelteply merged commit a035f35 into canary Oct 28, 2026
33 checks passed
@joelteply
joelteply deleted the 9beab2da/a-deploy-defers-on-the-node-s-in-engine branch October 28, 2026 05:19
joelteply added a commit that referenced this pull request Oct 28, 2026
…ad, so no run starts between the guard and the stop (card 91921d0f) (#5553)

* A core handoff closes in-engine training admission before its hold read, so no run starts between the guard and the stop (card 91921d0f)

Codex on #5551: the deploy's hold guard was one preflight read, so a training run
admitted after it and before the stop was still killed.

- Engine (serving_lifecycle + new serving_lifecycle/handoff.rs): LifecycleGate holds a
  reversible handoff close owned by a process (pid + OS start time).
  close_for_handoff takes the gate, so an admission deciding now finishes and publishes
  its hold first; every later admission is refused GateRefusal::Handoff (a wait, never a
  failure) until reopen_after_handoff(token) or the owner's verified death (a reused pid
  is dead; an unreadable table is not). A stale token never reopens a newer close.
- serving/handoff-close {ownerPid} -> Closed{token} | Busy (a serving operation holds
  the gate) | NoServing; serving/handoff-reopen {token} -> {reopened}. Privileged.
- deploy_hold::verdict(close, observed, force): a free hold proceeds only with admission
  closed or nothing to close; a busy or failed close defers (forceable, said); a core
  that predates the close (asked by name through its commands/list) proceeds on the read
  alone and says the window stays open.
- reboot(): closes before observe_engine_hold; a thin wrapper reopens on any error, since
  a handoff that did not stop the core must admit again (past the stop the core is gone,
  and a restored or new one boots open). running_core_call carries params;
  running_core_provenance is it with none.

Tests (local): handoff::only_a_verified_dead_owner_releases_a_close,
serving_lifecycle::a_handoff_close_refuses_admission_until_its_own_token_reopens_it
(mutant ignoring the close fails it), deploy_hold::a_free_hold_proceeds_only_with_
admission_closed_or_nothing_to_close, serving handoff::name_and_access_wired.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* One handoff closes admission at a time, the bin declares each module at its own path, and a malformed command list is a failure (Codex on #5553)

At 2e30920:
- continuum.rs put #[path = "continuum/reboot.rs"] on mod handoff_admission, leaving
  mod reboot without its path (E0583 in CI). Each module now has its own path.
- close_for_handoff replaced any standing close, so handoff B could close then reopen
  (or die) while handoff A, which had already read a free hold, went on to its stop with
  admission open. A close held by a live or unverifiable owner is now never replaced
  (HandoffCloseOutcome::Taken, serving/handoff-close -> taken{ownerPid}, which the CLI
  defers on); only a verified-dead owner's close is. Another handoff's token never
  reopens it.
- A commands/list reply without a commands array mapped to NotSupported (proceed on the
  read alone); only a well-formed list lacking the command is an older core, anything
  else is Failed (defers).

Regression: serving_lifecycle::a_second_handoff_never_releases_a_live_owners_close (a
mutant that replaces a live close fails it).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant