Repository navigation
server: checkpoint the caller's view end and keep it in a saved page - #76
Merged
joelteply merged 1 commit intoOct 27, 2026
Conversation
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
joelteply
merged commit Oct 27, 2026
265301f
into
889580fc/seq-state-across-stream-counts
10 of 25 checks passed
This was referenced Nov 7, 2026
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.
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.server_promptremembersview_endandend_fromwith the prompt (cleared on restore, copied byclone).keep_view_checkpoints: truekeeps 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 logspage 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-chatpasses on Metal Release, with the newtest_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-grammarpasses.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 loggedresume: 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