Recommendation: Changes Requested
The problem is real and in the right layer (helios/src/scheduler/checkpoints.rs), and live 4× SM120 testing by @voipmonitor confirmed the expected prefill-launch reduction at --scheduler-checkpoint-extra-work-fraction 0, but this head (a3c64835) has two verified correctness blockers that emit duplicate RetentionRole::Anchor captures on ordinary multi-chunk workloads, plus divergent anchor pricing on partial prefix hits, lost latch state across readmission, spurious work_budget skip accounting at fraction == 0.0, and stale documentation.
Blockers
1. Stale known_whole vs. live catalog causes duplicate Anchor captures on normal upward GPU timing drift
Location: helios/src/scheduler/checkpoints.rs:364-388, 451-459, 471-501; helios/src/scheduler/cost.rs:74-96, 302-325
checkpoint_selection_uncached latches accounting.initial_prefill_ns once (:451-459) and passes it as known_whole into anchor_split_is_zero_cost, which compares freshly priced before + after from the live catalog against that stale known_whole (:373-387):
let Some(whole) = known_whole
.or_else(|| Self::interval_prefill_ns(request, catalog, terminal_window, start, end))
else { return false; };
let Some(before) = Self::interval_prefill_ns(request, catalog, terminal_window, start, anchor) else { return false; };
let Some(after) = Self::interval_prefill_ns(request, catalog, terminal_window, anchor, end) else { return false; };
before.saturating_add(after).saturating_sub(whole) == 0
ActionCosts::observe updates per-graph durations via a 9-sample rolling median (ReplayTimes in helios/src/scheduler/cost.rs:74-96, 321). Trace prompt_tokens = 1024, raw_anchor = 512, prefill_catalog = [512] (initial sample 512_000 ns), fraction = 0.0:
- Chunk 1 (
start = 0):initial_prefill_nslatches1_024_000. Branch A (:470-488) computes512_000 + 512_000 - 1_024_000 == 0, selects512(anchor_fallback_from = None), runs0..512, and publishes512asRetentionRole::Anchor. - Normal upward GPU jitter on Chunk 1 (e.g.
515_000 ns, or a post-TTL window reset incost.rs:82-84) shifts the rolling median upward (e.g.513_500 ns). - Chunk 2 (
start = 512):raw_anchor > startis now false, so execution enters Branch B (:489-505). It callsanchor_split_is_zero_cost(..., baseline_start = 0, end = 1024, raw_anchor = 512, known_whole = Some(1_024_000)), getting513_500 + 513_500 - 1_024_000 = 3_000 != 0(!false == true), flips toanchor = 1024, and captures a secondRetentionRole::Anchorat1024.
Symmetrically, downward median drift makes before + after < known_whole, so saturating_sub clamps to 0 and misclassifies genuinely costly splits as zero-cost. The PR's aligned test (checkpoints.rs:2729-2748) missed this because linear_costs initializes Prefill(512) to 512_000 ns while line 2746 passes dur_ns = 1_000, dragging the median down to 256_500 ns and clamping saturating_sub to 0.
Fix: Remove known_whole from anchor_split_is_zero_cost and always price whole, before, and after from the same catalog snapshot — and latch the resulting anchor decision on CheckpointAccounting (see Blocker 2 and Subtract / Simplify). Add a regression test using realistic upward-jitter durations (> initial_cost) asserting checkpoint_anchor_captures == 1.
2. Shifting interval origins (start vs. baseline_start) cause duplicate Anchor captures on Mixed prefill with zero timing drift
Location: helios/src/scheduler/checkpoints.rs:467-511
Branch A (:470-488, while raw_anchor > start) prices the split over [consumed_tokens, prompt_tokens), whereas Branch B (:489-505, once consumed_tokens >= raw_anchor) re-prices over [baseline_start, prompt_tokens):
- Trace with constant costs:
prefill_catalog = [128, 512](150_000 ns,400_000 ns),mixed = [(2, 1, 256)],prompt_tokens = 1024,raw_anchor = 768,fraction = 0.0,baseline_start = 0.- At
start = 0:0..768..1024costs700k + 300k - 800k = 200k != 0→anchor_fallback_from = Some(768),anchor = 1024. - Chunk 1 runs
Mixed(256)(0..256). - At
start = 256:raw_anchor (768) > start (256)enters Branch A and prices[256, 1024):before(256, 768) = 400k,after(768, 1024) = 300k,whole(256, 1024) = 700k→ split cost0→ clearsanchor_fallback_from = None, selects768, and Chunk 2 (256..768) captures and publishes768asRetentionRole::Anchor. - At
start = 768:raw_anchor > startis false; Branch B seesanchor_fallback_from == None, re-prices frombaseline_start = 0, finds0..768..1024costs200k != 0, flipsanchor = 1024, and Chunk 3 (768..1024) captures a secondRetentionRole::Anchorat1024.
- At
Note also that merely switching to an unlatched helper over baseline_start is insufficient: even from one snapshot and fixed baseline_start, a cross-capacity rolling-median shift between chunks (e.g., Prefill(1024) dropping slightly relative to 2 * Prefill(512) after another request runs) can still flip a zero-cost decision into a fallback on Chunk 2.
Fix: Price the zero-budget anchor decision once over (baseline_start, prompt_tokens) from one catalog snapshot and latch the explicit decision on CheckpointAccounting (keyed by (raw_anchor, prompt_tokens)). Add a Mixed-alignment regression test asserting checkpoint_anchor_captures == 1.
Should Fix
1. is_request_anchor_endpoint prices from 0 instead of baseline_start, checks raw_anchor before snapshots == 0, and runs uncached pricing on commit/admit
Location: helios/src/scheduler/checkpoints.rs:390-420, 753-776; helios/src/scheduler.rs:1792-1808, 2411
- Divergent origin on partial prefix hits (
baseline_start < raw_anchor):is_request_anchor_endpointhardcodesstart = 0(:415), which disagrees with selection in both directions:- False promotion: With
prefill_catalog = [128, 512](150k, 400k),baseline_start = 88,raw_anchor = 600,prompt_tokens = 1024,fraction = 0.0, selection prices[88, 1024)as zero-cost (400k + 400k - 800k = 0) and selects600, whileis_request_anchor_endpoint(req, 1024)prices[0, 1024)as costly (550k + 400k - 800k = 150k) and returnstrue, allowingpromote_request_anchor/ inbound admission to stamp1024asAnchoralongside600. - Missed anchor: With
prefill_catalog = [512],baseline_start = 256,raw_anchor = 512,prompt_tokens = 768,fraction = 0.0, selection prices[256, 768)as costly (2*C - 1*C) and falls back to768, whileis_request_anchor_endpoint(req, 768)(whenanchor_fallback_fromisNone) prices[0, 768)as zero-cost (2*C - 2*C) and returnsfalse.
- False promotion: With
- Ordering:
endpoint == raw_anchor as u64(:392) returnstruebefore checkingself.limits.snapshots == 0(:395). - Uncached hot-path work:
promote_request_anchorruns for every lane on every committed step (scheduler.rs:2411), and inbound admission callsis_request_anchor_endpointright afterclear_reservations()(scheduler.rs:1726, 1794). Wheneverraw_anchoris not ready inself.cacheandanchor_fallback_fromisNone, it allocates aVecinprefill_catalog_costsand runs 3interval_prefill_nswalks bypassingSelectionCache.
Fix: Check self.limits.snapshots == 0 first, read the latched anchor decision on CheckpointAccounting, and when computing it on first use price from baseline_start when baseline_start < raw_anchor (falling back to 0 only when baseline_start >= raw_anchor, e.g., full-prompt reuse/inbound restore). Add a regression test for a partial prefix hit < raw_anchor.
2. clear_reservations() wipes the latched anchor decision across preemption/readmission and inbound retries
Location: helios/src/scheduler/checkpoints.rs:48-52; helios/src/scheduler.rs:1722-1726; helios/src/server/runtime.rs:1424-1449, 2572-2608, 2800-2827
admit_planned_with_checkpoint_accounting preserves CheckpointAccounting (including baseline_interval and initial_prefill_ns) across preemption/requeue and inbound fetch retries, then unconditionally calls checkpoints.clear_reservations() (scheduler.rs:1726). Clearing anchor_fallback_from at checkpoints.rs:49 discards the prior anchor verdict on readmission — and also guarantees anchor_fallback_from == None immediately before scheduler.rs:1794 calls is_request_anchor_endpoint.
Fix: Preserve the latched anchor decision across clear_reservations(), keyed by (raw_anchor, prompt_tokens) so normal preemption/readmission keeps the decision while growable-output prompt extension (helios/src/server/runtime.rs:2070-2093, which appends generated tokens to incoming.prompt.tokens) cleanly recomputes it. Add a preemption/readmission regression test.
3. At fraction == 0.0, selection still runs O(N) candidate pricing and increments checkpoint_skip_work_budget
Location: helios/src/scheduler/checkpoints.rs:520-641, 783; helios/src/scheduler/cost.rs:100-102, 264-268
When checkpoint_extra_work_fraction == 0.0, available is 0 (:528), while self.costs.fresh_duration(GraphKind::Snapshot, 1) (:523) only returns Some(nanos) for nanos != 0 (cost.rs:101, 266). Every candidate therefore has charge = split_ns + copy_ns >= 1 > 0 (:596-605), so no optional candidate can ever be accepted. Yet when anchor falls back to prompt_tokens, raw_anchor and every earlier message boundary enter candidates (:529-536), running 2 * N interval_prefill_ns walks per step and setting budget = true, which increments checkpoint_skip_work_budget / flare_checkpoint_skips_total{reason="work_budget"} on every request (:783; observed live by @voipmonitor at 1–3 skips/request).
Fix: Return (accounting, false, false) immediately after pushing the Anchor cut (:519) when self.policy.checkpoint_extra_work_fraction == 0.0.
4. Documentation contradictions in helios/README.md and stale unknown-cost sentences in the edited design docs
Location: helios/README.md:372-379; docs/core-design.md:1452-1453; docs/scheduling-runtime-design.md:570-572
helios/README.md:372-379was not updated and still states unconditionally that checkpoint selection "prioritizes the last eligible message boundary, using the prompt end when no message boundary is eligible" and "Unknown costs exclude extras while preserving best-effort anchor retention" — contradicting both thesnapshots == 0no-cut rule and thefraction == 0.0fallback rule.- Both
docs/core-design.md:1452-1453("Unknown prefill costs or unknown or stale snapshot-copy costs exclude extras without excluding the anchor") anddocs/scheduling-runtime-design.md:570-572("Unknown prefill costs and unknown or stale snapshot-copy costs disable extras while preserving anchor eligibility") still contradictanchor_split_is_zero_cost(checkpoints.rs:373-386), which returnsfalseon any unknown prefill price and therefore replaces the interior message anchor with the prompt end atfraction == 0.0.
Fix: Update helios/README.md:372-379 and those two follow-on sentences, and note explicitly that unavailable prefill pricing also triggers prompt-end fallback when scheduler_checkpoint_extra_work_fraction is zero.
Subtract / Simplify
1. Replace anchor_fallback_from and its 4 separate reconstructions with one latched anchor decision
Location: helios/src/scheduler/checkpoints.rs:28, 49, 364-420, 467-511, 671-685, 753-776
The PR currently reconstructs "was the anchor replaced by prompt_tokens?" in four places (checkpoint_selection_uncached, is_request_anchor_endpoint, plan_checkpoints, and promote_request_anchor) using three different pricing origins (start, baseline_start, 0) plus known_whole. Replacing anchor_fallback_from: Option<usize> with one explicit latched decision on CheckpointAccounting (e.g., resolved_anchor: Option<(usize, usize, usize)> for (raw_anchor, prompt_tokens, chosen_anchor)) and one shared helper eliminates known_whole and the multi-branch fallback logic, shrinking the production diff while fixing Blockers 1–2 and Should Fix 1–2 together.
Nits
- Zero-snapshot short-circuits (
helios/src/scheduler/checkpoints.rs:445-462, 917-963): Moveif self.limits.snapshots == 0beforeprefill_catalog_costs/interval_prefill_nsincheckpoint_selection_uncached, and short-circuitallocate_terminal_capturewhenself.limits.snapshots == 0so zero-snapshot mode avoids catalog allocation and spuriouscheckpoint_skip_*increments. - Brittle mutation literal (
verification/helios-lifecycle/check.py:325-343): The 14-line exact Rust snippet will break on any formatting or refactor (all other mutations incheck.pyare 1–4 lines). Shrink it to a 1–2 line needle targeting the consolidated anchor helper after refactoring. - PR description clarity (
AGENTS.md:88-102, 122-128): Mark "Zero-budget serving avoids extra padded prefill launches..." as an expected effect (or attach before/after served measurements including prefix-reuse impact on the revised commit, since moving the anchor from the last message boundary to prompt end changes reuse on branch/retry turns), briefly mention the design-doc updates under "What changed", and explainpromote_request_anchor's role (Endpoint→Anchorpromotion) inline.
Verified passes
- Zero-snapshot capacity (
checkpoints.rs:460-462):limits.snapshots == 0is genuinely reachable (ignition/cli/serve.py:503,helios/src/scheduler/boundary_tests.rs:194), and returning no cuts cleanly prevents splitting prefill when no snapshot row can be allocated. - TLA+ lifecycle conformance (
helios/src/scheduler/checkpoint_lifecycle_tests.rs:277-411): Exercises real production scheduler entry points across all 5 cancellation points of the multi-chunk prompt-end fallback and integrates withverification/helios-lifecycle/check.py --mutations. - Architecture & boundaries: No per-model branching, no new flags/ABI/wire fields, and no violations of the preparation/runtime boundary (
tests/test_design_review_hook.pyis solely a Git commit-trailer hook test and imposes no structural constraints onhelios/src). - Core benefit confirmed live:
@voipmonitor's 4× SM120 run (DeepSeek-V4.1-FlashTP4,--scheduler-checkpoint-extra-work-fraction 0) confirmedprefill_stepsdropped2 → 1on short 2-turn chat and3 → 2on ~12.2k-token multi-chunk prompts.
Dropped on verification
- Candidate B4 (
scripts/scheduling_sim/64-seedlearning.py(not opened) sweep): Dropped —scripts/scheduling_sim/{model.py,scheduler.py}does not model checkpoints, anchors, message boundaries, or snapshot cuts (its onlysnapshothits are policy-state serialization dicts), and this PR does not alter graph selection, service pricing, timing estimation, or refresh budgets (docs/design-review.md:195-206does not apply); served-evidence framing is addressed in Nit 3. - Candidate S2 (delete
== 0.0branch and charge the anchor through the candidateallowanceloop): Dropped — charging the anchor againstallowancewould break documented best-effort anchor retention at default0.05(docs/core-design.md:1439-1440, where splitting a short prompt adds ~100% > 5% work) and reject all anchors at0.0becausecopy_ns >= 1 > 0(checkpoints.rs:596,cost.rs:101, 264-268). - Candidate X1 (as originally proposed: delete latch and use a pure unlatched
resolved_anchor()): Dropped in unlatched form — even with same-snapshot pricing frombaseline_start, cross-capacity rolling-median updates between chunks can still flip the anchor mid-request and emit duplicateAnchorcaptures, while leaving uncached pricing oncommit/admit; replaced with a single latched anchor helper. - Candidate X2 (delete
complete_test_stepin favor ofpolicy_tests::complete_timed/boundary_tests::run_step): Dropped — existing helpers have incompatible semantics (policy_tests.rs:162-240auto-finishes requests and setsdraft_cache_consumed: -1;boundary_tests.rs:93-145lacksExecutionTiming,Mixedlane_kind, andpublished_output). Only thedur_ns = 1_000value incheckpoints.rs:2746needs fixing (covered in Blocker 1). - Candidate X3 (delete 4 new unit tests in
checkpoints.rs:2326-2781): Dropped — factually incorrect on two tests (boundary_tests.rs:193-210usesspec(None, ...)with no interior message boundaries and does not assertprefill_launches == 1;checkpoints.rs:2450-2559explicitly places interior boundaries atprompt_len - 4and assertsprefill_launches == 16), and the other tests cover multi-bucket large-prompt catalogs and the0.05negative control. - Candidate X4's
AGENTS.md:194-197citation: Dropped —docs/verification.md:133explicitly permits source matching to locate runtime mutations; kept only the needle-brittleness cleanup as Nit 2. - Candidate N2(a) ("
baseline_end == request.prompt_tokensatcheckpoints.rs:498-500is alwaysSome"): Dropped — false on growable-output readmission (helios/src/server/runtime.rs:2070-2093), whereincoming.prompt.tokensgrows whilebaseline_intervalretains the original prompt length (though the guard disappears anyway whenknown_wholeis removed). - Upstream B1 terminology ("EWMA drift"): Corrected —
helios/src/scheduler/cost.rs:74-96, 321implements a 9-sample rolling median (ReplayTimes), not an EWMA; the duplicate-anchor failure still reproduces identically on upward median shift.