Skip to content

A page save behind another slot's prefill is not a stopped engine: one no-movement window for every engine wait (card 0b52b957) - #5462

Merged
joelteply merged 2 commits into
canaryfrom
0b52b957/no-movement-window
Oct 26, 2026
Merged

joelteply merged 2 commits into
canaryfrom
0b52b957/no-movement-window

Conversation

@joelteply

@joelteply joelteply commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Serves plan line 3b and the "Fast" step: a mind's KV page has to survive a switch. A refused save means her next turn re-prefills from cold, minutes on a CPU node.

The incident (enrico, 2026-10-26 07:59-08:59Z, probes)

  • Engine: qwen2.5-coder-1.5b Q4_K_M, --parallel 2, --ubatch-size 2048. Measured prefill 10.4-15.4 tok/s, so one batch is ~130-200 s.
  • 3 of 3 page-save quotes were refused with "engine stopped progressing before it quoted", each 15-17 s after the other slot began a long prefill:
    • 08:12:01 slot 1 prefilling 21,355 tokens; slot 0 refused at 08:12:18;
    • 08:30:14 Iris's 15,755-token prefill (190 s); slot 1 refused at 08:30:29;
    • 08:41:00 the same shape.
  • Each refusal was followed by a page_on_disk_unconfirmed cold turn (08:14, 08:34, 08:54).

Cause

/slots counters advance one batch at a time (n_prompt_tokens/n_prompt_tokens_processed jump when a batch is assembled, then hold through its decode). wait_while_engine_progresses ended a wait at its first checkpoint when a slot was processing and nothing had moved. The page switch checkpoints at 3x its measured p90 (16.8 s here), shorter than one batch.

Fix: one owner

sse_stream::work_window (#4506) already answered "how long may a processing engine stay unmoved": two batches at the measured prefill rate, never less than the floor, capped at the act ceiling. It moves to llama_server::progress::unmoved_window, and every wait that reads /slots uses it:

  • WaitBounds { checkpoint, unmoved }. From<Duration> sets both to the bound, so existing callers and their tests keep the strict reading unchanged.
  • Page switches (quote, save and restore receipts) use WaitBounds::for_model(bound, endpoint.launched_model()). The model comes from the launch contract, ready or not, so a relaunch drain's saves are covered.
  • Header wait uses WaitBounds::for_model(header_bound, model). It is never shorter than before.
  • Stream starvation check calls unmoved_window directly (net -50 lines in sse_stream.rs).
  • The kv_page.admission_refused and kv_page.busy_not_dead probes carry unmoved_ms.

Bounds hold. Without a measured rate the window is the floor, as today. A vanishing rate is capped at UNMOVED_CEILING (the act ceiling), never an open wait. A receipt that lands always wins. A dead or unreachable engine still ends at its checkpoint.

Measured

IntelMac, base 9cf91c6, cargo test -p continuum-engine --lib --features test-fixtures,metal -- progress turn_admission sse_stream lane_send: 33 passed, 0 failed. New fixture a_switch_behind_a_slow_batch_rides_it_and_a_stuck_engine_still_ends (enrico timings: 16.83 s checkpoint, 10.4 tok/s, a 190 s batch) checks four cases:

  • served behind the batch;

  • a mid-window receipt wins;

  • a never-moving engine ends within one checkpoint of the window;

  • a plain Duration is still stuck at once.

  • Mutation: restoring "processing and unmoved is stuck at once" fails the fixture with a switch behind a 190 s batch is served, not refused.

  • source-hygiene: 60/60.

  • No new warnings in the touched files.

  • Not run locally: the pre-push hook's clippy step (AIRC_CARGO_GATE_CLIPPY=0), because a Metal clippy of the engine on this node outlasts the session's tool limit. CI's checks are the gate.

Live receipt (owner: Cormac, deadline 24 h after deploy on enrico). Counts per hour at the same residents, before (07:59-08:59Z today) and after. Each remaining failure is classed, so none is mislabelled as fixed (Codex on #5462):

  • kv_page.admission_refused "stopped progressing" (before: 3), split by unmoved_ms. A refusal whose unmoved_ms equals its bound is floor-dominated: either no rate was measured, or a fast rate made two batches no longer than the floor. The probe doesn't record which (Codex on A page save behind another slot's prefill is not a stopped engine: one no-movement window for every engine wait (card 0b52b957) #5462); the node's serving.prefill_rate probes for the same hour decide it.
  • page_on_disk_unconfirmed cold turns (before: 3).
  • kv_page.busy_not_dead runs that still end uncertain. The Busy (probe timeout) branch keeps its 8 quiet checkpoints and is not changed here.
  • Waits whose model or rate moved mid-wait. Both are sampled once at entry.

Known bounds, not changed here: a Busy probe keeps the quiet-checkpoint budget (8 for pages). With no measured rate, the window is the old strict one. The ceiling caps the rate-derived part, not a caller's own floor (documented, and pinned by a test).

Removed: sse_stream::work_window and its rate lookup (moved, not copied). Added: ~110 lines, mostly doc and one fixture.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

…e no-movement window for every engine wait (card 0b52b957)

enrico, 2026-10-26 07:59-08:59Z: 3 of 3 page-save quotes were refused 15-17 s after the other
slot began a 2,048-token batch at 10.4-15.4 tok/s (~130-200 s per batch), each mind cold on
her next turn (page_on_disk_unconfirmed at 08:14, 08:34, 08:54). The engine's /slots counters
advance a whole batch at a time, and wait_while_engine_progresses ended any wait at its first
checkpoint when a slot was processing and nothing had moved. The page switch checkpoints at
3x its measured p90 (16.8 s there), far shorter than one batch.

sse_stream already owned the right answer, "two batches at the measured prefill rate, never
less than the floor, capped at the act ceiling" (work_window, #4506). It moves into
llama_server::progress as unmoved_window, the one authority for how long a processing engine
may stay unmoved, and every wait that reads /slots uses it:
- WaitBounds { checkpoint, unmoved }: a plain Duration converts to both (the old strict
  reading), so callers that pass a bound are unchanged;
- page switches (quote, save, restore receipt) pass WaitBounds::for_model(bound, the
  endpoint's launched model), read from the launch contract so a relaunch drain's saves
  are covered too;
- the header wait passes WaitBounds::for_model(header_bound, its model);
- the stream's starvation check calls unmoved_window directly.
The refusal and busy probes now carry unmoved_ms.

Tests (IntelMac, metal + test-fixtures, 33 passed):
- a save behind a 190 s batch is served;
- a receipt landing mid-window wins;
- a never-moving engine ends within one checkpoint of the window;
- a plain Duration is still stuck at once;
- the moved window test covers no rate (floor) and a vanishing rate (capped).
Mutation: restoring "processing and unmoved is stuck at once" fails the enrico fixture
("a switch behind a 190 s batch is served, not refused"). source-hygiene 60/60.

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

Copy link
Copy Markdown
Contributor Author

PASS for exact head 4d8a321. Reviewed shared WaitBounds and unmoved_window, page quote/save/restore and header wiring, retained stream behavior, terminal receipt priority, and slow-batch/stuck-engine regressions. The floor-precedence clarification and test resolve the review note. Independently verified all 18 selected checks succeeded, including core and engine; skipped jobs are not validation.

No remaining source/integration-review blocker. This is not a deployed recovery receipt. Live validation must separate floor-dominated waits (no rate OR a fast measured rate), Busy-probe exhaustion, and entry-sampled model/rate, then compare save/restore failures and cold turns against the recorded enrico hour.

@joelteply
joelteply merged commit a14c8a0 into canary Oct 26, 2026
22 checks passed
@joelteply
joelteply deleted the 0b52b957/no-movement-window branch October 26, 2026 09:59
joelteply added a commit that referenced this pull request Oct 26, 2026
…nly the judged lock is unlinked (Codex on #5464)

Holder matching: may_work_on (pure) judges a git by every way it can name the tree: cwd inside
the work root or the administrative gitdir, --git-dir/--work-tree/-C arguments, or
GIT_DIR/GIT_WORK_TREE in its environment, each as given or canonical. A git launched from
elsewhere with --git-dir=<a worktree's gitdir> names no work root, and was read as absent. An
unreadable cwd is still "may be working here". git_running_in(root, gitdir) reads cmd, cwd and
environ.

Replacement race: settle records the lock's file identity (continuum_host::file_identity) before
the scan and re-reads it before unlinking; a lock re-created in between is another file and is
left in place.

Tests: a_git_naming_the_tree_any_way_may_hold_its_lock (--git-dir, GIT_DIR, -C, cwd in root,
cwd in gitdir, unreadable cwd; another tree's GIT_DIR is not a holder); the worktree fixture
pins that a re-created lock reads as another identity. continuum-git now depends on
continuum-host, so a host change selects it (selector test updated, passes). Not built
locally: no cargo on enrico during the #5462 receipt window; CI compiles and tests it.

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 Oct 26, 2026
…m; the judged lock stays open until the unlink (Codex on #5464)

may_work_on resolves path-valued options against the cwd after each ordered -C (=value and
separate forms) and GIT_DIR/GIT_WORK_TREE against both the process cwd and the final -C
directory, normalizing . and .. lexically. Regressions: relative --git-dir (both forms),
relative GIT_DIR, -C then relative --git-dir, ordered -C into the root, a .. path, and a
relative path naming another tree (not a holder).

settle keeps the judged lock's handle open through revalidation and the unlink, so its
identity cannot be reused by a re-created file. The test now holds the handle rather than
assuming a fresh inode. The doc states the remaining window: a replacement landing between the
last identity read and the unlink would be removed (portable code cannot unlink by handle).
Not built locally (no cargo on enrico during the #5462 receipt window); CI compiles it.

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 Oct 26, 2026
…nly the judged lock is unlinked (Codex on #5464)

Holder matching: may_work_on (pure) judges a git by every way it can name the tree: cwd inside
the work root or the administrative gitdir, --git-dir/--work-tree/-C arguments, or
GIT_DIR/GIT_WORK_TREE in its environment, each as given or canonical. A git launched from
elsewhere with --git-dir=<a worktree's gitdir> names no work root, and was read as absent. An
unreadable cwd is still "may be working here". git_running_in(root, gitdir) reads cmd, cwd and
environ.

Replacement race: settle records the lock's file identity (continuum_host::file_identity) before
the scan and re-reads it before unlinking; a lock re-created in between is another file and is
left in place.

Tests: a_git_naming_the_tree_any_way_may_hold_its_lock (--git-dir, GIT_DIR, -C, cwd in root,
cwd in gitdir, unreadable cwd; another tree's GIT_DIR is not a holder); the worktree fixture
pins that a re-created lock reads as another identity. continuum-git now depends on
continuum-host, so a host change selects it (selector test updated, passes). Not built
locally: no cargo on enrico during the #5462 receipt window; CI compiles and tests it.

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 Oct 26, 2026
…m; the judged lock stays open until the unlink (Codex on #5464)

may_work_on resolves path-valued options against the cwd after each ordered -C (=value and
separate forms) and GIT_DIR/GIT_WORK_TREE against both the process cwd and the final -C
directory, normalizing . and .. lexically. Regressions: relative --git-dir (both forms),
relative GIT_DIR, -C then relative --git-dir, ordered -C into the root, a .. path, and a
relative path naming another tree (not a holder).

settle keeps the judged lock's handle open through revalidation and the unlink, so its
identity cannot be reused by a re-created file. The test now holds the handle rather than
assuming a fresh inode. The doc states the remaining window: a replacement landing between the
last identity read and the unlink would be removed (portable code cannot unlink by handle).
Not built locally (no cargo on enrico during the #5462 receipt window); CI compiles it.

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 Oct 26, 2026
…nly the judged lock is unlinked (Codex on #5464)

Holder matching: may_work_on (pure) judges a git by every way it can name the tree: cwd inside
the work root or the administrative gitdir, --git-dir/--work-tree/-C arguments, or
GIT_DIR/GIT_WORK_TREE in its environment, each as given or canonical. A git launched from
elsewhere with --git-dir=<a worktree's gitdir> names no work root, and was read as absent. An
unreadable cwd is still "may be working here". git_running_in(root, gitdir) reads cmd, cwd and
environ.

Replacement race: settle records the lock's file identity (continuum_host::file_identity) before
the scan and re-reads it before unlinking; a lock re-created in between is another file and is
left in place.

Tests: a_git_naming_the_tree_any_way_may_hold_its_lock (--git-dir, GIT_DIR, -C, cwd in root,
cwd in gitdir, unreadable cwd; another tree's GIT_DIR is not a holder); the worktree fixture
pins that a re-created lock reads as another identity. continuum-git now depends on
continuum-host, so a host change selects it (selector test updated, passes). Not built
locally: no cargo on enrico during the #5462 receipt window; CI compiles and tests it.

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 Oct 26, 2026
…m; the judged lock stays open until the unlink (Codex on #5464)

may_work_on resolves path-valued options against the cwd after each ordered -C (=value and
separate forms) and GIT_DIR/GIT_WORK_TREE against both the process cwd and the final -C
directory, normalizing . and .. lexically. Regressions: relative --git-dir (both forms),
relative GIT_DIR, -C then relative --git-dir, ordered -C into the root, a .. path, and a
relative path naming another tree (not a holder).

settle keeps the judged lock's handle open through revalidation and the unlink, so its
identity cannot be reused by a re-created file. The test now holds the handle rather than
assuming a fresh inode. The doc states the remaining window: a replacement landing between the
last identity read and the unlink would be removed (portable code cannot unlink by handle).
Not built locally (no cargo on enrico during the #5462 receipt window); CI compiles it.

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 Oct 26, 2026
…mes it (card e1a5a21a) (#5468)

* The no-movement window takes the SLOWER measured prefill rate, and names it (card e1a5a21a)

#5462 follow-up, measured on enrico 2026-10-26 13:15-14:15Z (0eeceda): 3 page-save quotes
were still refused as "stopped progressing", with unmoved_ms 23,571 / 59,427 / 64,419. The
per-request prefill rate read 9.7-16.2 tok/s (serving.prefill_rate.moved at 13:17, 13:28 and
14:13), so two 2,048-token batches take 250-420 s; the windows used imply 64-174 tok/s, the
server-total rate unmoved_window preferred. Each refusal cost a mind her page.

The errors are not symmetric: a window too long only delays calling a stuck engine (capped by
UNMOVED_CEILING); a window too short refuses a working engine. window_rate (pure) takes the
slower usable measurement and says which. WaitBounds carries the rate and its source, and the
kv_page admission_refused and busy_not_dead probes report them. This reverses #4506's
server-total preference, which assumed a long window was the costly error.

Test: the_window_is_sized_from_the_slower_measured_rate (enrico's numbers: 9.7 vs 68 tok/s gives
a >400 s window; the old choice gave ~60 s). Not built locally: no cargo on enrico while
residents serve; CI compiles and tests it.

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

* window docs: 250-420 s is TWO batches; one batch is 125-210 s at 9.7-16.2 tok/s (Codex on #5468)

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 Oct 26, 2026
…r, continuum-git, for the deploy tree and her hands (card d7765b90) (#5464)

* A dead git's index.lock no longer blocks a citizen for days: one owner, continuum-git, for the deploy tree and her hands (card d7765b90)

On enrico (2026-10-26) 6 residents' workspaces held .git/index.lock dated 10-14..16, empty, held
by no process. Every git write failed ("Unable to create .../index.lock: File exists") for
~10 days until Eitan reported it; I removed them by hand. The deploy consumer had the same
failure on the M5 (card 677437fa) and solved it for its own tree only.

The likely source is our own deadline: run_git_input's owner kills a git that outlives its
deadline (Why::TimedOut), and a killed git leaves its lock.

continuum-git::index_lock is now the one owner (moved, not copied):
- the verdict (stale only when older than the caller's bound AND no git might work in the tree);
- the conservative live-git scan (moved from bin/continuum deploy_ledger);
- a lock locator that needs no git process (clone or worktree .git file);
- settle(), which judges and removes.
Users:
- the deploy consumer's settle_index_lock is a thin mapping of settle() onto its notes; the
  verdict, enum, bound and test leave cli-lifecycle's deploy_tracker;
- a citizen's git (git_bridge::run_git_input) settles before every git with the 10-min bound,
  and with a zero bound right after it ends a git on its deadline (that lock is that git's
  unless another git now works in the tree). The scan runs in spawn_blocking and only when a
  lock exists, and each outcome is probed (hands.git.index_lock_{held,cleared,unremovable}).

The new crate is in all four lists (TESTED_CRATES with no fixtures feature, the crate-test
allowlist, MODULE_CRATES via its index_lock.rs module, the warnings count). The selector test
names the floor (base, host, git) once and pins a git change's scope.

Local (IntelMac, before stopping builds here): continuum-git 2/2; selector tests pass.
cli-lifecycle 83/84, one failure in installed_release (untouched by this change, judged by CI).
hands and core compile and test in CI: local builds were stopped on this CPU-serving node
after they coincided with serving.throughput.degraded.

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

* index_lock: a git naming the tree by its gitdir holds its lock, and only the judged lock is unlinked (Codex on #5464)

Holder matching: may_work_on (pure) judges a git by every way it can name the tree: cwd inside
the work root or the administrative gitdir, --git-dir/--work-tree/-C arguments, or
GIT_DIR/GIT_WORK_TREE in its environment, each as given or canonical. A git launched from
elsewhere with --git-dir=<a worktree's gitdir> names no work root, and was read as absent. An
unreadable cwd is still "may be working here". git_running_in(root, gitdir) reads cmd, cwd and
environ.

Replacement race: settle records the lock's file identity (continuum_host::file_identity) before
the scan and re-reads it before unlinking; a lock re-created in between is another file and is
left in place.

Tests: a_git_naming_the_tree_any_way_may_hold_its_lock (--git-dir, GIT_DIR, -C, cwd in root,
cwd in gitdir, unreadable cwd; another tree's GIT_DIR is not a holder); the worktree fixture
pins that a re-created lock reads as another identity. continuum-git now depends on
continuum-host, so a host change selects it (selector test updated, passes). Not built
locally: no cargo on enrico during the #5462 receipt window; CI compiles and tests it.

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

* index_lock: relative --git-dir/-C/GIT_DIR resolve as git resolves them; the judged lock stays open until the unlink (Codex on #5464)

may_work_on resolves path-valued options against the cwd after each ordered -C (=value and
separate forms) and GIT_DIR/GIT_WORK_TREE against both the process cwd and the final -C
directory, normalizing . and .. lexically. Regressions: relative --git-dir (both forms),
relative GIT_DIR, -C then relative --git-dir, ordered -C into the root, a .. path, and a
relative path naming another tree (not a holder).

settle keeps the judged lock's handle open through revalidation and the unlink, so its
identity cannot be reused by a re-created file. The test now holds the handle rather than
assuming a fresh inode. The doc states the remaining window: a replacement landing between the
last identity read and the unlink would be removed (portable code cannot unlink by handle).
Not built locally (no cargo on enrico during the #5462 receipt window); CI compiles it.

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

* index_lock: a relative --git-dir resolves against the directory after ALL -C options, as git does (Codex on #5464)

Regression: git --git-dir=.git/worktrees/tree -C /repo status from /elsewhere names
/repo/.git/worktrees/tree. The directory where the option sits is kept too, conservatively.

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

* index_lock: the race comment states the residual window as a limitation, and no age claim on the zero-bound path (Codex on #5464)

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