Repository navigation
A shutdown save never checkpoints a bucket an operation still holds: no lost retire or candidate - #6223
Merged
joelteply merged 1 commit intoNov 22, 2026
Conversation
…no lost retire or candidate 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. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply
deleted the
3326eb71/trainer-shutdown-save-state-s-quiesce-ra
branch
November 22, 2026 14:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Co-Authored-By: Claude Opus 5.5 (1M context) [email protected]
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE