Review: PR #582 — helios: avoid splitting prefill on zero-budget checkpoint anchors (architecture & scope lens)
Key findings
Scope is right, the approach is not. Anchor/snapshot selection is shared Helios scheduling and cache policy (AGENTS.md:408-431, docs/design-review.md:47-55), and nothing in the diff branches on model identity, so this does not violate the "no per-model special cases or flags" rule (read_charter, "Keep the runtime small and model-agnostic"). The zero-snapshot-capacity guard is correct in principle: with limits.snapshots == 0 no snapshot row can ever be reserved, so the old code selected cuts whose captures could never be armed.
What I cannot accept through this lens:
- Blocking — no evidence at the required layer. A change to graph selection and service pricing must be evaluated against
scripts/scheduling_sim/reference solvers, and no scheduler change may land without running the simulator and formal checks (docs/design-review.md:195-206and the blocking rule at232-240). Performance claims additionally require "actual Helios service measurements" (docs/design-review.md:106-115). The PR supplies neither: its evidence is CPU unit/lifecycle tests pluspytestruns of the simulator's own unit tests (tests/test_scheduling_sim.py(not opened) in the PR's run list), and it states outright that "live signed-core serving and isolated GPU latency measurements remain unverified" while the claimed benefit is a prefill-launch reduction. The one live 2→1prefill_stepsmeasurement in the thread came from the reviewer, not the author. - Blocking — three design docs now specify a rule the code does not satisfy, and the PR description does not mention those docs at all.
docs/core-design.md:1436-1445now reads as specification that an interior boundary is the anchor "only if splitting prefill there adds zero predicted prefill work";docs/cli-design.md:703-708anddocs/scheduling-runtime-design.md:553-559say the same. Given the two duplicate-RetentionRole::Anchorblockers already raised in review, that documented policy is false on upward EWMA drift and on aMixedprefill alignment shift.AGENTS.md:52-60requires designed-vs-implemented behaviour to be distinguished, andAGENTS.md:74-113plus design-review principle 16 require the description to cover the change. - Should fix — the anchor is not a stable function of the request. The same policy question is priced from three different start points (details below), so a request can flip between "interior anchor" and "prompt-end anchor" across chunks with no change in costs — the architectural root cause of both blockers.
- Should fix — a second anchor regime selected by exact float equality, with an anchor cut that is pushed unpriced.
- Should fix — the latched decision is destroyed by
clear_reservations()on a path that is documented to preserve the request's accounting. - Should fix — zero-budget selection still walks every boundary and emits a spurious
work_budgetskip, which is a 100%-of-configurations cost and matches the reviewer's live observation.
Everything below is verified against head a3c6483.
Findings
Blocking: evidence does not meet the documented bar for a scheduler/pricing change
docs/design-review.md:232-240: "Never touch covered code without running and updating its simulator and formal checks. Modifying the Helios scheduler … without running—and updating when behavior, transitions, or supported bounds change—the applicable TLA+ models, Rust conformance fixtures, Kani harnesses, and scheduling simulator is a blocking design failure, regardless of whether CPU unit tests pass."docs/design-review.md:195-206: changes to graph selection/service pricing/timing estimation "must be evaluated against the Python simulator and reference solvers inscripts/scheduling_sim/", and Helios must not diverge from the simulator's qualified policy without updating and validating the rule across the screening and 64-seed catalog.docs/design-review.md:106-115(principle 12) and the charter's "Bring real evidence. Performance PRs need benchmarks showing an actual speedup overmainon a served workload (#210)": the claim is "avoids extra padded prefill launches", which is a service-level claim, and the PR itself records "Live signed-core serving and isolated GPU latency measurements remain unverified for this candidate."- Why it matters: this changes the anchor rule a served request follows at the default-on zero-fraction configuration. Without a simulator sweep or a service measurement, neither the benefit nor the absence of a regression (fewer prefix-cache reuse hits at prompt end, larger re-prefill on branch) is established. The
check.py --mutationsrun proves the model and code stayed in sync on transitions; it does not evaluate policy quality. - Fix: run the
scripts/scheduling_simscreening + 64-seed catalog with the new anchor rule, and attach a served-workload before/after (flare run, per principle 12) covering single- and multi-chunk prompts and prefix reuse. If the simulator's qualified policy disagrees, update and validate it in the same PR.
Blocking: documentation specifies a policy the implementation does not satisfy; docs absent from the description
docs/core-design.md:1436-1445(new text),docs/cli-design.md:700-713(flag semantics),docs/scheduling-runtime-design.md:553-559— all three now state the zero-fraction interior-anchor rule as specification.- The implementation it describes is
helios/src/scheduler/checkpoints.rs:467-507, which reaches that rule only through the triple-priced comparison in the next finding and keeps a latch (anchor_fallback_from) whose lifetime is broken by the finding after that. On the reviewer's reproducers the code emits twoAnchorcaptures instead of the documented single anchor, so a reader trusting these docs — or the flag help text — is misled about what zero-budget serving does. AGENTS.md:52-60requires distinguishing designed from implemented behaviour;AGENTS.md:194-199and design-review principle 16 require the description to state the problem, resulting behaviour, validation and limitations. The PR's "What changed" lists onlycheckpoints.rs,scheduler.rs, tests andcheck.py; the three doc files are not mentioned (the orientation packet flagsdocsas unmentioned too).- Fix: land the docs with the code that implements them (i.e. after the anchor rule is made a single stable decision), and add the docs to the description's "What changed".
Should fix: the anchor decision is re-priced from three different windows, so it is not a stable function of the request
checkpoints.rs:364-388 defines anchor_split_is_zero_cost(request, catalog, terminal_window, start, end, anchor, known_whole) — "does cutting at anchor add predicted prefill work?" — and its answer depends entirely on the start/known_whole the caller picks. Three call sites pick three different windows for the same request:
checkpoints.rs:474-482:(start = consumed_tokens, end = prompt_tokens, known_whole = initial_prefill_ns only when start == baseline_start)— moves with every chunk.checkpoints.rs:491-501: after prefill passes the interior boundary,(baseline_start, prompt_tokens, initial_prefill_ns)— fixed at admission.is_request_anchor_endpoint,checkpoints.rs:411-419:(0, prompt_tokens, None)— hardcoded0, ignoringbaseline_start/consumed_tokens.
Because (1) moves while (2) does not, the same prompt with unchanged costs can decide "interior anchor" on one chunk and "prompt-end anchor" on the next; the result is latched at 483/486/503 and then consumed as sticky truth. That is the mechanism behind both duplicate-Anchor blockers in review (EWMA drift, prompt=1024/boundary 512; and Mixed alignment shift with prefill_catalog=[128,512], mixed=[(2,1,256)], raw_anchor=768).
Two further signs the predicate was assembled from special cases rather than designed: baseline_end is always request.prompt_tokens (CheckpointAccounting::for_epoch, checkpoints.rs:35-41 sets (consumed, prompt)), so the guard (baseline_end == request.prompt_tokens).then_some(...) at 498-500 is always true, and (start, prompt_tokens) == (baseline_start, baseline_end) at 471 is true only before any prefill progress.
Why it matters (scope/architecture): docs/design-review.md principle 1 ("Keep Helios as simple as possible") and AGENTS.md:188-193 ("Do not add … fallback layers … without a concrete requirement"). Three pricings of one question is exactly the "fallback layer" pattern. It also makes the policy untestable as a function: any regression test must reproduce a specific chunk history to pin an answer.
Fix: price the anchor once over the fixed admission interval (baseline_start, prompt_tokens), decide the endpoint, and store it as an explicit request field. checkpoint_selection_uncached, plan_checkpoints, is_request_anchor_endpoint and promote_request_anchor should all read that one decision instead of each re-deriving it.
Should fix: a second anchor policy regime selected by exact float equality, with an unpriced anchor cut
helios/src/scheduler/policy.rs:208-209validatescheckpoint_extra_work_fractionover the continuous range[0,1];checkpoints.rs:467-468and395-396then branch oncheckpoint_extra_work_fraction == 0.0and substitute a different anchor rule.- The existing allowance path already expresses the intent:
allowance(prefill, fraction)(checkpoints.rs:87-89, used at528) yields0at fraction 0, so no cut can be funded. The anchor is the only thing still funded, and it is pushed atcheckpoints.rs:512-519withsplit_ns: 0, copy_ns: 0— i.e. never priced at all, in either regime. - Why it matters: this is a magic-valued configuration switch of the kind the charter rules out ("No magic defaults";
AGENTS.md:188-193rejects configuration switches and special cases without a concrete requirement), and it means the zero-fraction behaviour is not a limit of the general policy but a separate code path that the general policy's tests do not exercise. - Fix: delete the
== 0.0branch and charge the anchor cut through the same allowance as every other cut (split_ns= extra splits,copy_ns= snapshot copy). At fraction 0 it is naturally unaffordable unless the split is free; that is the same rule the PR is trying to express, with one code path.
Should fix: the latched anchor decision is not preserved across preemption/readmission, contrary to the documented accounting contract
- The latch lives on
CheckpointAccounting::anchor_fallback_from(checkpoints.rs:28) and is cleared byclear_reservations()(checkpoints.rs:48-52). helios/src/scheduler.rs:1722-1726preserves the caller-suppliedCheckpointAccountingacross admission and then immediately callsclear_reservations()on it;helios/src/server/runtime.rs:2745, 2771, 2789, 2800, 2827deliberately carry that accounting through preemption parks and inbound-restore retries (parked.checkpoint_accountingat1424/1437/1449,2078/2093,2572/2600).docs/core-design.md:1456-1457states "Preemption preserves the logical request's earned and spent allowance." The new zero-budget anchor decision — which is a property of the same policy — is not preserved: a readmitted request re-derives its anchor from a freshconsumed_tokens, which is exactly the instability in the previous finding, now applied to the request's most important checkpoint.- Why it matters: same request, same prompt, potentially a different anchor before and after preemption; the previously captured prompt-end anchor can be orphaned.
- Fix: make the chosen endpoint an explicit request field set once at admission and carried with
initial_prefill_ns/baseline_interval; do not clear it inclear_reservations.
Should fix: at zero budget the selector still prices every boundary and reports a skip that did not happen
checkpoints.rs:529-539: when the anchor is the prompt end,candidatesis all message boundaries plus a distinct prompt end.checkpoints.rs:542-605: each candidate is priced via the interval walk and, withavailable == 0(528), anysplit_ns + copy_ns > 0setsbudget = true.checkpoints.rs:782-783turns that intostats.checkpoint_skip_work_budget, surfaced ashelios/src/server/metrics.rs:501(not opened) (checkpoint_skips{reason="work_budget"}).- Why it matters: at the default-on zero-fraction configuration this is an O(N boundaries)
interval_prefill_nswalk on every selection step plus a permanently nonzero "we skipped a checkpoint for budget" counter that describes a policy working as intended. The reviewer observed this live atfraction == 0.0. Cost and observability both degrade in the exact configuration this PR targets. - Fix: when
available == 0and no candidate can be funded, return immediately after pushing the anchor cut instead of enumerating and pricing candidates.
Nit: promote_request_anchor widens its own policy surface
checkpoints.rs:753-776 now falls back to a prompt-end key when the raw anchor key is not cached, gated on is_request_anchor_endpoint(prompt_tokens) — the third, start = 0 pricing of the finding above. This is what allows an Endpoint checkpoint at prompt end to be upgraded to Anchor (a genuinely new policy surface, and a second way to end up with two anchors). Simplest correct form: promote only the endpoint the selection actually chose.
Nit: brittle mutation guard
verification/helios-lifecycle/check.py:325-343 guards the multi-chunk fallback by substituting a 13-line verbatim source string with } else if false {. AGENTS.md:194-196 explicitly says source-text checks cannot establish runtime correctness, and any reformat of the guarded block silently disables the guard. Prefer an observable assertion on the lifecycle projection (one Anchor capture for a multi-chunk zero-budget prompt) rather than a text substitution.
Nit: zero-capacity pricing in allocate_terminal_capture
checkpoints.rs:917-963 still prices a snapshot copy when limits.snapshots == 0, learning there is no row only at quote time (949-961), which only costs a checkpoint_skip_storage counter — behaviourally harmless, but it is the same "check capacity where it is already known" inconsistency the PR fixes elsewhere.
Why the added tests do not catch these
The new tests (checkpoints.rs zero-capacity / zero-fraction fallback incl. Mixed and aligned anchors / 16-request batching, plus checkpoint_lifecycle_tests.rs) drive linear_costs (checkpoints.rs:1009-1019, capacity * 1_000 ns) and commit dur_ns = 1_000 through complete_test_step, so the EWMA sits far below the 512 000 ns measured cost and saturating_sub clamps to 0. That is why the duplicate-Anchor cases pass the suite. Any regression test for the fixed anchor rule needs measured costs above the chunk interval and an explicit assertion on the number of Anchor-role captures.
What the change gets right
- The zero-capacity guard (
checkpoints.rs:460-462,395-397) is placed afterinitial_prefill_nsis computed (451-459), so unmeasured-cost accounting still gets priced before the early return. Correct. - It correctly identifies that a zero extra-work budget should not require an extra padded graph launch — the concern is real, and the fix belongs in Helios.
- Nothing here branches on model identity, and the change needs no core re-export.
Open questions / what I could not settle
- Whether zero-fraction serving actually loses prefix reuse as a result of moving the anchor to the prompt end is a measurement question; only a served-workload run (or a simulator sweep with reuse-weighted objectives) can settle it. Code review cannot.
- Whether the interior-anchor decision should be a policy function of the request (my recommendation) or intentionally chunk-history-dependent is a maintainer design call; the current code is the second but the docs describe the first.
Verdict
Scope: belongs in Helios. Approach: not yet — one stable, priced anchor decision per request would replace three pricings of one question, a magic == 0.0 regime, an unpriced anchor cut, an unpreserved latch, and would make the new documentation true.