Skip to content

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

Merged
joelteply merged 3 commits into
codex/s4-per-mind-integrationfrom
fable/placed-checkpoints-s4
Nov 16, 2026
Merged

joelteply merged 3 commits into
codex/s4-per-mind-integrationfrom
fable/placed-checkpoints-s4

Conversation

@joelteply

Copy link
Copy Markdown

#121 ported onto the line that ships. Its net diff applies cleanly, and this adds the native proof Codex asked for on #121 (comment of 2026-11-16 06:28).

The rules (moved to server-checkpoint-policy.h, pure, called by create_checkpoint)

  • Full store: with view spans, evict the oldest checkpoint after her head. The head goes only when it is all there is. Without view spans, the oldest goes, as upstream does.
  • Supersede: her new view-end checkpoint supersedes earlier acts' checkpoints on this prefix, except the head. A checkpoint not at her view end supersedes nothing.
  • No blind steps: no blind step checkpoints when view spans are present.
  • /slots reports each checkpoint's position and bytes.

Proof (test-server-checkpoint-policy, model-free, no Python)

  • Head survives: her exact head, with position and identity pinned before the store fills, survives 58 acts at capacity 4.
  • Pre-fix fails: the pre-fix rule is shown to evict it.
  • Capacity one: only what fits is kept.
  • Failed copy: after eviction, a failed copy stores nothing and keeps the head; one fewer, never a claim of four.
  • Supersession: as above, and nothing changes without view spans.
  • 0 warnings.

Pairs with #123 (merged), which keeps her view end through a side request. Together a mind resumes at her view end, or at her head, never from nothing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…les 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
@joelteply

Copy link
Copy Markdown
Author

Independent checkpoint_close_review verdict: BLOCK MERGE at exact 686dc08.

[P1] server-context.cpp:4112 disables every user-boundary batch break when view_end_pos >= 0, including the first boundary immediately after the stable head. On cold prefill with an unaligned head ending at 9655, prefill crosses that position without a checkpoint. The later checkpoint predicate (4165-4212) cannot recover it: it captures the state at the start of an already prepared batch. The first retained checkpoint may be the view end or a near-end position, leaving no usable restore point when a later prompt diverges after the head but before that checkpoint.

The new test pre-inserts head9655 into the synthetic store, so it verifies retention but not creation by the real caller. Preserve an explicit head-boundary split/checkpoint while suppressing redundant intermediate user-step checkpoints. Add native caller-path replay starting with an empty store and unaligned head, then capacity pressure and divergence before view end.

Eviction and successful-copy insertion ordering otherwise matched the stated policy. Source review only; reviewer did not run builds. No merge or pin bump.

…r 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
@joelteply

Copy link
Copy Markdown
Author

Independent checkpoint_close_review re-reviewed exact c338bc3: source APPROVE, prior cold-head creation blocker resolved. checkpoint_at_user_start now permits the first boundary for an empty store; next batch captures the head before further decode, and later intermediate boundaries stay suppressed. Eviction/copy-failure ordering remains sound. Reviewer did not execute the reported real-server old/new fixture. Exact-head validation still required: only labeler/WIP checks visible, build-cann workflow43924759081 failed with zero jobs and no successful compile/test job for this head. No merge until applicable CI is established and failures classified.

…nto fable/placed-checkpoints-s4

# Conflicts:
#	tools/server/server-context.cpp
@joelteply

Copy link
Copy Markdown
Author

Independent reviewer identity_crypto_review APPROVE merge resolution exactcbdff6d521caff05f2cb1cd406b4ad9a0debabed. Compared prior approvedc338bc38: checkpoint policy/regressions unchanged; shipping123 carried_view_end and its test both preserved. Remaining exact-head CI is required before merge.

@joelteply
joelteply merged commit d5098be into codex/s4-per-mind-integration Nov 16, 2026
10 checks passed
@joelteply
joelteply deleted the fable/placed-checkpoints-s4 branch November 16, 2026 19:16
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