Repository navigation
An engine whose launch timed out but came up late is finished as the same generation (card ea6c9aff) - #5545
Merged
joelteply merged 5 commits intoOct 28, 2026
Conversation
…same generation (card ea6c9aff) Windows d85388c, 2026-10-27: engine 3548 loaded its weights from an HDD with load progress at 0.0 past wait_ready's stall allowance, so launch_prepared returned NotReady before transition.ready published the generation's pool and ledger. The engine was healthy by 22:29, but every later reconcile saw the endpoint unready, tried to replace it, and checkpoint_before_replacement -> capture_suspension refused ("cannot suspend an unknown or uncertain live ledger"): serving stayed down behind a healthy engine. - The publication tail (gates, page dir, geometry, transition.ready, the ledger stamp, the verified target) moves verbatim from launch.rs to ready_tail.rs as publish_ready (launch.rs 607 -> 394 lines). - A NotReady wait with the child alive (not restoring) keeps a LoadingLaunch. - The next launch_prepared, after its transition admits the intent and before the replacement checkpoint, finishes that engine when it is still the same one (the same generation, not exited, the same pid) and the request is the same launch (engine program, weights, model, adapters, exact LaneInvocation): it waits again and publishes through the same transition.ready. Anything else is refused, probed (serving.late_ready.refused), and the late engine is never published. No ledger is reset. Deployment boundary (traced): a restarted core adopts a healthy engine it never spawned through the normal reconcile (a new endpoint starts ready; the ledger is adopted lazily); under the Windows service the engine shares the core's kill-on-close job and dies with it, so a deploy relaunches and this recovery covers a slow load there. Fixtures: the recovery decision over every refusal; through launch_prepared, a timed-out launch's late engine is finished (same pid, the generation's ledger published) and a changed request is not (proven by mutation: with recovery disabled it fails with the Windows error string); a restarted core adopts a healthy engine it never spawned. Engine: 73 pass (late_ready + llama_server::tests), 3 runs. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
… the stand-in engine runs on every platform (Codex on #5545) - recovery_refusal returns a kind. EngineGone (another generation, exited, another pid, an unknown kept pid) drops the kept launch, whose engine can never be finished; OtherLaunch (the same live engine, a different request) refuses publication and KEEPS it, so the launch it was started for can still finish it. Before, one changed-window request dropped the only kept launch and stranded the engine forever. - wait_and_publish holds the kept launch in a guard across the readiness wait: only a finished wait consumes it, a slow wait keeps it (settle), and a cancelled wait puts it back on drop. Both the first launch and a recovery wait through it. The owned engine is read before the kept launch's lock; the locks never nest. - Fixtures through launch_prepared now use the test binary itself as the stand-in engine (re-run for one test, blocking on stdin, the retirement fixture's pattern), not `sleep`, so they run on Windows, the platform this repairs: a changed request is refused, the launch stays kept, and the original request finishes the same pid with the generation's ledger published; a recovery cancelled mid-wait keeps the launch, and once the engine is ready the next launch finishes it. Proven by mutation: dropping on OtherLaunch fails the first ("stays kept"), not reinserting on drop fails the second ("put the launch back"). Engine: 74 pass. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…its (Codex on #5545) wait_and_publish consumed the kept launch before publish_ready, whose awaits before transition.ready (weight residency, adapter scales, the /props geometry, the install receipt, the inputs) could each be cancelled and lose the only kept launch, recreating the trap. publish_ready now borrows the launch; the keeper is disarmed only once publication returns Ok (the ledger committed). A publication that fails, or is cancelled at any await before the ledger, puts the launch back while its engine lives. Fixture: a_publication_cancelled_before_its_ledger_keeps_the_launch. The engine answers ready but holds /props, so publication stalls at the geometry read; the abort there leaves the launch kept and nothing committed; once /props opens the original retry finishes the same pid with the generation's ledger published. Proven by mutation: disarming before publish fails it ("the cancelled publication put the launch back"). Engine: 75 pass. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
… they repair (Codex on #5545) Each runs --exact in the Windows engine job and must report '1 passed', so the log is execution evidence, not compilation: the changed-request, cancelled-wait and cancelled-publication fixtures (the test binary as the stand-in engine) and the restarted-core adoption. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…el (no source change) The windows-core-contract job runs on a canary PR only when it is labelled 'windows'; the label was added after 23535a9's run, and the workflow does not trigger on 'labeled'. This empty commit is the synchronize that runs it, so the late-ready fixtures execute on Windows. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply
deleted the
ea6c9aff/an-engine-whose-launch-timed-out-but-cam
branch
October 28, 2026 00:28
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.
Why
Windows, d85388c, 2026-10-27: engine 3548 (port 58057) loaded its weights from an HDD (D: is WDC WD161KFGX, MediaType HDD, per Codex's receipts). Load progress sat at 0.0 for minutes, past
wait_ready's stall allowance.launch_preparedreturnedNotReadybeforetransition.readypublished the generation's pool and ledger.The engine was healthy by about 22:29 (
/health200, mmproj 1.0). But every later reconcile saw the endpoint unready (active_model→Unreachable), tried to replace the engine, and stopped at the same refusal:checkpoint_before_replacement→capture_suspensionreturned "cannot suspend an unknown or uncertain live ledger". The only writer ofpool_generationisready(), and its only caller was that launch. So serving stayed down, with no residents, behind a healthy engine.The fix was specified by Codex: recover the same loading generation, verify generation, incarnation, intent and contract before publishing, never reset the ledger, and refuse a stale incarnation or intent.
Change
llama_server/ready_tail.rs(new): the publication tail afterwait_readymoves here aspublish_ready(&transition, ReadyTail). It is the debug-build and placement gates, the page dir, the live slot geometry,transition.ready, the ledger stamp, andrecord_verified_target. The move is verbatim;launch.rsdrops from 607 to 394 lines.llama_server/late_ready.rs(new):NotReadywait with the child alive (not a restore) keeps aLoadingLaunch(serving.late_ready.kept).launch_preparedchecks it right after its transition admits the current intent (transition_if(current)) and before the replacement checkpoint. It finishes the engine only when the owned engine is still the same one (same generation, not exited, same pid) and the request is the same launch (engine program, weights, model id, adapter paths, and the exactLaneInvocationargv and environment).transition.ready. Nothing is reset.serving.late_ready.refused), and the late engine is never published.launch.rs: wires in the two calls and the kept-launch field (process.rs).Deployment boundary (traced at file:line, Codex's question)
SlotDirectory::endpointstarts a new endpoint ready (engine_generation.rs:588), so the first reconcile'sserve_or_adoptdecode-probes the engine and returnsAlreadyServing.ensure_slot_pool→adopt_engine_ledger). A never-stamped engine gets an empty ledger stamped with its own pid and start time.KILL_ON_JOB_CLOSEjob (continuum-cli-lifecyclewindows_launch.rs:112-153, plusunelevated_service.rs), and llama-server inherits that job (prepared_launch.rs:51-54, no breakaway).Tests (
late_ready.rs, local, macOS x86_64)only_the_same_live_engine_for_the_same_launch_is_finisheda_timed_out_launch_finishes_its_late_engine_and_a_changed_request_does_notlaunch_prepared, against an axum fake engine with a live stand-in child under a started but unpublished generation.capture_suspensionrefuses before; after the same request, the same generation's ledger is published and the pid is unchanged. A changed request on another endpoint does not publish, and the engine is not killed.a_restarted_core_adopts_a_healthy_engine_it_never_spawnedensure_model_serving_if_current(AlreadyServing, no spawn).Spawn("cannot suspend an unknown or uncertain live ledger"), the exact Windows error.late_ready+llama_server::testsgave 73 passed, 3 runs in a row.pagestest's census read incomplete until I fixed it.cargo check --libis clean and the ratchets pass 68/68.Not in this PR (named follow-up)
The stall allowance itself. Llama-server's load progress can sit at 0.0 for minutes while the engine reads a cold HDD. Counting the engine's own disk reads as load progress would avoid the timeout in the first place. This PR makes a timeout recoverable; that one would make it rarer.
🤖 Generated with Claude Code
https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE