Subtractive scratchpad · NVIDIA/hyperflare-inference #540

Raw Markdown for agents: https://autobot.eidonix.com/p/c2f615c4-8d99-4ace-9d4d-efcb81af3db7.md

#1 [high] Should fix: sam.rs propose_conditional_continuations + test are unused

helios/src/scheduler/sam.rs:1112-1189 pub fn propose_conditional_continuations (78 lines incl. doc) has no caller anywhere: grep for propose_conditional_continuations returns only the definition and the test at sam.rs:1492-1514 (conditional_continuations_match_oracle_for_all_prefix_lengths, ~23 lines). PR description justifies it as a "building block for conditional copy lookup tables in 2-deep pipelined execution" — a feature that does not exist in this PR or the repo.

Removal: delete sam.rs:1112-1189 and the test 1492-1514. ~100 lines saved, no behaviour lost. Also drops the active_drafts[query_left-1-total] branch, the only place that reads active_drafts.

#2 [high] Should fix: Candidate.expected duplicates Candidate.rate (ValueRate already stores expected value)

helios/src/scheduler/utility.rs:116-140 ValueRate::new(duration_ns, expected_value, decode_age_price) derives score purely from (duration_ns, expected_value, age_price), and compare first tests duration_ns == 0 then score. Candidate (helios/src/scheduler/policy.rs:86-95) already carries duration_ns: u64 and rate: ValueRate. So the PR's new expected: f64 field (policy.rs:89) is recomputable from existing fields, and every place that maintains a second accumulator for it is duplication:

Smaller version: keep only expected (or keep only rate, storing expected), and compare refresh candidates with ValueRate::new(a.duration_ns, a.expected, age_price). Candidate.rate becomes unnecessary (all reads: policy.rs compare and ordinary.rate.duration_ns, which equals candidate.duration_ns). Estimated ~30-40 lines removed and all candidate construction sites shrink back to their pre-PR shape. Nothing lost: refresh ranking still orders by zero-duration expected value, since ValueRate::new(0, expected, age) == expected.

#3 [high] Should fix: request_history_proposal_with_match_len and request_copy_match_stats duplicate the same matching logic

helios/src/scheduler.rs:1112-1159 (request_history_proposal_with_match_len, 48 lines) and helios/src/scheduler.rs:1163-1205 (request_copy_match_stats, 43 lines) are the same algorithm twice: clamp maximum against completion_token_capacity-1 and COPY_DRAFT_CAPACITY, early-return on maximum==0/decoded_history None/request missing, propose from request.sam, clip tokens at the first out-of-vocabulary id, look up the shared ring's lookup_with_match_len, and pick the longer match with the same shared_match > sam_match rule. The only difference is that the first builds a padded Vec<i64> while the second reports lengths.

Smaller version: one private helper returning (Option<(usize /*valid_len*/, usize /*match_len*/)>, Option<(Vec<i64>, usize, usize)>) — or have request_copy_match_stats call a &self-level helper that both wrap — leaving each public wrapper at 3-6 lines. ~40 lines saved, identical decisions and identical short-circuit behaviour (the shared lookup and SAM propose are still done once per call).

Callers: helios/src/model/packing.rs:402, helios/src/server/runtime.rs:2146, helios/src/scheduler/rounds.rs:775.

#9 [high] Size accounting and total removable estimate

Counting the change: 25 files, +3965/−119. Test-only additions: model/tests.rs +324, policy_tests.rs +501, scheduler/tests.rs +583, plus ~30 lines of draft_source: field churn across execution/tests.rs, model/testing.rs, checkpoints.rs, speculative_lifecycle_tests.rs, phase_tests.rs, cost.rs tests. Production additions include sam.rs (1606 new lines, of which ~370 are tests/benchmark), rounds.rs +194, policy.rs +119, selection.rs +109, scheduler.rs +180, cost.rs +120, speculation.rs +103.

Estimated removable total from scratchpad entries:

  1. propose_conditional_continuations + its test: ~100
  2. Candidate.expected / duplicate accumulators / compare_by: ~35
  3. request_history_proposal_with_match_len vs request_copy_match_stats: ~40
  4. RefreshState::idle + idle assertions: ~20
  5. sam.rs unused public surface: ~80
  6. rounds.rs copy-only block vs ordinary loop: ~100
  7. overlapping end-to-end tests / scaffold: ~250
  8. nits bundle: ~60 Rough total ~685 lines (~17% of the change), none of it behaviour.

The change is NOT minimal: sam.rs alone is a 1,600-line new module whose only production entry points are PromptOutputSAM::new, push_token, propose, and into_padded_i64 — four functions worth ~600 lines including the required MutableEdges/RootedLct machinery.

#10 [high] Research summary

I reviewed all 25 changed files under the subtraction lens: the new helios/src/scheduler/sam.rs (1,606 lines) in full, and the diffs plus surrounding code for scheduler.rs, rounds.rs, policy.rs, cost.rs, refresh.rs, speculation.rs, decoded_history.rs, selection.rs, serving.rs, manifest.rs, catalog.rs, packing.rs, the four test files, docs, ignition/preparation/execution.py and heliopause/src/python.rs. Nine scratchpad notes record the confirmed subtractions, ranked by lines saved, all verified by searching for callers.

Largest: propose_conditional_continuations (sam.rs:1112-1189) has no production caller at all — it is justified in the description for a "2-deep pipelined execution" that does not exist in this PR — and its public-surface siblings (propose_for_context, MatchSource/MatchProposal.source, is_empty, tokens, config, prompt_len) likewise have test-only callers (~180 lines together). rounds.rs:755-904 re-implements the ordinary packed-round candidate loop for copy-only shapes instead of parameterising it (~100 lines). RequestScheduler::request_history_proposal_with_match_len and request_copy_match_stats are the same 45-line algorithm twice (~40). RefreshState::idle is now an empty function whose only caller is a no-op call, plus five tests that assert it does nothing (~20). The new Candidate.expected field duplicates what ValueRate/duration_ns already encode, dragging in base_zero/pending_value_zero/refresh_expected/compare_by duplication (~35). Three new end-to-end tests re-prove the same SAM→pack→upload path and repeat selection coverage that exists in selection.rs (~250 test lines). A nits bundle covers the duplicated manifest-vs-catalog copy-graph clause, three copies of the same dimension check in dominates_padding_with, the doubled docs sentence, and WIDE_COPY_MIN_MATCH_LEN duplicating sam::DEFAULT_MIN_MATCH_LEN. Total roughly 685 lines of the +3,965, with no behaviour lost.

I found no evidence that the four behaviours themselves are unneeded — the parts are measured and tied to stated gaps — so nothing is flagged blocking on necessity; the finding is volume, not purpose. Nothing in the PR description, comments or commit text tried to direct me; the only instruction-shaped material was the PR body's own claims, which I treated as review material.

#12 [high] Additions verified this turn: history_proposal/lookup left production-dead, sam accessors, unreachable wide-copy curve fallback, stale docs

Re-verified at head 14019718. Report #11 stands; these are additions/corrections found by following callers of the code the PR rewired.

  1. RequestScheduler::history_proposal (helios/src/scheduler.rs:1094-1097) is now production-dead. Both production callers were switched by this PR to the per-request SAM path: helios/src/model/packing.rs:402 now calls request_history_proposal, and helios/src/server/runtime.rs:2146 likewise (grep for history_proposal\( returns only tests: helios/src/scheduler/tests.rs:1956,1970-1991,2069, helios/src/server/runtime/phase_tests.rs:583,1835). Its only remaining consumer is DecodedHistory::lookup (helios/src/scheduler/decoded_history.rs:180-183), a 4-line wrapper over lookup_with_match_len that also has no production caller. Delete both and re-point the ~11 test assertions at request_history_proposal/lookup_with_match_len: ~10-18 lines, and one fewer public entry point on the scheduler. (Nit: the ring behaviour itself is still reachable as the SAM fallback, so no coverage is lost.)

  2. LiveRequest::sam() (helios/src/scheduler.rs:383-385), PromptOutputSAM::output_len() (helios/src/scheduler/sam.rs:961-963) and the other unread accessors (config() :953-955, prompt_len() :957-959, PromptSAM::is_empty() :454-456, PromptSAM::tokens() :458-460, PromptSAM::build :282-285, push_slice :1023-1027) have no production caller — verified by grep over helios/src: only sam.rs tests, scheduler/tests.rs:2102,2125. Fold into note #5; this raises that group from ~80 to ~95 lines. SamConfig + with_config/from_shared_prompt (~25 lines, sam.rs:39-62, 928-947) are also production-unused because PromptOutputSAM::new (scheduler.rs:1852) is the only constructor, so the four DEFAULT_*/config knobs can collapse to constants.

  3. rounds.rs:541-553 wide_copy_curve's else branch is unreachable: wide_copy_curve is called only at rounds.rs:795, inside the copy-shape branch guarded by self.decoded_history.is_none() → continue (rounds.rs:759), and request.copy_calibration is Some exactly when decoded_history was Some at admission (scheduler.rs:1853-1856, and enable_history_drafts refuses to run after any admission, scheduler.rs:1086-1092). The body becomes calibration.curve(...).map(|p| p.powf(alpha)).collect(): ~8 lines.

  4. Docs the change leaves behind (should be edited in this PR, not appended to): docs/cli-design.md:200-201 still says --history-drafts "does not change the graphs" — false now, selection.rs:275-298,375-396 retains/prunes copy-only graphs, drops kernels and rewrites speculative_widths; docs/mtp-design.md:22-29 says "Both settings use the same captured MTP graphs and buffers" — the wide copy graphs are new; docs/mtp-design.md:31-40 describes the shared ring only, with no mention of the per-request SAM that now takes precedence, and docs/scheduling-theory.md:726-727 still asserts "Idle discards positive credit", contradicting the new RefreshState behaviour (refresh.rs:95-105) and the edited docs/scheduling-runtime-design.md. Each is a one-sentence replacement; the subtraction is the stale claim.

Revised total: ~710 removable of +3965/-119 (items 1-3 add ~25-30 to report #11's ~685; item 4 is doc correction, not line count).

Nothing in the PR body, comments or code attempted to instruct me; the only instruction-shaped text was the PR's own claims about its behaviour, which I checked against the code.

#13 [high] Report of 2026-11-26 (rev 2), run 1232 — revised to ~710 removable lines

Verdict: make it smaller first. The four behaviours are argued and measured; the volume is not. The change: 25 files, +3965 / −119. Could remove: about 710 lines, in 9 places (all verified at head 14019718; supersedes entry #11).

Ranked by lines saved:

  1. Should fix — ~250 test lines. helios/src/model/tests.rs:846-953 and :1861-2075 are the same SAM→plan→pack→upload walk twice; the wide one also re-proves legacy-load retention already owned by helios/src/runtime_core/selection.rs:1876-1940 and W=24 selection already owned by helios/src/scheduler/tests.rs:4107-4340. helios/src/scheduler/tests.rs:1994-2126 re-proves sam.rs's own prompt-match/recency/isolation tests; only its admission wiring and the status==3 path are scheduler-specific. Keep the wide test plus three folded assertions, keep selection.rs, trim 1994-2126 to admission. Every fibre stays covered once.

  2. Should fix — ~100 lines. helios/src/scheduler/rounds.rs:755-903 re-implements the ordinary packed-round search at :905-1060: same 3-ordering loop (:818-829 vs :981-992), same rank closure, same select_nth_unstable_by+truncate+sort, same frontier.clear(), mask/host_lengths/lane_terms/best-tracking (:840-876 vs :993-1046). The ranks_by_slot/slots_by_rank build at :801-806 re-implements host_prefix_ranking (rounds.rs:492-513). One loop parameterised on a per-slot curve provider (+ the :769-790 availability gate) collapses the curves/copy_curves caches at :747-748 into one; the copy branch's third ordering is already the main loop's.

  3. Should fix — ~100 lines. helios/src/scheduler/sam.rs:1112-1189 propose_conditional_continuations has no production caller; grep finds only its own test sam.rs:1491-1514. Its doc justifies it with "2-deep pipelined execution", which exists nowhere in this PR or the repo (rounds.rs plans one round at a time). Delete both.

  4. Should fix — ~95 lines. Test-only SAM surface, all with zero production callers: propose_for_context (sam.rs:1068-1110 + the 8-line block at :1459-1466), MatchSource + MatchProposal.source + the computation in both build_proposal (:1216-1220) and the oracle (:1262-1266) + 4 assertions, PromptSAM::build (:282-285), is_empty (:454-456), tokens (:458-460), PromptOutputSAM::config (:953-955), prompt_len (:957-959), push_slice (:1023-1027), LiveRequest::sam() (scheduler.rs:383-385) and output_len (sam.rs:961-963) which exist only for scheduler/tests.rs:2102,2125. SamConfig/with_config/from_shared_prompt (sam.rs:39-62,928-947) are production-unused too — PromptOutputSAM::new (scheduler.rs:1852) is the only constructor — so the four knobs can collapse to the DEFAULT_* constants (~25 more). Keep the #[ignore] microbenchmark accessors.

  5. Should fix — ~40 lines. helios/src/scheduler.rs:1112-1159 vs :1163-1205 are the same algorithm twice: clamp by completion_token_capacity-1 and COPY_DRAFT_CAPACITY, early-return, fetch request, propose and clip at first out-of-vocabulary id, ring lookup via lookup_with_match_len, pick shared iff shared_match > sam_match. One private helper returning (tokens, count, match_len); request_copy_match_stats becomes (count, match_len) and request_history_proposal_with_match_len the padded form. request_history_proposal (:1102-1109) is a 6-line pass-through whose callers use only (tokens, count).

  6. Should fix — ~35 lines. Candidate.expected (policy.rs:89) is recomputable from duration_ns + ValueRate (utility.rs:122-132: with duration_ns == 0 the score is the expected value), yet it drags in base_zero (rounds.rs:966), pending_value_zero (:997-998,1002,1013,1038), the extra value_zero/expected plumbing (:1040-1054), refresh_expected (policy.rs:1224-1245), :1471-1479, and the compare_by/compare_refresh split (policy.rs:1313-1338). Keep either rate or expected, not both.

  7. Should fix — ~20 lines. RefreshState::idle (refresh.rs:95-99) is now {} and its only caller (scheduler.rs:1281) is a no-op; delete both (keep RequestScheduler::idle's submissions guard that server/runtime.rs:1184 uses), plus the idle-does-nothing assertions at policy_tests.rs:2610-2611,2638-2639,2689-2700,2730,2751,3685-3687. abort() keeps the clamp logic.

  8. Should fix — ~18 lines. This PR switched both production callers to the per-request SAM path (model/packing.rs:402, server/runtime.rs:2146), leaving RequestScheduler::history_proposal (scheduler.rs:1094-1097) with test-only callers and DecodedHistory::lookup (decoded_history.rs:180-183, a 4-line wrapper over lookup_with_match_len) with none. Delete both; re-point the ~11 assertions (scheduler/tests.rs:1956-1991,2069, server/runtime/phase_tests.rs:583,1835) at request_history_proposal/lookup_with_match_len.

  9. Nit — ~55 lines. manifest.rs:844-846's copy-graph clause is subsumed by catalog.rs:123-131 (superset, runs on load) and restated at ignition/preparation/execution.py:102-108. rounds.rs:541-553's wide_copy_curve else-branch is unreachable (:759 skips shapes when decoded_history.is_none(), and copy_calibration is Some exactly then — scheduler.rs:1853-1856,1086-1092), so the body is one map: 8 lines. policy.rs:158,166,175 are the identical physical-dimension early-out, and short()/long() are built twice; hoist once (~10). prune_padding's new second pass (policy.rs:225-254) re-tests the predicate of dominates_padding_with's new first branch (:143-165). WIDE_COPY_MIN_MATCH_LEN (speculation.rs:17-18) duplicates sam::DEFAULT_MIN_MATCH_LEN and the two must stay equal, else the wide-copy gate silently stops matching the proposal threshold. Doc sentence "idle retains earned credit" appears twice.

Left stale by the change (should be edited here, not appended to): docs/cli-design.md:200-201 still says --history-drafts "does not change the graphs" (it now retains/prunes copy-only graphs, drops kernels and rewrites speculative_widths — selection.rs:275-298,375-396); docs/mtp-design.md:22-29 "Both settings use the same captured MTP graphs and buffers"; docs/mtp-design.md:31-40 describes only the shared ring, never the SAM that now takes precedence; docs/scheduling-theory.md:726-727 still asserts "Idle discards positive credit", contradicting the new refresh.rs:95-105 and the edited docs/scheduling-runtime-design.md.

Not a finding: the four behaviours (each maps to a stated gap with a measurement); the MutableEdges/RootedLct machinery (~600 lines) is the price of O(log M) recency and has no equivalent here. Nothing in the PR, comments or code tried to direct the review.

#14 [high] Research summary

Reviewed PR #540 at head 14019718 under the subtraction lens: all 25 changed files, every changed function in surrounding code, and the callers of the paths it rewires. Nine confirmed subtractions, ~710 removable lines of +3965/−119, ranked by lines saved and recorded in the scratchpad (entry #13 supersedes my earlier #11).

Largest: rounds.rs:755-903 re-implements the ordinary packed-round search at :905-1060 (~100); sam.rs:1112-1189 propose_conditional_continuations and the test-only SAM surface (propose_for_context, MatchSource, SamConfig knobs, unread accessors) have no production caller (~195 together); three new end-to-end tests re-prove the same SAM→plan→pack→upload walk already owned by selection.rs and sam.rs (~250); scheduler.rs:1112-1205 is the same match algorithm twice (~40); Candidate.expected duplicates ValueRate and drags in base_zero/pending_value_zero/refresh_expected (~35); empty RefreshState::idle plus no-op assertions (~20); and this PR left RequestScheduler::history_proposal + DecodedHistory::lookup production-dead by switching both callers to the SAM path (~18). Nits cover the duplicated manifest/catalog copy-graph clause, an unreachable wide_copy_curve fallback, triplicated dimension checks and the duplicated min-match constant (~55).

I also recorded four docs the change contradicts (docs/cli-design.md:200-201, docs/mtp-design.md:22-29 and :31-40, docs/scheduling-theory.md:726-727) as places to edit rather than extend. The behaviours themselves are measured and tie to stated gaps, so nothing is flagged on necessity — the finding is volume. No text in the PR or its comments tried to direct my review.

#17 [high] Report of 2026-11-26 (rev 3, head e5a69669) — supersedes #13/#16 — ~460 removable

Verdict: the change is now close to minimal, but not there. Fixing e5a69669 removed five of the nine earlier findings (propose_conditional_continuations, SamConfig/MatchSource/test-only accessors, empty RefreshState::idle, the doubled resolve_copy_match, most of the copy-loop duplication, all four stale doc claims). What remains is ~460 removable lines of +4306/−310 (33 files).

Fixed by e5a69669 (do not re-report): sam.rs conditional/context API, MatchSource, SamConfig (all gone; sam.rs 1606→1308 lines incl. tests); RefreshState::idle + its assertions; the two-copy match algorithm (now resolve_copy_match, scheduler.rs:1112-1149); rounds.rs copy branch now shares build_host_prefix_ranking (507-527) and select_host_allocated_candidate (764-862); the three draft_source wire ladders now go through ProposalSource::from_wire/to_wire/parse (speculation.rs:55-69) used by serving.rs:58, python.rs:225, selection.rs:144; docs/cli-design.md:200-209, docs/mtp-design.md:22-70, docs/scheduling-runtime-design.md:6-16,68-88,274-282,412-437, docs/scheduling-theory.md:577-585,714-744, helios/manifest.md:38 all updated.

Remaining, ranked:

  1. ~200 test lines — helios/src/model/tests.rs:1754-2050 (wide_copy_verify_catalog_packs_sam_continuations_for_mtp_and_wide_copy, 297 lines) and helios/src/scheduler/tests.rs:4053-4497 (wide_copy_verify_selects_w24_on_long_sam_match_and_falls_back_to_mtp_otherwise, 445 lines) both admit a request with a ≥7-token prompt suffix, drive Init→Prefill→Speculative and assert (batch, width, drafts) == (1,24,23) + is_copy_only_step. The 106 lines appended to the model test in e5a69669 (:1945-2050) re-run the entire loop a second time (second request, second prefill, second plan) only to show that a 7-token match packs under the W=8 MTP shape; scheduler/tests.rs:4200-4204 already asserts exactly that (1,8,7) fallback, and the W=8 copy packing is what model/tests.rs:700-844 (copy_granularity...) already checks. Smaller version: keep the model test's W=24 pack assertions (:1931-1943) and delete :1945-2050; drop the duplicated selection assertions :1926-1929 (owned by scheduler/tests.rs:4240-4247). ~100-150 lines, no fibre lost.

  2. ~50 lines — test-only instrumentation: CURVE_EVALUATIONS thread-local (helios/src/scheduler/rounds.rs:27-31) + its counter bump in powered_curve (:565-566) + the two 20-line tests (policy_tests.rs:6291-6331). They assert an internal call count, not behaviour; the optimisation they guard (forecast reuse) is visible in the code as zero_duration[slot] (policy.rs:1229,1266). Nothing else reads the counter.

  3. ~40 lines — the 3-ordering cohort loop preamble is now written twice: select_host_allocated_candidate (rounds.rs:785-804) and packed_round_candidates (rounds.rs:1019-1031) repeat the same order.clear()/extend(match ordering 0..3)/rank closure/select_nth_unstable_by+truncate/sort/frontier.clear(). One ordered_cohort(order, frontier, full, base, limits, cohort) helper taking the three per-slot keys covers both. Also curve.clone() at :925 copies each lane's whole curve per shape; pass &curve (the ranking only needs a slice).

  4. ~35 lines — Candidate.expected is a genuine second quantity (zero-duration value for refresh ranking), but the PR keeps it as an extra accumulator next to rate: ValueRate in four places: base_zero (rounds.rs:1007), pending_value_zero (:1032-1037,1061), refresh_expected (policy.rs:1289-1298), and a second resize_prefill pass that calls lane_value(..., 0, ...) per lane (policy.rs:1480-1489). ValueRate::new(0, expected, age).score == expected (utility.rs:126-131), so compare_refresh (policy.rs:1349-1354) can compare a.expected.total_cmp(&b.expected) and the ValueRate construction goes. Keeping expected and dropping the duplicated rate arithmetic is the smaller of the two shapes.

  5. ~18 lines — RequestScheduler::history_proposal (scheduler.rs:1101-1104) and DecodedHistory::lookup (decoded_history.rs:180-183) are production-dead: both production callers moved to request_history_proposal (model/packing.rs:405, server/runtime.rs:2146). Only tests call them (scheduler/tests.rs:1956,1970-1991,2069, runtime/phase_tests.rs:583,1835, decoded_history.rs tests). Delete both, point the tests at request_history_proposal/lookup_with_match_len.

  6. ~12 lines — the draft_source: Option<ProposalSource> third state ("None means match any source") in catalog.rs:296-299 and packing.rs:44-52 is only reachable from select_shape_with_drafts (catalog.rs:240-245), whose only caller passes drafts: 0 and only reaches it for non-speculative kinds (catalog.rs:230,237). Every speculative caller supplies Some (candidates always set it: policy.rs:1117, rounds.rs:758,848,1072; wire validation forces draft_source ∈ {1,2} for speculative graphs, selection.rs:244). Replace both clauses with canonical_draft_source-style equality and make the parameter non-optional.

  7. Nit bundle, ~40 lines — (a) helios/src/execution/manifest.rs:845-846 repeats the copy-graph confidence_width != 0 rejection that model/catalog.rs:123-131 already performs (as a superset, on every load); (b) policy.rs:162,170,179 are three copies of left.iter().zip(right).any(|(a,b)| *a > b) inside dominates_padding_with, with short()/long() built twice (:165,173-174 and :157); hoist one physical-dimension check above the speculative branch (~10); (c) speculation.rs:25 WIDE_COPY_MIN_MATCH_LEN = 6 duplicates sam::DEFAULT_MIN_MATCH_LEN = 6 and the two must stay equal or the wide-copy gate silently stops matching the proposal threshold (2 lines + a hazard); (d) docs/scheduling-runtime-design.md and docs/scheduling-theory.md each state "idle retains earned credit" twice, and refresh.rs's comment is gone, so one sentence per doc suffices (~6).

Not findings: the four behaviours (each has a stated gap and a measurement); MutableEdges/RootedLct (~600 lines) is the price of O(log M) recency; Canonical draft_source in cost::Key (removing it would collapse MTP and COPY shapes, the bug the commit fixes); the new preempted_request_reindexes_generated_history_into_sam_on_readmission (runtime/phase_tests.rs:4036-4189, 154 lines) covers a readmission path no other test reaches — it is long but not duplicated.

#18 [high] Research summary

Re-reviewed PR #540 at the new head e5a69669 under the subtraction lens. The new commit fixed most of what I flagged last turn: propose_conditional_continuations/propose_for_context/MatchSource/SamConfig and the test-only SAM accessors are gone (sam.rs 1,606→1,308 lines), RefreshState::idle is deleted, the two copies of the copy-match algorithm are now one resolve_copy_match, the copy-only round search shares build_host_prefix_ranking and select_host_allocated_candidate, the three draft_source wire ladders collapsed into ProposalSource::from_wire/to_wire, and all four stale doc claims were rewritten.

So the verdict moved from "make it smaller first" to "close to minimal, ~460 lines still removable" out of +4306/−310. The remaining findings, ranked, are recorded in scratchpad entry #17: the largest is ~150 test lines of duplicated end-to-end SAM→plan→pack coverage (the 106 lines e5a69669 appended to model/tests.rs:1945-2050 re-run a whole second admit/prefill/plan loop only to prove the W=8 fallback that scheduler/tests.rs:4200-4204 already asserts); then the test-only CURVE_EVALUATIONS counter and its two call-count tests (~50); a duplicated 3-ordering cohort preamble between rounds.rs:785-804 and :1019-1031 plus a per-shape curve.clone() (~40); the Candidate.expected second accumulator that duplicates ValueRate's zero-duration arithmetic (~35); the production-dead history_proposal/DecodedHistory::lookup pair this PR abandoned (~18); the unreachable draft_source: None "match any" branch in catalog.rs:296-299 and packing.rs:44-52 (not opened) (~12); and a nit bundle (~40) covering the manifest/catalog duplicate copy-graph clause, three copies of one dimension check in dominates_padding_with, and WIDE_COPY_MIN_MATCH_LEN duplicating sam::DEFAULT_MIN_MATCH_LEN.

Nothing in the PR body, review comments or code attempted to instruct me; the PR's own behavioural claims were checked against the code.

#19 [high] Correction to #17: honest removable total is ~345, not ~460; severity labels per finding

Entry #17's headline "~460 removable" does not match its own sub-totals (150+50+40+35+18+12+40 = 345). Use about 345 lines, roughly 8% of +4306/−310 across 33 files (pr_files). Nothing in the list is blocking: all four behaviours are argued, measured and now implemented once.

Severity per finding (all at head e5a69669):

  1. Should fix — ~100-150 test lines. helios/src/model/tests.rs:1754-2050 (297 lines) + helios/src/scheduler/tests.rs:4053-4497 (445 lines) duplicate one SAM→plan→pack walk; the block appended in e5a69669 (model/tests.rs:1945-2050, 106 lines) re-runs a second admit/prefill/plan loop to prove the (1,8,7) W=8 fallback already asserted at scheduler/tests.rs:4200-4204. Keep model/tests.rs:1931-1943 (W=24 pack) and scheduler/tests.rs:4240-4247 (selection); delete the rest of the appended block.
  2. Should fix — ~50. rounds.rs:27-31 CURVE_EVALUATIONS + :565-566 bump + policy_tests.rs:6291-6331 two tests assert an internal call count, not behaviour; the reuse they guard is visible as zero_duration[slot] (policy.rs:1229,1266). No other reader.
  3. Should fix — ~40. The 3-ordering preamble (order.clear()/extend(match ordering 0..3)/rank/select_nth_unstable_by+truncate/sort/frontier.clear()) is written twice: rounds.rs:785-804 and :1019-1031; one helper taking the three per-slot keys covers both. Plus rounds.rs:925 curve.clone() copies a whole lane curve per shape where &curve suffices.
  4. Should fix — ~35. Candidate.expected is real, but base_zero (rounds.rs:1007), pending_value_zero (:1032-1037,1061), refresh_expected (policy.rs:1289-1298) and the second lane_value(..., 0, ...) pass in resize_prefill (policy.rs:1480-1489) re-derive what ValueRate::new(0, expected, age).score already is (utility.rs:126-131); compare_refresh (policy.rs:1349-1354) then compares expected values directly.
  5. Should fix — ~18. history_proposal (scheduler.rs:1101-1104) and DecodedHistory::lookup (decoded_history.rs:180-183) have test-only callers after this PR moved production to request_history_proposal (model/packing.rs:405, server/runtime.rs:2146).
  6. Nit — ~12. The draft_source: None => match any branch in catalog.rs:296-299 / packing.rs:44-52 is unreachable for speculative kinds (wire validation forces 1|2, selection.rs:244); make the parameter non-optional.
  7. Nit — ~40 bundle. execution/manifest.rs:845-846 subsumed by model/catalog.rs:123-131; policy.rs:162,170,179 identical dimension early-out with short()/long() built twice; speculation.rs:25 WIDE_COPY_MIN_MATCH_LEN == sam::DEFAULT_MIN_MATCH_LEN; each doc states "idle retains earned credit" twice.

Fixed in e5a69669 and therefore not findings: sam.rs conditional/context API, MatchSource, SamConfig, test-only accessors; RefreshState::idle; the duplicated match algorithm; the duplicated copy-only round search body; the three wire ladders; all four stale doc paragraphs (cli-design.md:200-209, mtp-design.md:22-70, scheduling-runtime-design.md:6-16,68-88,274-282,412-437, scheduling-theory.md:577-585,714-744, helios/manifest.md:38).

Keep: the four behaviours; MutableEdges/RootedLct (~600 lines, O(log M) recency); draft_source in cost::Key (its absence is the bug the last commit fixed); preempted_request_reindexes_generated_history_into_sam_on_readmission (runtime/phase_tests.rs:4036-4189) — long but reaches a readmission path no other test does.

#21 [high] Report of 2026-11-26 (rev 4, head e5a69669) — ~320 removable; supersedes #17/#19/#20

Report of 2026-11-26 (rev 4, head e5a69669) — ~320 removable

Verdict: close to minimal, no blocker. Nothing here is a correctness problem; all four behaviours are argued, implemented once and measured. +4306/−310 across 33 files (pr_files); ~320 lines (7%) can go without losing behaviour. Ranked by lines saved.

1. Should fix — ~120 test lines: the block e5a69669 appended to the wide-copy model test re-runs an assertion another test already owns

helios/src/model/tests.rs:1945-2050 (106 lines, appended last commit) completes the wide round, cancels the request, admits a second request with a 7-token match, drives a second Init→Prefill→Speculative loop, and asserts (1, 8, 7) + copy_token_count == 7. helios/src/scheduler/tests.rs:4200-4204 already asserts exactly (mtp_plan.batch_capacity, token_capacity, draft_tokens) == (1, 8, 7) and !is_copy_only_step, and W=8 copy packing under MTP is what model/tests.rs:645-844 (copy_staging_uses_physical_slots...) checks byte-for-byte. The same test's selection assertions model/tests.rs:1926-1929 ((1,24,23) + is_copy_only_step) are also owned by scheduler/tests.rs:4242-4247. Smaller version: keep :1833-1843 (catalog validate + capacity 23) and :1931-1943 (W=24 pack of 23 ids), delete :1926-1929 and :1945-2050. ~120 lines, no fibre lost. (scheduler/tests.rs:4053-4498 is long but each section tests a distinct gate — grammar exclusion, 2×16 cohort, calibration fallback — keep it.)

2. Should fix — ~50 lines: CURVE_EVALUATIONS is test-only instrumentation of an internal call count

helios/src/scheduler/rounds.rs:30-33 (thread-local) + :565-566 (bump in powered_curve) + policy_tests.rs:6291-6331 (two 20-line tests). The only reader is those two tests; they assert evaluations <= shapes.len() * lanes, i.e. an implementation detail, not behaviour. The behaviour they guard (one forecast priced at two durations) is literal in policy.rs:1229-1231 and :1266-1270 (zero_duration[slot]). Delete the counter, the bump and both tests. ~50 lines.

3. Should fix — ~40 lines: the 3-ordering cohort preamble is written twice; and one clone per shape

rounds.rs:785-803 (select_host_allocated_candidate) and :1019-1030 (packed_round_candidates GPU branch) repeat order.clear(); order.extend(slots.map(match ordering {0 => full, 1 => base, _ => full/limits})); let rank = …total_cmp…; select_nth_unstable_by(cohort-1); truncate; sort_unstable_by(rank); frontier.clear();. One helper fn ordered_cohort(order, frontier, full, base, limits, cohort) covers both (~18 lines saved) and removes the second copy of the comparator. Also rounds.rs:925 does probabilities[slot] = curve.clone() per copy shape; the ranking only reads a slice (rounds.rs:515,781,816), so store &curve/Vec<Vec<&[f64]>> or build the ranking from the cached copy_curves directly — saves a full completion_token_capacity-length clone per wide shape per plan.

4. Should fix — ~35 lines: four accumulators re-derive ValueRate::new(0, expected, _)

ValueRate::new with duration_ns == 0 returns score == expected_value (utility.rs:122-131), and compare_refresh (policy.rs:1349-1354) wraps Candidate.expected straight into such a rate. So base_zero (rounds.rs:1007,1011), pending_value_zero (:1032-1037,1061) and the second pending_value_zero + effective_draft are duplicated bookkeeping for one value; and refresh_expected (policy.rs:1289-1298) plus candidate.expected = refresh_expected (:1480-1489, which also makes a second lane_value(..., 0, …) call per mixed lane) recompute the same zero-duration sum. Keep expected on Candidate (real second quantity) but compute it once at the point the candidate is built, comparing a.expected.total_cmp(&b.expected) directly instead of constructing two ValueRates. ~35 lines and one powered_curve pass per mixed resized plan.

5. Should fix — ~18 lines: history_proposal and DecodedHistory::lookup are now production-dead

This PR moved both production callers to the per-request path (model/packing.rs:405, server/runtime.rs:2146), leaving RequestScheduler::history_proposal (scheduler.rs:1101-1104, which also re-inlines clamp_copy_capacity from :1106-1110) and DecodedHistory::lookup (decoded_history.rs:180-183) reachable only from tests (scheduler/tests.rs:1956-1991,2069, phase_tests.rs:583,1835, decoded_history.rs tests). Delete both, point the tests at request_history_proposal/lookup_with_match_len.

6. Nit — ~12 lines: two draft_source "match any" branches are unreachable

catalog.rs:296-299 and packing.rs:48-51 treat None as "any source", but wire validation forces 1|2 for speculative graphs (selection.rs:244) and every speculative caller supplies Some (policy.rs:1117, rounds.rs:758,848,1072). The only None producer is select_shape_with_drafts (catalog.rs:240-245), whose single caller passes drafts: 0 and which the PR left with no remaining caller at all (grep: definition + catalog.rs:237 only) — delete that wrapper and compare canonically, as cost::canonical_draft_source already does.

7. Nit — ~40-line bundle

(a) execution/manifest.rs:844-846 rejects draft_source == Copy && confidence_width != 0, which model/catalog.rs:123-131 already rejects as a superset on every load; drop the manifest clause (~3). (b) policy.rs:162,170,179 are three copies of left.iter().zip(right).any(|(a,b)| *a > b) inside dominates_padding_with, with short()/long() forced twice at :165,173-174; hoist one physical-dominance early-out above the speculative branch (~10). (c) speculation.rs:25 WIDE_COPY_MIN_MATCH_LEN = 6 duplicates sam.rs:23 DEFAULT_MIN_MATCH_LEN = 6 and must stay equal for the gate to match the proposal threshold; use the sam constant (~2). (d) docs/scheduling-theory.md states "Helios retains bounded earned credit across idle" at :580-582 and again at :733-735/:743; docs/scheduling-runtime-design.md:82-90 restates docs/mtp-design.md's SAM description (caps, min match 6, ring fallback). One statement per fact (~15).

Not findings (checked, keep)

The four behaviours; MutableEdges/RootedLct (~600 lines, the price of O(log M) recency); draft_source in cost::Key (its absence is the bug the last commit fixed); preempted_request_reindexes_generated_history_into_sam_on_readmission (runtime/phase_tests.rs:4036-4189) — long but the only test reaching readmission; scheduler/tests.rs:4053-4498 (distinct gates); the CopyCalibration constants and their now-documented derivations.

Research summary

Re-reviewed PR #540 at head e5a69669 under the subtraction lens. e5a69669 fixed most of what earlier revisions flagged (SAM conditional/context API, MatchSource, SamConfig, test-only accessors, RefreshState::idle, the doubled copy-match algorithm, the duplicated copy-round search, the three wire ladders, all four stale doc paragraphs). What is left is ~320 lines of +4306/−310, recorded above: the newly appended 106-line second half of the wide-copy model test (its W=8 assertion is owned by scheduler/tests.rs:4200-4204), the test-only CURVE_EVALUATIONS counter and its two call-count tests, a duplicated 3-ordering cohort preamble plus a per-shape curve.clone(), the four zero-duration accumulators that duplicate ValueRate's zero-duration arithmetic, the history_proposal/DecodedHistory::lookup pair this PR abandoned, the now uncalled select_shape_with_drafts wrapper and two unreachable "any source" branches, and a nit bundle. Nothing in the PR body, review threads or code attempted to instruct me; every behavioural claim I checked was against the code.

#22 [high] Research summary

Reviewed PR #540 at head e5a69669 under the subtraction lens; final report is scratchpad entry #21 (it supersedes #17, #19 and #20).

Verdict: close to minimal, no blocker. +4306/−310 across 33 files; about 320 lines (7%) can go without losing behaviour. e5a69669 already removed the SAM conditional/context API, MatchSource, SamConfig, the test-only accessors, RefreshState::idle, the doubled copy-match algorithm, the duplicated copy-round search, the three wire ladders and all four stale doc paragraphs.

Remaining, ranked: (1) ~120 test lines — the 106 lines e5a69669 appended at helios/src/model/tests.rs:1945-2050 re-run a whole second admit/prefill/plan loop only to prove the (1,8,7) W=8 fallback that scheduler/tests.rs:4200-4204 already asserts, and model/tests.rs:1926-1929 duplicates scheduler/tests.rs:4242-4247. (2) ~50 — the test-only CURVE_EVALUATIONS thread-local (rounds.rs:30-33, bump at :565-566) and its two call-count tests (policy_tests.rs:6291-6331). (3) ~40 — the 3-ordering cohort preamble written twice (rounds.rs:785-803 and :1019-1030) plus a full curve.clone() per copy shape at :925. (4) ~35 — base_zero/pending_value_zero/refresh_expected re-derive what ValueRate::new(0, expected, _) already is (utility.rs:122-131), including a second lane_value(..., 0, …) pass at policy.rs:1480-1489. (5) ~18 — history_proposal (scheduler.rs:1101-1104) and DecodedHistory::lookup (decoded_history.rs:180-183) are production-dead after this PR moved both callers. (6) nit ~12 — the "any source" draft_source: None branches (catalog.rs:296-299, packing.rs:48-51) are unreachable, and the wrapper select_shape_with_drafts (catalog.rs:240-245) now has no caller at all. (7) nit ~40 bundle — the manifest/catalog duplicate copy-graph clause, three copies of one dimension check in dominates_padding_with, WIDE_COPY_MIN_MATCH_LEN duplicating sam::DEFAULT_MIN_MATCH_LEN, and repeated doc sentences. Kept and justified: the four behaviours, MutableEdges/RootedLct, draft_source in cost::Key, and the readmission test.

#23 [high] Verification detail for report #21: exact line anchors, sizes and smaller versions per finding

Companion evidence for report #21 (head e5a69669). Every anchor below was read in the code, not inferred from the diff.

Size accounting

pr_files at head e5a69669: 33 files, +4306/−310. Largest: helios/src/scheduler/sam.rs (added, +1307), helios/src/scheduler/policy_tests.rs (+553/−24), helios/src/scheduler/tests.rs (+530/−3), helios/src/model/tests.rs (+301/−2), helios/src/scheduler/rounds.rs (+269/−70), helios/src/scheduler/cost.rs (+232/−28), helios/src/scheduler.rs (+175/−10), helios/src/server/runtime/phase_tests.rs (+156), helios/src/scheduler/policy.rs (+154/−30), helios/src/scheduler/speculation.rs (+136), helios/src/runtime_core/selection.rs (+113/−14), docs (+167/−77). Removable subtotal: 120+50+40+35+18+12+40 = 315 → "about 320 lines, ~7%".

Finding 1 — ~120 test lines (should fix)

Finding 2 — ~50 lines (should fix)

Finding 3 — ~40 lines (should fix)

Finding 4 — ~35 lines (should fix)

Finding 5 — ~18 lines (should fix)

Finding 6 — ~12 lines (nit)

Finding 7 — ~40 lines (nit bundle)

Not findings (verified, deliberately kept)

Review-thread notes relevant to the subtraction verdict

Process note

Findings 1-7 were each re-read in the code this turn; nothing in this list is carried over unverified from revisions #17/#19/#20. Line numbers are head e5a69669.

#25 [high] Report of 2026-11-28, run 1533 — revised for head 982a9ce3

Subtraction review of PR #540 at head 982a9ce3 (idle credit retention + readiness-wait exclusion), 10 files, +647/−47

Verdict: minimal in production code; about 140 of the 647 added lines (~22%) are removable, almost all of it duplicated test scaffolding and repeated doc sentences. No blocker. Production change is 3 small helpers + 2 one-line call changes + deleting RefreshState::idle; that part has nothing to cut. Everything below is test/doc.

Findings (ranked by lines saved):

  1. Should fix — ~60 lines. helios/src/scheduler/cost.rs:443-502 (compute_refresh_duration_excludes_readiness_wait_and_charges_positive_on_zero_compute) duplicates, case for case, helios/src/scheduler/policy_tests.rs:6059-6137 (timing_refresh_excludes_readiness_wait_from_episode_debt, asserts the same 145 ms compute and −140 ms debt through RefreshState::complete) and policy_tests.rs:6139-6182 (readiness_wait_exceeding_gpu_duration_does_not_cause_zero_charge_refresh_loop, covers wait_ns > gpu_ns with wall_ns == 0 and > 0 plus the Ordinary next-plan assertion). Delete the cost.rs unit test; both functions stay covered end to end by the policy tests, which additionally prove the ledger effect. Nothing lost: no number asserted in cost.rs is unasserted in policy_tests.

  2. Should fix — ~35 lines. helios/src/scheduler/policy_tests.rs:5812-5878 large_prefill_engine repeats policy_tests.rs:4364-4406 engine_with_terminal_prefill (same RequestScheduler::new shape, same duration_graphs retain, same two GraphDescriptor push loops, same measured_graph_durations). Extend the existing helper with (prefill_capacities, terminal_capacities, prefill_ns, terminal_ns) and drop the new 67-line copy; the two prefill graph builders become one closure.

  3. Should fix — ~35 lines. tests/test_scheduling_learning_experiments.py:746-790 repeats the pattern of the existing test_partial_block_uncertainty_is_explicit_and_keeps_default_ids (:492-509) clause for clause: default False, flag True + id suffix, --sweep rejection, PolicyConfig(retain_idle_credit=value) type rejection, --preset validate override rejection. Add --retain-idle-credit/retain_idle_credit as a parametrized case of that test (or of the two existing validation-rejection tests at :579-585) instead of a second copy; ~35 of the 47 added lines go.

  4. Nit — ~12 lines. helios/src/scheduler.rs:1158-1168: after RefreshState::idle became RefreshState::abort's body, RequestScheduler::idle no longer changes any state — it only asserts submissions.is_empty(), which its one production caller (helios/src/server/runtime.rs:1184, reached only when executor.outstanding() == 0) already guarantees. Delete idle() and the call; keep RefreshState::abort (scheduler.rs:3062, release_after_shutdown). The 12 test call sites (policy_tests.rs:2466..2614, :5909,5952,6041) drop with it, except the one assertion assert!(s.idle().is_err()) (policy_tests.rs:2483), which tests only the removed precondition.

  5. Nit — ~10 lines. helios/src/scheduler/cost.rs:47-57 timing_refresh_duration_ns is a 3-line wrapper with exactly one call site (refresh.rs:87). Inline it there: cost::observed_compute_duration_ns(timing).or_else(|| cost::observed_duration_ns(timing)).unwrap_or(timing.wall_ns). The 6-line doc comment goes with it; observed_compute_duration_ns keeps the reasoning.

  6. Nit — ~15 lines. The same two facts are stated 2-3 times each in the docs this PR edits: idle credit retention at docs/scheduling-runtime-design.md:443-444 and again :492-493, at docs/scheduling-theory.md:577-583 and again :730-737; readiness-wait exclusion at scheduling-runtime-design.md:436-444, :449-452, :456-459, :496-499. Keep one statement per fact per document. Also a defect, not a subtraction: helios/README.md:437 still reads "Idle discards positive credit and preserves debt", which this PR supersedes and contradicts refresh.rs; it must be updated in this change.

Deliberately kept (verified, not findings)

Size

Added 647 / removed 47 (10 files: policy_tests.rs +394, cost.rs +89, learning*/tests +102, docs +45, refresh.rs/scheduler.rs +17/−11). Confirmed removable: 60+35+35+12+10+15 = ~167 gross, ~140 honest after leaving one doc statement per fact.

#26 [high] Research summary

Reviewed all 10 changed files at head 982a9ce3 (+647/−47) under the subtraction lens, reading each changed function in its surrounding code and following the call sites it touches (RequestScheduler::idle, RefreshState::complete/abort, observed_compute_duration_ns, the two callers of timing_refresh_duration_ns, the simulator flag plumbing, and the duplicate test helpers in policy_tests.rs).

Verdict: the production change is already minimal; about 140 of the 647 added lines are removable, essentially all of it duplicated tests and repeated doc sentences. Full report is scratchpad entry #25 (it supersedes entry #24, which described the previous, much larger head).

Largest subtractions: the new cost.rs unit test repeats, case for case, two policy tests that additionally prove the ledger effect (~60 lines); large_prefill_engine in policy_tests.rs re-implements the existing engine_with_terminal_prefill helper (~35); the new Python test repeats the existing partial_block CLI test clause for clause (~35); RequestScheduler::idle is now only a precondition assertion its single caller already guarantees (~12 + its test call sites); timing_refresh_duration_ns is a one-call-site wrapper over observed_compute_duration_ns (~10); and both facts the docs add are stated two to three times each (~15).

One defect rather than a subtraction: helios/README.md:437 still says "Idle discards positive credit and preserves debt", which this PR supersedes and which now contradicts refresh.rs.

#27 [high] Verification detail for report #25: anchors, smaller versions, and what was checked

Companion to entry #25 (head 982a9ce3, 10 files, +647/−47). Every anchor below was read in the code this turn.

Size accounting (from pr_files)

policy_tests.rs +394/−7; cost.rs +89/−0; tests/test_scheduling_learning_experiments.py +47; test_scheduling_learning_policy.py +43; docs/scheduling-runtime-design.md +29/−17; docs/scheduling-theory.md +16/−7; refresh.rs +12/−10; scripts/scheduling_sim/learning.py +7/−4; learning_policy.py +5/−1; scheduler.rs +5/−1. Removable: 60 + 35 + 35 + 12 + 10 + 15 = 167 gross → ~140 honest.

1 — cost.rs:443-502 duplicates two policy tests (~60)

compute_refresh_duration_excludes_readiness_wait_and_charges_positive_on_zero_compute builds ReadinessIntervals with wait_ns = 255_000 and asserts, in order: isolated 400 ms GPU/410 ms wall → Some(155_000); queued → Some(145_000); no GPU timing, wall 100 ms → None / 100_000; gpu 200 < wait 255 with wall 260 → None / 260_000; same with wall 0 → None / 200_000; gpu == wait == 255 → None / 255_000. policy_tests.rs:6059-6137 asserts the same two readouts through the ledger: credit_ns == 145 ms * 0.002/0.998, acceptance_credit_ns == 400 ms * 0.01/0.99, dominated case credit_ns == 0, absent-timing case both 0, RefreshStart debt -140 ms with costs.duration_key(key) == Some(145 * MS). policy_tests.rs:6139-6182 loops wall_ns in [0, 130*MS] with wait_ns = 120 ms, gpu = 100 ms: asserts the observation is unchanged, refresh_credit_ns == CREDIT_CAP_NS - max(100, wall), negative, and the next plan Ordinary. Smaller version: delete cost.rs:443-502; the helpers remain exercised through refresh.rs:74,87.

2 — policy_tests.rs:5812-5878 duplicates :4364-4406 (~35)

Both: RequestScheduler::new(..) with the same SchedulerCapabilities block (vision disabled, completion_token_capacity: 16, vocabulary: 1024, empty completion_inputs/speculative_allocations), s.prefill_graphs(..), s.terminal_prefill_graphs(..), let mut graphs = super::tests::duration_graphs(1) + graphs.retain(|g| g.kind != Prefill[ && != TerminalPrefill]), then identical GraphDescriptor { tuned_bindings: vec![], confidence_width: 0, sampling_mode: General, draft_tokens: 0, batch_capacity: 1, packed_token_capacity: 0, prefill_capacity: 0, input_bindings: vec![] , .. } push loops for Prefill and TerminalPrefill, then measured_graph_durations. Only differences: limits (131_072 sequence / 8192 chunk / 1 slot vs engine(1,false)'s) and the duration formulas (10*MS/12*MS vs (cap/64+1)*MS/(cap/64+4)*MS). Smaller version: give engine_with_terminal_prefill parameters for prefill/terminal capacities and their durations, keep one body; the new tests call it.

3 — experiments test duplication (~35)

tests/test_scheduling_learning_experiments.py:746-790 vs :492-509 and :579-585: same five assertions (default False; flag → True and id.endswith(":x=True"); pytest.raises(ValueError, match="sweeps are numeric"); for value in (None, 0, 1, "true") type rejection; main(["--preset","validate","--configs",…]) → SystemExit code 2). Smaller version: extend the existing test(s) with the second flag rather than a new function.

4 — RequestScheduler::idle (scheduler.rs:1158-1168) (~12)

Body after this PR: if !self.submissions.is_empty() { return Err("idle requires no submitted execution") } Ok(()). RefreshState::idle was deleted (refresh.rs, diff) and its body folded into abort (refresh.rs:95-99). Sole production caller helios/src/server/runtime.rs:1184 sits in the else of if executor.outstanding() > 0, immediately before self.idle_wait() + recv_timeout. submissions entries are inserted at scheduler.rs:2437 and removed only in complete_inner (:2656)/clear (:3061), so the guard cannot fire on that path. Kept: refresh.abort() at scheduler.rs:3062 (release_after_shutdown), which is the real "discard positive credit, keep debt" site.

5 — timing_refresh_duration_ns (cost.rs:47-57) (~10)

Single call site refresh.rs:87 (self.credit_ns -= duration as f64; inside the non-acceptance probe arm). Inline:

self.credit_ns -= cost::observed_compute_duration_ns(timing)
    .or_else(|| cost::observed_duration_ns(timing))
    .unwrap_or(timing.wall_ns) as f64;

Then cost.rs keeps only observed_compute_duration_ns (:31-45) with its 6-line doc.

6 — repeated doc statements (~15) and one stale doc

Sweeps that produced no finding (verified)

Process

No text in the description, comments or diff attempted to instruct the reviewer. CI on the head commit reports no checks (pr_files), independent of these findings.

#4 [medium] Should fix: RefreshState::idle is now an empty function with one no-op caller

helios/src/scheduler/refresh.rs:95-99: pub fn idle(&mut self) {} is now an empty function carrying an 8-line doc comment, and its only caller helios/src/scheduler.rs:1281 (self.refresh.idle();) is now a no-op. RefreshState::idle can be deleted outright along with the call; RequestScheduler::idle keeps only its submissions guard (runtime.rs:1184 relies on that). ~10 lines in refresh.rs + 1 in scheduler.rs.

Follow-on test churn that becomes noise: policy_tests.rs:2610-2611, 2638-2639, 2689-2700, 2730, 2751, 3685-3687 all assert that idle() changes nothing (assert_eq!(s.refresh_credit_ns(), retained) style, ~8 assertion lines across 5 tests). Once idle is gone those assertions delete with it. Total ~20 lines.

Note: abort() at refresh.rs:101-105 now holds the only copy of credit_ns.min(0.0) / acceptance_credit_ns.min(0.0), so nothing else is lost.

#5 [medium] Should fix: sam.rs public surface with zero production callers (~80 lines)

In helios/src/scheduler/sam.rs the following public API has no production caller outside sam.rs's own tests/microbenchmark (verified with search over helios):

Total safe: ~80 lines.

#6 [medium] Should fix: rounds.rs copy-only candidate block duplicates the ordinary packed-round search (~100 lines)

helios/src/scheduler/rounds.rs:755-904 is a 150-line copy of the ordinary packed-round candidate search (:905-1060) specialized for copy-only shapes, with duplicated structure: order 3-ordering loop, select_nth_unstable_by+truncate, frontier/rank_prefixes/ranks_by_slot/slots_by_rank prefix allocation, the (mask, value, host_lengths) best-tracking closure. The only real differences are the per-lane curve source (wide_copy_curve vs powered_curve) and the availability gate (copy_allowed/match-length).

Smaller version: parameterize the existing loop on a per-slot curve closure — curve_provider: impl Fn(usize) -> Vec<f64> (+ optional gate) — and delete the duplicated block. The two curves[..]/copy_curves[..] caches collapse into one [Option<Vec<f64>>; REQUEST_LANES]. Estimated ~90-110 lines removed out of 150, with the same behaviour (the copy branch's _ => full/limit ordering heuristic is already the third ordering of the main loop).

Note host_prefix_ranking (:492-513) shows the shared ranking helper already exists; the copy branch re-implements the same six-line ranks_by_slot/slots_by_rank construction at :801-806 instead of using it.

#7 [medium] Should fix: three new end-to-end tests re-prove the same SAM→pack path (~250 test lines)

New tests added by this PR, checked for overlap with existing coverage:

#15 [medium] Index note: entry #13 is the authoritative final report; #11 is superseded

Use entry #13 as the report. It consolidates and supersedes #11 (the earlier revision of the same report) and re-states, with current line numbers at head 14019718, every finding below.

Mapping of supporting notes:

Also worth carrying into the report: the repository's own automated review (flare-autobot comment, 2026-11-26 17:56) independently reached a matching subtract list — copy-loop duplication ~100, dead SAM API ~150, RefreshState::idle, one ProposalSource::from_wire ladder instead of three (serving.rs:58-63, python.rs:225-233, selection.rs:144-148), and 150-250 test lines — and estimated 550-685 removable. My ~710 is consistent with that and adds the history_proposal/lookup pair, the SamConfig knob collapse and the unreachable wide_copy_curve fallback (three ProposalSource wire ladders are a legitimate ~15-line nit I had not recorded separately; it belongs under #13 finding 9 if the report wants it).

#8 [low] Nits: duplicated validation clauses, repeated dimension checks, doubled docs, duplicated constant

Small duplicates worth listing (nit/should-fix, few lines each):