Skip to content

The training trigger drains and saves in its own phases, so its shutdown receipt is true - #5928

Merged
joelteply merged 2 commits into
canaryfrom
a13bd92a/the-training-trigger-drains-and-saves-in
Nov 11, 2026
Merged

joelteply merged 2 commits into
canaryfrom
a13bd92a/the-training-trigger-drains-and-saves-in

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

drain() stops the serving wake, admits nothing new and counts the learning operations still
running; save_state() publishes and pages out every learner whose engine is idle, leaving an
engine a step holds to that step (Busy::Skip); shutdown() joins the rest (Busy::Wait). Before,
the trigger kept the trait defaults (drain 0, save no-op), so BigMama's receipt read 'Drained'
while a step ran and the 2 s join timed out (Codex, 8bed install 2026-11-11).

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

joelteply added a commit that referenced this pull request Nov 11, 2026
…nd counts learned steps apart from attempts

Codex on #5928 at 30f89e5: stop() returned nothing on an unconfirmed unload and paged_out was
emitted unconditionally, so a failure produced success evidence for Phase 2. stop() now returns
Released {Confirmed, Unconfirmed, NotHers}; the workspace release is typed the same way; paged_out
fires only when both are confirmed (or the workspace was not hers to release), otherwise
page_out_unconfirmed. attempts (every learn request sent) and learned (steps the engine committed)
replace steps.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply
joelteply force-pushed the a13bd92a/the-training-trigger-drains-and-saves-in branch from 30f89e5 to ff3cfa5 Compare November 11, 2026 10:09
joelteply added a commit that referenced this pull request Nov 11, 2026
…nd counts learned steps apart from attempts

Codex on #5928 at 30f89e5: stop() returned nothing on an unconfirmed unload and paged_out was
emitted unconditionally, so a failure produced success evidence for Phase 2. stop() now returns
Released {Confirmed, Unconfirmed, NotHers}; the workspace release is typed the same way; paged_out
fires only when both are confirmed (or the workspace was not hers to release), otherwise
page_out_unconfirmed. attempts (every learn request sent) and learned (steps the engine committed)
replace steps.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply
joelteply force-pushed the a13bd92a/the-training-trigger-drains-and-saves-in branch from ff3cfa5 to f8dfb9b Compare November 11, 2026 10:10
joelteply added a commit that referenced this pull request Nov 11, 2026
… she learned (#5927)

* Each seated life reports what paging her in and out cost against what she learned

training.in_place.paged_out at every page-out: seat, restore, learn (and steps) and page-out
time. Live fixture (qwen2.5-0.5b, CPU): paging costs 0.25-0.4 s per pass against 4.2-10.9 s of
learning, so Phase 2's engine verbs wait for a live node's receipt (card de1a9e5a).

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

* A page-out receipt is taken only from a confirmed stop and release, and counts learned steps apart from attempts

Codex on #5928 at 30f89e5: stop() returned nothing on an unconfirmed unload and paged_out was
emitted unconditionally, so a failure produced success evidence for Phase 2. stop() now returns
Released {Confirmed, Unconfirmed, NotHers}; the workspace release is typed the same way; paged_out
fires only when both are confirmed (or the workspace was not hers to release), otherwise
page_out_unconfirmed. attempts (every learn request sent) and learned (steps the engine committed)
replace steps.

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

* test: only a confirmed page-out takes a cost receipt

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]>
joelteply added a commit that referenced this pull request Nov 11, 2026
…rides

Codex on #5928 at f8dfb9b: the earlier tests drove the state helpers, so deleting either
ServiceModule override would still pass. This one calls drain() and save_state() on the module.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply and others added 2 commits November 11, 2026 04:48
…own receipt is true

drain() stops the serving wake, admits nothing new and counts the learning operations still
running; save_state() publishes and pages out every learner whose engine is idle, leaving an
engine a step holds to that step (Busy::Skip); shutdown() joins the rest (Busy::Wait). Before,
the trigger kept the trait defaults (drain 0, save no-op), so BigMama's receipt read 'Drained'
while a step ran and the 2 s join timed out (Codex, 8bed install 2026-11-11).

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

Codex on #5928 at f8dfb9b: the earlier tests drove the state helpers, so deleting either
ServiceModule override would still pass. This one calls drain() and save_state() on the module.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply
joelteply force-pushed the a13bd92a/the-training-trigger-drains-and-saves-in branch from 43d4d6a to 25fa18c Compare November 11, 2026 10:48
@joelteply
joelteply merged commit ae5ba31 into canary Nov 11, 2026
12 checks passed
@joelteply
joelteply deleted the a13bd92a/the-training-trigger-drains-and-saves-in branch November 11, 2026 11:03
joelteply added a commit that referenced this pull request Nov 22, 2026
…no lost retire or candidate (#6223)

Card 3326eb71 (Cormac's audit, 2026-11-22; introduced in #5928): the runtime runs drain() ->
save_state() -> shutdown(), and the trigger's drain only stop_admitting()s, counting in-flight
operations without waiting. save_state's quiesce then checkpointed each seated learner holding only
the engine lock, so its commit_checkpoint -> project -> record_learned read-modify-write of whole
submission rows could race a gated operation still running on that bucket and lose a retire's
is_pending=false, or undo a record_candidate. Waiting for those operations is not an option: each
shutdown phase is under a timeout, and a cancelled quiesce is worse than the race.

Quiesce now takes each learner's bucket gate with try_acquire (never waits: it holds the engine lock,
and every pass takes a bucket gate before an engine lock). Held by an operation in flight, her
checkpoint is skipped and counted unpublished (training.in_place.shutdown_gate_held; the journal
keeps her progress), and her learner still pages out (no pass can use her under the engine lock).

Test (live_engine): a learner seated on a real engine, her bucket gate held as an operation in
flight, the save's quiesce leaves her checkpoint unpublished and still stops her. Run against
llama-server built at canary's pin 126b9c1c (CPU): live_engine 4/4. With the gate check removed,
that test fails and the other three pass. Full dreaming lib 113/113; ratchets pass.


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