#1 [high] Should fix: zero-fraction anchor fallback decision uses two different interval starts, so it can flip and emit a duplicate prompt-end Anchor
File: helios/src/scheduler/checkpoints.rs:467-511 (new anchor selection in checkpoint_selection_uncached), plus :405-419 (is_request_anchor_endpoint), :753-776 (promote_request_anchor).
Two code paths decide "does the interior message boundary lose to the prompt end?" with different interval starts:
- Branch A (
raw_anchor > start, line 470):anchor_split_is_zero_cost(..., start, request.prompt_tokens, raw_anchor, ...)— interval starts at the currentconsumed_tokens. - Branch B (line 489-501):
anchor_split_is_zero_cost(..., baseline_start, request.prompt_tokens, raw_anchor, ...)— interval starts atbaseline_interval.0. is_request_anchor_endpoint(line 411-419): starts at literal0.
start equals baseline_start only on the first selection after a fresh admission (CheckpointAccounting::for_epoch sets baseline_interval = (consumed, prompt), and start = consumed). It does not hold when the request is preempted and re-admitted with carried accounting: runtime.rs:2739-2746 / 2750-2790 pass Option<CheckpointAccounting> back through admit_planned_with_checkpoint_accounting (scheduler.rs:1592-1597), which preserves baseline_interval (checkpoints.rs:441) while start becomes the new, larger consumed_tokens (scheduler.rs:1726 clear_reservations() also nulls anchor_fallback_from, so there is no persisted decision to fall back on).
Consequence: branch A can price the split over the short interval [start, prompt] and conclude zero-cost (keeping the interior anchor at raw_anchor, committing that Anchor cut and publishing it), and after prefill passes raw_anchor branch B re-prices over [baseline_start, prompt], concludes nonzero, sets anchor_fallback_from = Some(raw_anchor) and pushes a cut at request.prompt_tokens — a second Anchor capture at prompt end. That is exactly the duplicate prompt-end anchor the PR claims to avoid ("Zero-cost aligned interior anchors remain eligible without adding a duplicate prompt-end anchor"), and it spends an extra padded prefill launch + snapshot row in the budget the PR wants to protect. Similarly is_request_anchor_endpoint's 0 start disagrees with checkpoint_selection, so promote_request_anchor and the inbound ticket role (scheduler.rs:1794) can call prompt end "the anchor" while selection still treats raw_anchor as the anchor, promoting/stamping a checkpoint as Anchor that selection never chose.
Fix: use one interval start for the decision everywhere — baseline_start in all three places (the first chunk when start == baseline_start prices identically), or thread the decided interval through CheckpointAccounting instead of re-deriving it. A test that preempts a zero-fraction request after its interior anchor cut commits, re-admits it with the carried CheckpointAccounting, and asserts no prompt-end Anchor capture would settle it; the new tests in this PR (checkpoints.rs:2483-2880) only cover uninterrupted single-admission flows, and checkpoint_lifecycle_tests.rs:277-410 only covers one admission.
#3 [high] Coverage note: files read, checks that came out clean, and open items
Files reviewed in context (lens: correctness):
- helios/src/scheduler/checkpoints.rs:22-57 (
anchor_fallback_from,clear_reservations), 108-126 (checkpoint_anchor/eligibility), 163-338 (prefill_catalog_costs,interval_prefill_ns), 364-420 (anchor_split_is_zero_cost,is_request_anchor_endpoint), 422-642 (checkpoint_selection_uncached), 644-738 (estimated_checkpoint_cut,plan_checkpoints), 753-776 (promote_request_anchor), 778-963 (commit/copy/terminal capture). - helios/src/scheduler.rs:688-770 (limits/free_snapshots), 1286-1320 (
ensure_resources), 1583-1818 (admit_planned_with_checkpoint_accounting, inbound ticket role at 1794), 2380-2432 (for lane ... promote_request_anchor), 2620-3012 (complete, boundary publish,allocate_terminal_capture). - helios/src/scheduler/policy.rs:334-352, 499-537, 1208-1327 (
checkpoint_planning_scope,available_plan,checkpoint_anchor_waiting). - helios/src/server/runtime.rs:374-422 (carried
CheckpointAccountingon preemption), 2739-2790 (re-admission with carried accounting). - helios/src/server/config.rs:141-168 and helios/src/model/catalog.rs:56-58:
snapshotsis a manifest integer with no explicit "0 disables" contract, solimits.snapshots == 0is reachable from a prepared core; the new early return at checkpoints.rs:460 is therefore live, and it returns(accounting, false, false)afterinitial_prefill_nsis already computed, socheckpoint_copy_allowed/allocate_terminal_capturestill see a usable accounting. - docs: docs/cli-design.md:700-713, docs/core-design.md:1435-1450, docs/scheduling-runtime-design.md:551-563 — all three updated consistently with the new behaviour (zero capacity ⇒ no cuts; zero fraction ⇒ interior anchor only at zero split cost, prompt end otherwise). No documentation/code mismatch found.
- verification/helios-lifecycle/check.py:322-343: the added
check_mutationsneedle matches the source once (checkpoints.rs:489-502 verbatim), so the mutation hook is sound.
Checked and found correct (no finding): the snapshots == 0 early return does not leak reserved_ns or leave a stale cut; clear_reservations now also resets anchor_fallback_from; estimated_checkpoint_cut (quote-free) and checkpoint_cut share the same accounting so policy's prefill_work_through cut and plan_checkpoints stay consistent; the zero-cost verdict uses the same prefill_catalog_costs and terminal_prefill_window (incl. prompt_logprobs ⇒ terminal_window 0) as real pricing; anchor_split_is_zero_cost returns false (i.e. falls back to prompt end) whenever a price is unknown, which is the conservative direction under a zero budget.
Open items I could not settle before the limit:
- Whether
Mixedlanes and window-restore (conditioned_windows) paths reach branch A withstart != baseline_starton their very first selection, which would widen finding 1's exposure beyond preemption/re-admission. - Whether
promote_request_anchor's new prompt-end fallback (checkpoints.rs:762-767) can promote a prompt-end checkpoint for a request whose real ancestor prefix is shorter, i.e. theready_by_prefixhit at prompt end belonging to a different lineage. Settling it needs a runtime trace or a test with two prompt-end checkpoints of different histories. - The three new heavyweight tests (checkpoints.rs:2313-2880) were read but not executed here; the PR reports them green.
#2 [medium] Should fix: is_request_anchor_endpoint re-walks the whole prefill interval on every commit lane and every admit
File: helios/src/scheduler/checkpoints.rs:390-420, called from scheduler.rs:1794 (admit_planned) and from promote_request_anchor (checkpoints.rs:763), which scheduler.rs:2411 runs as for lane in &step.lanes { self.promote_request_anchor(lane.request)?; } on every commit.
is_request_anchor_endpoint bypasses the checkpoint_selection_cached result and calls prefill_catalog_costs (allocates a Vec, checkpoints.rs:163-206) plus up to three interval_prefill_ns walks over the full prompt on each call. The only cheap short-circuit is request.checkpoints.anchor_fallback_from == Some(raw_anchor) (line 402), which is None at admission (clear_reservations, line 49) and until the first checkpoint plan commits, and is permanently None in the aligned-interior-anchor case where the split is genuinely zero cost — precisely the case the PR wants to keep. So for zero-fraction requests with an aligned interior boundary, every decode commit of every lane pays a full-interval re-price even though the answer cannot change (it depends only on prompt, boundaries, spans, window ends and measured costs).
Correctness impact: none, but it is on the commit hot path next to plan(), and it contradicts the module's own caching design (SelectionCache, checkpoints.rs:11-19, and the checkpoint_planning_scope at policy.rs:1208/1453 which exists to bound selections per planning round). Note the tests that count selections (waiting_prefills_do_not_simulate_checkpoint_storage, scheduler/tests.rs:257-311, and STRIDE_RUNS) do not cover this new path.
Fix: answer from checkpoint_selection(request)'s accounting (it already records anchor_fallback_from) and/or memoize the zero-cost verdict on the request for the current (prompt_tokens, raw_anchor, window_ends, span) shape.