kvstore: save continued checkpoints after crossed interval frontiers - #903
Open
JordiPosthumus wants to merge 2 commits into
Open
kvstore: save continued checkpoints after crossed interval frontiers#903JordiPosthumus wants to merge 2 commits into
JordiPosthumus wants to merge 2 commits into
Conversation
JordiPosthumus
force-pushed
the
codex/fix-continued-kv-frontiers
branch
from
September 1, 2026 16:28
6336dc0 to
e74f8e1
Compare
JordiPosthumus
marked this pull request as draft
September 1, 2026 16:52
JordiPosthumus
marked this pull request as ready for review
September 1, 2026 17:04
This was referenced Sep 3, 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.
Continued KV saves required
live_tokens % step == 0. After restoring anunaligned checkpoint, fixed-size prefill chunks can cross every interval
without ever landing on an exact multiple, so no continued checkpoint is
written.
For example, a production run restored 9,703 tokens and advanced in
2,048-token chunks with a 16,384-token save interval. The sequence
9703 + n * 2048never reaches an exact interval boundary.This patch saves at the first valid live position at or beyond each crossed
frontier. It also resets the per-slot frontier to the checkpoint actually
restored, including backward restores and rebuilds from zero, and performs
interval rounding in
int64_tbefore checking theintrange.The cache format, stored tokens, graph payload, and defaults are unchanged.
Tests cover crossed intervals, forward/backward/zero restores, and overflow
at
INT_MAX.ds4_test --server,ds4_agent_test, forced Metal and CPUbuilds, and the server suite under ASan+UBSan pass on Apple Silicon. No model
is required for these scheduling/state regressions.
Current-main recheck — 2026-09-03
Applied independently to main
b0a147a7fba6d1a104d047d5a140e9bb4bfc13cdin a cleanworktree. The default build,
ds4_test --server, andds4_agent_testpass.The change remains independently useful; cancellation rollback's save-counter
repair is handled separately by #960.