Skip to content

server: checkpoint the caller's view end and keep it in a saved page - #76

Merged
joelteply merged 1 commit into
889580fc/seq-state-across-stream-countsfrom
continuum/checkpoint-at-view-end
Oct 27, 2026
Merged

joelteply merged 1 commit into
889580fc/seq-state-across-stream-countsfrom
continuum/checkpoint-at-view-end

Conversation

@joelteply

Copy link
Copy Markdown

Stacked on 889580fc/seq-state-across-stream-counts (7d8bff6, Continuum ggml-org#5503).

A chat request may name view_messages: how many leading messages are the caller's view (the append-only part its next request resends unchanged).

  • view_end_position (server-common) maps that number to a token position through the template's message spans. A run of tool replies on a template with no tool delimiter maps to the start of the run, so the position never passes the boundary. When the spans don't line up with the messages, the server logs a warning and makes no view-end checkpoint.
  • The prompt loop always checkpoints at that position. server_prompt remembers view_end and end_from with the prompt (cleared on restore, copied by clone).
  • A save with keep_view_checkpoints: true keeps the head, the newest checkpoint at or before the view end, and the checkpoints made for the prompt's end. A slot that has run no prompt since a restore keeps everything it holds. It logs page keeps N of M checkpoints at n_tokens = [...].

Why: on Continuum's M5 (Qwen3.6-35B-A3B, 2026-10-26), 107 of 161 page-ins resumed from the ~11k head with 33-89k tokens matched, because the 4 newest checkpoints sat in the per-act closing block.

Measured

  • test-chat passes on Metal Release, with the new test_view_end_position: positions inside and after a tool run, the generation-prompt span, no generation prompt, out of range, and a mismatch refusal. test-json-schema-to-grammar passes.
  • Smoke on qwen35-0.8b (hybrid), commit f291f6e, 2026-10-27 ~00:2xZ: page keeps 4 of 5 checkpoints at n_tokens = [10, 5322, 5816, 5834] (view end = 5816, prompt end from = 5322). After erase and restore, the next act logged resume: restored a checkpoint (raw lcp = 5819 ... chosen n_tokens = 5816): 32 tokens prefilled out of 5848.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

A request may name view_messages, how many leading chat messages are the caller's view (the
append-only part its next request resends unchanged). The server maps that to a token position
through the template's message spans (refusing loudly when spans and messages do not line up),
always checkpoints the prompt there, and remembers it with the prompt. A save with
keep_view_checkpoints keeps the head, the newest checkpoint at or before that view end, and the
checkpoints made for the prompt's end, so a restored page resumes where the next prompt
diverges instead of at the shared head (Continuum card 3512f496: on the M5, 107 of 161 page-ins
resumed from the ~11k head with 33-89k tokens matched).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant