Skip to content

server: placed checkpoints only with view spans, and /slots reports each slot's checkpoints (continuum 4.7.3) - #121

Closed
joelteply wants to merge 7 commits into
continuum-pin/b5534b5from
fable/slot-checkpoint-bytes
Closed

joelteply wants to merge 7 commits into
continuum-pin/b5534b5from
fable/slot-checkpoint-bytes

Conversation

@joelteply

@joelteply joelteply commented Nov 16, 2026 •

Copy link
Copy Markdown

CONTINUUM-ENGINE 4.7.3 (continuum ggml-org#6068): with view spans the engine makes no blind step checkpoints, and a new view-end checkpoint erases the ones it supersedes (keeping her head). ~4-5 per slot instead of up to 32 (~110 MB each on Qwen3.6-35B-A3B). /slots reports checkpoint count+bytes so the core prices them as measured. Without spans: upstream behaviour.

🤖 Generated with Claude Code

… (continuum: price the checkpoint store from measurement)

On the M5 (2026-11-16, Qwen3.6-35B-A3B, 5 slots, --ctx-checkpoints 32) the engine's host allocations
held ~15 GB beyond its KV (MALLOC_LARGE in footprint), of which the 6.7 GB prompt cache is budgeted and
the checkpoints (~110 MB each on this hybrid model, from the saved sidecars) are not: the host thrashed
(11.5 GB swap, 14 GB compressor) and decode fell from ~80 to 1-4 tok/s per stream. The core can only
budget what it can read: each slot now reports its checkpoints' count and bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…continuum 4.10, the checkpoint store)

POST /engine/checkpoint-budget {"bytes": n | null}. With a budget, each new context checkpoint is
followed by erasing the oldest checkpoint of the slot holding the most checkpoint bytes until every
slot's checkpoints fit; a checkpoint that alone exceeds the budget is not kept. null (and an engine never
told) is unbounded: today's behaviour, so this merges inert until the core grants a budget in its one
memory allocation. Live, so the engine stays up while the budget follows the host.

Measured motive (the M5, 2026-11-16): ~110 MB per checkpoint x up to 32 x 5 slots unbudgeted; the host
thrashed (11.5 GB swap) and decode fell from ~80 to 1-4 tok/s per stream.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply joelteply changed the title server: /slots reports each slot's context checkpoints (count, bytes) server: the checkpoint store, observed (/slots count+bytes) and kept within a granted byte budget Nov 16, 2026
…continuum CONTINUUM-ENGINE 4.7.3)

With view spans (view_end_pos >= 0) the prompt loop makes no upstream step checkpoint at user-message
starts; it still checkpoints at the view end and at the prompt's end offsets (MTP rollback, learning).
A new view-end checkpoint erases every checkpoint an earlier act left on the slot except the oldest (her
head, the restore point when her next prompt diverges before her view end). Per slot: head + newest view
end + this act's end checkpoints, ~4-5 instead of up to --ctx-checkpoints 32. A request without spans (an
external driver) keeps upstream behaviour.

Measured motive (the M5, 2026-11-16 05:00Z, Qwen3.6-35B-A3B): ~110 MB per checkpoint x up to 32 x 5 slots,
host thrash (swap 11.5/12 GB, compressor 14 GB), decode ~80 -> 1-4 tok/s per stream.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply joelteply changed the title server: the checkpoint store, observed (/slots count+bytes) and kept within a granted byte budget server: placed checkpoints only with view spans, and /slots reports each slot's checkpoints (continuum 4.7.3) Nov 16, 2026
@joelteply

Copy link
Copy Markdown
Author

Review of 0f4d9f8: changes required before treating checkpoint-budget as reclaimed host memory.

The POST only stores the requested target and returns success; actual erasure happens only on the next checkpoint creation. An idle engine, or an act that creates no further checkpoint, retains all over-budget bytes indefinitely. Route budget application through the existing engine-loop task/completion owner, wake it on a budget change, and return/report applied bytes separately from requested bytes. Reproduce lowering a populated idle store to zero with no subsequent inference and verify actual checkpoint bytes fall before crediting the release.

Also preflight a new checkpoint that alone exceeds the entire budget. Currently keep_checkpoints_within_budget preserves that oversized keep while erasing every other slot's checkpoints, then returns false and discards keep too. This can destroy all useful restore points without retaining any replacement. Reject the oversized checkpoint before evicting unrelated residents' checkpoints; replay an oversized incoming checkpoint against two existing warm residents and verify their restore points survive.

The list container keeps references stable across the targeted erases; no iterator-invalidation finding. Native before/after restore quality, byte accounting and application-latency evidence are still needed.

…ran); placed checkpoints only and the /slots report remain

The byte budget patched blind checkpoints instead of removing them (continuum ggml-org#6068 replaced it with
4.7.3's placed checkpoints, 0f4d9f8); its route, atomic, evictor and call site go.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Author

Re-reviewed exact 763e641: the budget route/evictor are removed, so the two budget-specific findings no longer apply.

One head-retention issue remains in the composed create_checkpoint path. Before the new placed-checkpoint pruning runs, the existing while (checkpoints.size() >= n_ctx_checkpoints) erases front(). For a full store (notably the existing 32-checkpoint state this change targets), this already deletes the true head. The new block then labels the next surviving front as head, so it cannot guarantee preserving the head restore point it promises. A small configured checkpoint limit reaches the same case with normal act-end checkpoints.

Apply the placed retention policy before generic count eviction, or make the eviction owner explicitly preserve the typed head restore point. Add a full-store migration replay and a low-capacity multi-act case: create a new view-end checkpoint and then diverge before the old view end, proving the actual head checkpoint survives and is reused. Also measure checkpoint bytes and restore behavior, rather than assuming the predicted 4-5 count. No native acceptance yet.

joelteply and others added 2 commits November 16, 2026 00:23
…dex on #121)

The generic count eviction erased front() before the placed pruning ran, so a full store (today's
32-checkpoint state) lost the true head and the pruning then kept the next survivor as 'head'. With view
spans the oldest checkpoint after the head goes first; the head goes only when it is the only one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Author

At exact d623761, count eviction now preserves the existing oldest checkpoint with spans when capacity permits; this addresses the identified source interaction. Two validation issues remain:

  • The recovery task explicitly requires no Python. Move the new replay into the existing Rust serving-replay/native harness (or a native fork test), rather than adding a new Python measurement path.
  • The full-store case fills blind for six acts before switching to spans, so the original head may already have been evicted before the tested change. cache_n > 0 also proves only some prefix reuse, not reuse of the claimed head checkpoint. Establish the exact checkpoint/token position before filling, preserve its identity or assert the expected reuse boundary, and demonstrate that this assertion fails on the pre-fix implementation. Include capacity exhaustion and a failed checkpoint copy without claiming more retention than capacity allows.

The source fix is plausible; the supplied test does not yet establish the stated head-retention proof. No live evidence inferred.

… replay goes (no Python, Codex on #121)

checkpoints.at = [{n_tokens, bytes}] oldest first, so a native proof can assert the exact retained head
boundary across a full-store migration (the earlier cache_n > 0 could not tell the original head from a
later one).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Author

Superseded by #127: the same change on codex/s4-per-mind-integration (the line canary ships), with the native proof asked for here.

@joelteply joelteply closed this Nov 16, 2026
joelteply added a commit that referenced this pull request Nov 16, 2026
…les are pure and proven natively (#121 on the shipping line) (#127)

* server: placed checkpoints keep her head through a full store; the rules are pure and proven natively (#121 on the shipping line)

#121 (fable/slot-checkpoint-bytes, stalled on its proof) ported onto codex/s4-per-mind-integration as its
net diff, which applies cleanly, plus the proof Codex asked for:
- with view spans, a full store evicts the oldest checkpoint AFTER her head (her restore point when her
  next prompt diverges before her view end); the head goes only when it is all there is;
- her new view-end checkpoint supersedes the checkpoints earlier acts left on this prefix, except the head;
- no blind step checkpoints when the request carries view spans (up to 32 x ~110 MB per slot thrashed
  the M5's host);
- /slots names each checkpoint's position and bytes.

The two rules move into server-checkpoint-policy.h as pure functions the server calls, so
test-server-checkpoint-policy (model-free, no Python) proves them: her exact head (position and identity
pinned before the store fills) survives 58 acts at capacity 4; the pre-fix rule (always the oldest) is
shown to evict it; capacity one keeps only what fits; a failed copy after eviction stores nothing and
keeps the head, never claiming four; a view-end checkpoint supersedes earlier acts' but not the head's,
and one not at the view end supersedes nothing; without view spans upstream's rule (oldest goes) holds.
0 warnings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* server: a cold prompt with view spans makes her head at the first user turn (Codex's review of #127)

The guard that stops blind step checkpoints when a request carries view spans also skipped the FIRST
user-turn stop, which is her head: a cold prompt with view spans never made one, and the synthetic test
missed it because it pre-inserted the head. checkpoint_at_user_start (server-checkpoint-policy.h) now
decides the stop: with an empty store, always (her head); after it, with view spans, never (the view end
is where her next prompt diverges); without view spans, upstream's rule (her last user message, or a step
past the newest checkpoint). The prompt fill calls it.

Receipts (qwen35-0.8b, M5, 2026-11-16): the server itself, a cold slot, a chat request with view_messages,
then /slots: checkpoints at n_tokens [970, 2789, 2908, 2917], her head at 970 (the first user turn), then
the view end and the prompt end's; the same build with the old guard: [2789, 2908, 2917], no head.
test-server-checkpoint-policy adds the caller's cold path (stops by the predicate from an empty store
make exactly one checkpoint, at the first user turn; the view end the next) and upstream's rule without
view spans. 0 warnings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5.5 <[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