#1 [high] Subtraction lens findings - PR #582 (head 69bf2cf2)
PR #582, head 69bf2cf2, +1854/-19 in 7 files. Production change is ~150 lines (checkpoints.rs 363-458, 482-551, 699-720, 787-811, 954-959; scheduler.rs 1792-1808); tests are ~1560 lines (checkpoints.rs 1980-3503 tests, checkpoint_lifecycle_tests.rs 277-697). Diff is functionally sound but not lean.
F1 (high) — split-cost pricing implemented twice. anchor_split_is_zero_cost (checkpoints.rs:363-385) computes before+after-whole from one catalog; the optional-candidate loop already does the identical three-call computation inline at checkpoints.rs:606-622 (whole.and_then(|whole| { before..after..before+after-whole })). Extract fn split_prefill_ns(request, catalog, terminal_window, left, right, endpoint) -> Option<u64> and delete 363-385 (replace with == Some(0)), reusing it at 606-622. Saves ~20 lines and 3 duplicated interval_prefill_ns walks.
F2 (high) — latch-preference rule written three times. (a) request_anchor_endpoint:398-402 if let Some((latched_raw, chosen)) = request.checkpoints.zero_budget_anchor && latched_raw == raw_anchor { return Some(chosen) }; (b) checkpoint_selection_uncached:528-532 else if request.prefix_tokens != raw_anchor as u64 && let Some((latched_raw, chosen)) = accounting.zero_budget_anchor && latched_raw == raw_anchor { chosen }; (c) plan_checkpoints:703-720 map_or_else(|| { let raw_anchor = ...; if ... { chosen } else { raw_anchor } }, |cut| cut.endpoint). Add one method on LiveRequest, e.g. fn anchored_endpoint(&self) -> usize { let raw = self.checkpoint_anchor(); if self.prefix_tokens != raw as u64 && let Some((r, chosen)) = self.checkpoints.zero_budget_anchor && r == raw { chosen } else { raw } }, use at all three sites (c collapses to cut_endpoint.or_else(|| ...)/.map_or_else, ~18 lines -> 3).
F3 (high) — request_anchor_endpoint's 37-line price_start cascade (checkpoints.rs:403-439) reconstructs a left edge the selection already used. Five branches, three of which just return Some(raw_anchor); the two probes at 415-436 (ready_by_prefix on the anchor key, then cache.checkpoint(prefix).parent() twice) duplicate residency tests done in promote_request_anchor:799-803 and by admission lookup. With the latch consulted first at 398-402, this cascade only runs before the first selection. Collapse to let price_start = baseline_start.min(raw_anchor) (baseline_interval already exists via for_epoch, scheduler.rs 1722-1725) and let checkpoint_selection_uncached own the decision, so there is one formula (currently selection prices from start = consumed_tokens at :486 while this path prices from baseline_start, i.e. two formulas for one answer).
F4 (medium) — promote_request_anchor guard (checkpoints.rs:793-797) calls request.checkpoint_anchor() twice: if anchor != request.checkpoint_anchor() && request.consumed_tokens < request.checkpoint_anchor() as u64 { return Ok(()) }. checkpoint_anchor() walks message_boundaries in reverse running checkpoint_endpoint_eligible (binary_search per boundary); this runs per lane per commit (scheduler.rs:2411). Hoist let raw = request.checkpoint_anchor(); once (and F2's accessor already computes it).
F5 (medium) — test scaffolding duplicated instead of hoisted to the shared fixture module helios/src/scheduler/tests.rs (which already holds scheduler/spec/duration_graphs/measured_graph_durations):
(i) complete_test_step (checkpoints.rs:1980-2050, ~70 lines) vs the local closure finish_step (checkpoint_lifecycle_tests.rs:494-543, ~50 lines) vs existing complete_records (checkpoint_lifecycle_tests.rs:94-118). One complete_test_step in tests.rs, extended with emitted/timing, replaces all three.
(ii) Redundant scenarios: zero_fraction_aligned_interior_anchor_and_mixed_prefill_preserve_exact_contracts Part A (checkpoints.rs:2778-2816) is the same 1024/512/fraction-0/515_000ns-drift scenario asserted again at checkpoints.rs:2912-2951 (test (a)), and Part C (2837-2905, ~70 lines, Mixed b2 p512 + decoder) is covered by test (c) at ~3000-3100 and by checkpoint_lifecycle_tests.rs:497-697. Part B (2818-2835, 18 lines) is the only non-duplicated part: keep B, delete A and C (~110 lines).
(iii) balanced_c16_short_prompts_skip_interior_anchor_tails_and_reach_full_batch (checkpoints.rs:2502-2611, 110 lines) asserts wall-clock thresholds (2s) on a hand-built 16-graph fixture; it is a policy-starvation property, better kept as a served/behavioural claim than a unit test with magic durations — shrink to the launch-count assertion or drop.
Also: three near-identical crate::execution::GraphDescriptor{ kind: Mixed, ... } literals added (checkpoints.rs:2847-2861, 3029-3043, 3257-3271, checkpoint_lifecycle_tests.rs:560-580) where extra_graphs() (checkpoints.rs:1132) and mixed_graphs() already exist; one parameterised mixed_graph(batch, prefill, ns) helper would collapse them.
Repo conventions: no AGENTS.md exists in the tree (list_files **/AGENTS.md -> none), so no written convention violated; the shared-fixture convention is implicit in tests.rs. Docs edits are proportionate, nothing to cut.
#2 [high] Research summary
I reviewed PR #582 (head 69bf2cf2) for subtraction/simplicity/conventions. The production change is small (~150 lines: checkpoints.rs 363–458, 482–551, 699–720, 787–811, 954–959; scheduler.rs 1792–1808) and functionally defensible, but it is not lean: the same split-cost pricing and the same latch-lookup rule are each written out two to three times, request_anchor_endpoint carries a 37-line five-branch start-edge cascade that re-derives what selection already knows, and roughly 1,560 lines of new tests duplicate a shared fixture helper and re-assert two scenarios three times.
Five concrete findings, each with verbatim code and a replacement (full detail and citations in scratchpad note #1):
- Split pricing exists twice —
anchor_split_is_zero_cost(checkpoints.rs:363–385) repeats the before+after−whole computation already inlined in the optional-candidate loop (:606–622). Onesplit_prefill_ns(left, right, endpoint)helper deletes ~20 lines and three duplicatedinterval_prefill_nswalks. - The latch rule is written three times (
:398–402,:528–532,:703–720); oneLiveRequest::anchored_endpoint()collapses the 18-linemap_or_elseat:703–720to three lines and gives one definition of the chosen anchor. request_anchor_endpoint'sprice_startcascade (:403–439) has five branches, three of which are barereturn Some(raw_anchor), plus twoready_by_prefix/parent()probes that only run before the first selection.baseline_start.min(raw_anchor)plus lettingcheckpoint_selection_uncachedown the decision removes ~30 lines and the second pricing formula (selection prices fromconsumed_tokens, this path frombaseline_start).promote_request_anchor(:793–797) callscheckpoint_anchor()twice per lane per commit (scheduler.rs:2411), a reverse scan with a binary search per boundary — hoist it once.- Test scaffolding duplication — a ~70-line
complete_test_step(checkpoints.rs:1980) and a ~50-linefinish_stepclosure (checkpoint_lifecycle_tests.rs:494–541) do the same job as the existing 25-linecomplete_records; scenario Part A (:2778–2816) is re-asserted at:2912–2951and Part C (:2837–2905) at:3000–3100and in the lifecycle test, so ~110 lines can go; four hand-writtenGraphKind::Mixeddescriptors duplicate the existingmixed_graphs()/extra_graphs()fixtures.
No AGENTS.md (not opened) exists in the tree, so no written convention is violated; the only convention broken is the implicit one of keeping shared test fixtures in helios/src/scheduler/tests.rs. The three doc edits are proportionate — nothing to cut there. I did not duplicate correctness findings; where a branch is both convoluted and suspect (finding 3), the recommendation is to delete it rather than patch it.