Skip to content

A page-in resumes at the end of her view, not the shared head (card 3512f496) - #5506

Merged
joelteply merged 1 commit into
canaryfrom
fable/checkpoint-at-view-end
Oct 27, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fable/checkpoint-at-view-end

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Serves the residents' speed: when her KV page comes back from disk, she resumes where her next prompt diverges, not at the shared ~11k head (path step 1 "Fast", order-of-work line 2 "live reuse >= 80%").

Stacked after #5503. The pin moves to f291f6e7f (CambrianTech/llama.cpp#76), which is cherry-picked onto Cormac's 7d8bff696. Merge #5503 first; if it changes, I'll rebase this.

The measurement (M5, 2026-10-26 22:00Z-00:30Z)

Over 427 engine resumes, 36.4% of all prefill tokens (2.67M) came from one case: after a page-in, her prompt matched 33-89k tokens deep, but the only usable checkpoint was the ~11k head. 107 of 161 page-ins chose the head; 85 of those had matched more than 20k. The cause is PAGE_CHECKPOINTS_NEWEST = 4. The engine checkpoints this hybrid model at the last user message and a few tokens before the prompt end, so the 4 newest checkpoints all sit inside the closing block the next act rebuilds. Warm slots, which hold ~15 checkpoints, resumed within ~2k of lcp. So the right checkpoint existed and the page dropped it.

The change

  • TextGenerationRequest.view_messages is how many leading messages are her view; deliberation sets it from refit.grounding_at. request_body::wire_messages_marking converts it to wire messages, because tool replies regroup on the wire. The position is taken before held replies are flushed, so that prefix is resent byte for byte. The field is sent only to llama.cpp-family servers.
  • The fork checkpoints her state exactly at the view end, and a page keeps the head, that checkpoint, and the ones made for the prompt's end. The choice is by position, not by count: turn_admission::page_body is one owner shared by the quote and the write, and it replaces the constant. keep_newest_checkpoints: 0 is there for an engine that predates the field: it saves the head alone, never all 27 checkpoints (11.4 GB).
  • serving-replay sends the same page body.
  • Tests:
    • wire prefix and llama.cpp-only (request_body);
    • quote and write send the same subset (turn_admission fixture);
    • the pinned engine reads both fields (vendor_pin);
    • test_view_end_position in the fork.
  • Mechanical: view_messages: None added to 27 request literals. Lines: +210 / -58.

Validator (seconds, no residents): ckpt_validator.py replays the joined page-ins

118 of 162 page-ins joined to their captures. In 107 the prompt diverged at the start of the per-act tail. In tokens, the view end there is the engine's lcp minus a few tokens of shared wrapper and text. As a cross-check, a chars-only estimate of the same position is within a median of 46 tokens of lcp (p10 -1942, p90 +431).

resumed at the ~11k head with >20k matched median resumed / matched page-in prefill tokens
before (head + newest 4) 58 of 118 68% 2,957,079
after (head + view end + prompt end) 0 of 118 100% 1,074,634

Saved: 1.88M prefill tokens, 64% of those page-ins' prefill. This assumes the engine maps the view end, which the smoke below shows on a ChatML hybrid model.

Checks run (worktree, Metal)

  • cargo check --tests on the touched crates: clean, and no new warnings in touched files.
  • continuum-engine lib: 1355 passed. Deliberation faculty: 91 passed. serving-replay: 8 passed. source-hygiene: 68 passed. Ratchets vs origin/canary: exit 0, every count flat.
  • llama.cpp Release + Metal: llama-server and test-chat build; test-chat and test-json-schema-to-grammar pass.
  • Smoke on qwen35-0.8b (hybrid), engine at f291f6e7f: page keeps 4 of 5 checkpoints at n_tokens = [10, 5322, 5816, 5834] (view end = 5816, ...). After erase and restore, the next act resumed at 5816 (lcp 5819) and prefilled 32 of 5848 tokens.

Measured (after deploy)

Owner: Fable. On the M5 after deploy, read the engine log for:

  1. page keeps ... (view end = X ...) on page saves, and resumes after a page-in choosing n_tokens near the view end rather than ~11k;
  2. prefill seconds per act and engine reuse before and after, as a 15-minute live read.

The card stays open until those receipts are posted.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac at 123e553 (with fork CambrianTech/llama.cpp#76 at f291f6e7f): source PASS, on CI green. CI had only just started when I read it (1 pass).

Verified by reading:

  • Core: the right source. view_messages comes from view.refit.grounding_at (verdict/contribute.rs:266). That is the epoch's own boundary between her append-only view and this act's fresh tail, rebased by fit.rs on a refit, and 0 is filtered out.
  • Core: input index mapped to wire position. wire_messages_marking marks before held tool-reply observations are flushed, so the wire prefix it names depends on messages[..mark] alone. The test proves the next act resends that prefix byte for byte, and that the field reaches only llamacpp_sampling_extensions gateways.
  • Engine: the boundary. view_end_position returns the start of the span opened by message n_view. When that message opens no span, as with Qwen's grouped tool replies inside one user block, it returns the start of the span it continues, never past the boundary. If the spans don't line up one to one with the span-opening messages (with one optional trailing generation span allowed), it refuses with a warning and the prompt gets no view-end checkpoint. test-chat exercises it 10 times.
  • Engine: the checkpoint. The batch fill breaks at view_end_pos, so the next batch starts there. is_view_end keeps do_checkpoint through both the mid-prompt skip and checkpoint_min_step, so the checkpoint lands exactly at the view end.
  • Engine: the page subset. With keep_view_checkpoints, a page keeps the head, the newest checkpoint at or before view_end, and those at or after end_from. A slot with no prompt since a restore (end_from < 0) keeps them all. view_end/end_from travel with server_prompt through clone and reset in clear.
  • Backward-compatible page body. keep_newest_checkpoints: 0 beside the new flag means an engine predating it saves the head alone, never every checkpoint.

Non-blocking:

  • The SRV_WRN on a misaligned template fires on every request for that template. On a node serving a template this rule doesn't describe, that's one warning line per act. Rate-limiting it is cheap if it turns up in a log.
  • The body cites ckpt_validator.py for the replay validator. It isn't in this PR, so I take it as an offline analysis script, not part of the build or serving path.

…512f496)

A resident's saved page kept the head plus the 4 newest context checkpoints. On the hybrid
Qwen3.6-35B-A3B the newest four sit inside the closing block the next act rebuilds, so 107 of
161 page-ins on the M5 (2026-10-26) resumed from the ~11k head with 33-89k tokens matched:
36% of all prefill.

The request now carries view_messages (how many leading messages are her view); the body
maps it to wire messages (tool replies regroup) and our fork checkpoints her state exactly
there. A page keeps the head, the checkpoint at the view end and those made for the prompt's
end, by position (turn_admission::page_body, shared by quote and write), replacing
PAGE_CHECKPOINTS_NEWEST. The pin moves to the fork commit that does this, stacked on
7d8bff696 (#5503).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the fable/checkpoint-at-view-end branch from 123e553 to c00cb4e Compare October 27, 2026 02:30
@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac at c00cb4e: PASS, on CI green. Checked the three rebase claims:

@joelteply
joelteply merged commit 46bc043 into canary Oct 27, 2026
34 checks passed
@joelteply
joelteply deleted the fable/checkpoint-at-view-end branch October 27, 2026 02:44
joelteply added a commit that referenced this pull request Oct 27, 2026
…e (card 28463ba7) (#5521)

Serves every node's residents: a node runs the fixes only once its deploy tracker authorizes a
published build. On enrico 2026-10-27 no canary commit after e653e46 could be authorized while
#5506/#5508/#5510/#5515 merged.

The cause: "Warm the shared Rust build cache" was a job of Continuum Rust Tests, with a job-level
concurrency group per branch. A newer canary push cancels the older queued warm-up, and that job's
check run concludes `cancelled`, which parse_tip_checks counts as Red (hard_fail), so a commit
whose real tests were green read red (791328a, 8d6656f). The warm-up gates nothing ("a failed
warm-up only leaves the previous cache").

The job moves unchanged into its own workflow, .github/workflows/rust-warm-cache.yml (same
trigger: push to canary; same CARGO_INCREMENTAL), and that path joins NON_DEPLOY_WORKFLOW_PATHS
beside core-binaries and promote-main: excluded by its own suite, the existing rule.

Fixtures: cancelled warm-up + green tests = Green; queued warm-up + green tests = Green; green
warm-up + CANCELLED real test = Red; warm-up as the only suite = Unknown. Mutation: with the path
removed from NON_DEPLOY_WORKFLOW_PATHS the test fails at its first assertion.


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