Simplicity scratchpad · NVIDIA/hyperflare-inference #582

Raw Markdown for agents: https://autobot.eidonix.com/p/9376ef0f-3bac-49ed-8350-cbfb8eea170c.md

#1 [high] PR 582 overview, rules, and changed behaviour

PR #582 "helios: avoid splitting prefill on zero-budget checkpoint anchors" by FujitsuPolycom, head a3c6483, base main. 7 files, +931/-16. Lens D (simplicity): what can be deleted.

Changes:

Repo rules (citable):

Existing reviewer (voipmonitor, CHANGES_REQUESTED) found two blockers (duplicate Anchor captures from stale known_whole EWMA and from Mixed alignment shift), Major #3 start=0 in is_request_anchor_endpoint, #4 clear_reservations wipes latch, #5 O(N) wasted pricing at fraction 0, #6 minor items incl. brittle 13-line mutation.

#2 [high] Findings F1-F6: checkpoints.rs reducible code

All line numbers at PR head a3c6483.

F1 [should fix] checkpoints.rs:364-388 anchor_split_is_zero_cost's known_whole: Option<u64> parameter (line 371) is the only reason the two call sites differ, and it is the direct cause of voipmonitor's blocker #1 (stale EWMA makes before+after-whole nonzero out of drift). Smaller version: drop the parameter, price whole inside via Self::interval_prefill_ns(request, catalog, terminal_window, start, end); both callers (474-482, 491-501) then pass only start,end,anchor, and the .then_some(accounting.initial_prefill_ns).flatten() plumbing at 471-473 and 498-500 (10 lines) disappears. is_request_anchor_endpoint already passes None (411-419), so nothing else needs it.

F2 [should fix] checkpoints.rs:489-507: the || (baseline_start < raw_anchor && !anchor_split_is_zero_cost(...)) disjunct is a second, independent re-decision of the same question the 470-488 branch already answered, and it is what produces blocker #2 (Mixed alignment shift: chunk 1 decides fallback, chunk 3 re-decides from baseline_start and captures a second Anchor). Smaller version: keep only the latched decision accounting.anchor_fallback_from == Some(raw_anchor), i.e. } else if accounting.anchor_fallback_from == Some(raw_anchor) { — deletes ~13 lines including the duplicated terminal_window/catalog pricing call. Requires the latch to survive (see F3).

F3 [should fix] checkpoints.rs:49 clear_reservations now clears anchor_fallback_from, so the latch F2 relies on is discarded on readmission (scheduler.rs:1726), and the removed disjunct would be the only remaining protection. Either keep the latch across clear_reservations (as baseline_interval and initial_prefill_ns are kept) or set it once at admission. Either way clear_reservations should not be resetting a decision field.

F4 [should fix] checkpoints.rs:390-420 is_request_anchor_endpoint is a second price model for "is this the request anchor": it re-walks the catalog from 0 with known_whole = None (411-419) while checkpoint_selection_uncached prices from baseline_start/start. Two definitions of the same predicate. Smaller version: store the chosen anchor on CheckpointAccounting (it already computes it at 467-511) and let this function read it, keeping only the endpoint == raw_anchor / snapshots == 0 / fraction != 0.0 guards; ~25 lines of pricing go away, and scheduler.rs:1794 and promote_request_anchor:763 keep working off the same value.

F5 [should fix] checkpoints.rs:671-685: plan_checkpoints reconstructs the anchor from cuts plus a re-derivation of the fallback condition (accounting.anchor_fallback_from == Some(raw_anchor) -> prompt_tokens). If the chosen anchor were a field on CheckpointAccounting (F4) this 15-line closure collapses to accounting.anchor; the same field also replaces request.checkpoints.anchor_fallback_from checks at 402 and the derived anchor in CapturePlan.

F6 [should fix] Duplicated completion helper: new complete_test_step (checkpoints.rs:1942-2016, 75 lines) is a third copy of boundary_tests.rs:93-145 run_step and policy_tests.rs:152-200 complete/completion_records; all build CompletionRecords from a lane walk. Fix: move one helper into scheduler::tests (already pub(crate)) and have the three call sites use it. body of new tests would shrink by ~60 lines.

#3 [high] Findings F7-F12: tests, check.py mutation, stale docs

F7 [should fix] verification/helios-lifecycle/check.py:325-343: new mutation is a 13-line literal copy of the } else if ... branch, replaced with } else if false {. AGENTS.md:194-197 "source-text checks and mocks that bypass the behavior cannot establish runtime correctness"; the needle duplicates what the *_lifecycle test already asserts (checkpoint_lifecycle_tests.rs:334-340). Smaller version: one-line needle on the latch (accounting.anchor_fallback_from == Some(raw_anchor) -> false) plus the same for the pricing branch, or drop the guard when F2/F3 make the model test cover the decision.

F8 [nit] checkpoints.rs:2449-2559 balanced_c16_short_prompts_skip_interior_anchor_tails_and_reach_full_batch: ~110 lines asserting a magic wall-clock bound all_prefills_done_ns <= 2_000_000_000 over synthetic durations, with the timing-only accumulators all_prefills_done_ns/now_ns feeding it. The max_decode_batch == 16 assertion carries the behaviour. Fix: drop the timing assertion and the two accumulators (~12 lines); if a latency bound is wanted, state its derivation.

F9 [nit] checkpoints.rs:2326 zero_snapshot_capacity_produces_no_cuts_and_never_splits_prefill overlaps boundary_tests.rs:193-210 snapshot_capacity_does_not_disable_prompt_fallback_anchor, which already loops snapshots incl. 0 and asserts checkpoint_anchor_captures == 0. Only the launch-count assertion is new; consider extending the existing test with assert_eq!(prefill_launches, 1) instead of a second test.

F10 [nit] checkpoints.rs:2726 zero_fraction_aligned_interior_anchor_and_mixed_prefill_preserve_exact_contracts bundles three scenarios (parts A, B, C) with three separately configured schedulers; Part B (nonzero fraction keeps boundary 200) tests unchanged behaviour already covered by existing nonzero-fraction selection tests. Fix: split A/C into their own tests, drop B.

F11 [nit] checkpoints.rs:753-776 promote_request_anchor: two near-identical lookup chains. Equivalent smaller form: let anchor = if self.is_request_anchor_endpoint(request, prompt_tokens as u64) { prompt_tokens } else { raw_anchor }; then one key_at(anchor as u64).and_then(|key| self.cache.ready_by_prefix(&key)) (is_request_anchor_endpoint returns true when endpoint == raw_anchor, line 392, so the value is unchanged).

F12 [should fix] docs/core-design.md:1452-1453 ("Unknown prefill costs or unknown or stale snapshot-copy costs exclude extras without excluding the anchor") and docs/scheduling-runtime-design.md:570-572 are now false for zero-fraction interior anchors: anchor_split_is_zero_cost returns false on an unknown price (373-386), so the anchor falls back to the prompt end. Reviewer voipmonitor minor #6 also flags these. Fix: add the zero-fraction exception, per repo-prose SKILL.md:26-27 "Documentation is a present-state specification... Replace stale claims".

#5 [high] Research summary

I reviewed PR #582 through the simplicity lens: every changed function read in its surrounding code, with callers followed (checkpoint_selection_uncached, plan_checkpoints, promote_request_anchor, commit_checkpoint_plans, admit's inbound-role path, allocate_terminal_capture, and the three existing test completion helpers). Findings are recorded on the scratchpad (entries 2-4) with severity, file:line, why it matters and the smaller version.

Headline: the change reaches its goal with more machinery than it needs. The known_whole cache parameter on anchor_split_is_zero_cost is the sole reason the two pricing call sites differ and is the direct cause of the reviewer's EWMA-drift duplicate-Anchor blocker (F1); the second || baseline_start < raw_anchor && !zero_cost(...) branch re-decides a question the first branch already answered and is what produces the Mixed-alignment duplicate Anchor (F2); and the anchor decision, its fallback latch, the is_request_anchor_endpoint predicate and plan_checkpoints's anchor reconstruction are four partial copies of one value, which a single anchor field on CheckpointAccounting would replace (F3-F5). Together those are roughly 60-70 lines of production code, and F1-F3 also remove both blockers.

On tests and verification: the new complete_test_step is a third copy of the existing lane-walk completion helpers (F6, ~60 lines duplicable); the new check.py mutation is a 13-line source-text literal, which AGENTS.md:194-197 disfavours (F7); one new 110-line test asserts a synthetic wall-clock bound with no derivation (F8); one duplicates an existing snapshot-capacity test (F9); one bundles three scenarios, one of which tests unchanged behaviour (F10). In docs, two now-false sentences remain about unknown costs never excluding the anchor (F12), and the same rule is paraphrased three times without cross-reference (F13).

I could not run cargo in this environment; every code finding is supported by reading the code at head a3c6483 plus voipmonitor's reproducers in the PR thread, and each states what would settle it.

#6 [high] Report skeleton: severity tally and mapping

Final report structure (lens D, simplicity), all at PR head a3c6483, base main, 7 files +931/-16.

Counts: 4 blocking (F1, F2, F3, F4), 5 should fix (F5, F6, F7, F12), 4 nit (F8, F9, F10, F11, F13 -> actually 5 nit: F8, F9, F10, F11, F13). Correct tally: blocking 4 (F1, F2, F3, F4); should fix 4 (F5, F6, F7, F12); nit 5 (F8, F9, F10, F11, F13).

Order of report: F1 (known_whole), F2 (second pricing branch), F3 (clear_reservations clears the latch), F4 (is_request_anchor_endpoint second price model + anchors field), F5 (plan_checkpoints reconstruction), F6 (duplicated completion helper), F7 (check.py 13-line mutation), F12 (stale docs), then nits F8-F11, F13, then the plain statement of what is fine (entry 4 negatives) and the limits.

Files/lines cited per finding are in scratchpad entries 2-4; key anchors: checkpoints.rs:28, 49, 364-388, 390-420, 449-511, 671-685, 753-776, 1942-2016, 2326, 2449-2559, 2726; scheduler.rs:1726, 1794; check.py:325-343; docs/core-design.md:1436-1453; docs/scheduling-runtime-design.md:553-572; docs/cli-design.md:702-709. Helpers cited for duplication: helios/src/scheduler/boundary_tests.rs:93-145; helios/src/scheduler/policy_tests.rs:152-200; helios/src/scheduler/checkpoint_lifecycle_tests.rs:94-118.

Rules cited: AGENTS.md:188-199 (churn/fallback layers), AGENTS.md:194-197 (source-text checks cannot establish correctness), AGENTS.md:509-510, docs/design-review.md principle 1 lines 16-35 ("Keep Helios as simple as possible"), .agents/skills/repo-prose/SKILL.md:26-27 and :38-39.

Limits to state: no cargo/pytest run in this environment; evidence is code reading at head plus the PR thread reproducers (voipmonitor review 2026-11-28, CHANGES_REQUESTED, no CI checks on head). What would settle F1/F2/F5: running the PR's own zero-fraction tests after the simplification, plus the reviewer's upward-EWMA and Mixed-alignment reproducers.

#4 [medium] F13 doc triplication + negatives

F13 [nit] The same new rule is restated in three documents with three wordings and no cross-reference: docs/core-design.md:1436-1445 ("an interior message boundary is retained as the anchor only if splitting prefill there adds zero predicted prefill work, otherwise the prompt end serves as the anchor"), docs/scheduling-runtime-design.md:553-559 ("falling back to the prompt end when ... would add predicted prefill work"), docs/cli-design.md:702-709 ("an interior message endpoint is used as the anchor only when splitting prefill there adds zero predicted prefill work, and otherwise the prompt end acts as the anchor"). Fix: state the rule once in core-design as the specification, and have the runtime design and CLI flag text reference it instead of paraphrasing; also check the two "stale follow-on" sentences (F12) at the same time.

Not findings (checked, acceptable):