Key findings
The four behaviours themselves are argued and measured, and nothing here says they are unneeded: I found no part that serves no stated purpose. The finding is volume — the change adds 3,965 lines for four scheduler behaviours, and roughly 685 of them are removable without losing a single decision or assertion.
Ranked by lines saved:
| # | Severity | Where | Removable |
|---|---|---|---|
| 1 | Should fix | helios/src/model/tests.rs, helios/src/scheduler/tests.rs — three overlapping end-to-end copy tests |
~250 |
| 2 | Should fix | helios/src/scheduler/rounds.rs:755-904 — copy-only loop duplicates the ordinary loop |
~100 |
| 3 | Should fix | helios/src/scheduler/sam.rs:1112-1189 + test — dead public API |
~100 |
| 4 | Should fix | helios/src/scheduler/sam.rs — test-only public surface (propose_for_context, MatchSource, accessors) |
~80 |
| 5 | Should fix | helios/src/scheduler.rs:1112-1205 — same match algorithm twice |
~40 |
| 6 | Should fix | helios/src/scheduler/{policy,rounds}.rs — Candidate.expected duplicates rate |
~35 |
| 7 | Should fix | helios/src/scheduler/refresh.rs:95-99 + scheduler.rs:1281 + policy_tests — empty idle() and its no-op assertions |
~20 |
| 8 | Nit | manifest.rs / catalog.rs / execution.py, policy.rs dimension checks, duplicated docs, duplicated constant |
~60 |
Size accounting: 25 files, +3965 / −119. Test additions alone: model/tests.rs +324, policy_tests.rs +501, scheduler/tests.rs +583. Production: sam.rs +1606 (of which ~370 are tests/benchmark), rounds.rs +194, scheduler.rs +180, policy.rs +119, cost.rs +120, selection.rs +109, speculation.rs +103.
1. Should fix — three new end-to-end tests re-prove the same SAM→pack path (~250 lines)
helios/src/model/tests.rs:846-953 (history_draft_packing_forwards_per_request_prompt_sam_continuations, 108 lines) and helios/src/model/tests.rs:1861-2075 (wide_copy_verify_catalog_packs_23_sam_tokens_and_preserves_legacy_w8_cores, 215 lines) do the same thing twice: build a scheduler with history drafts, run Init→Prefill→Decode emitting a token that completes a 6+ token suffix, plan a speculative step, pack, and assert on the copy_token_ids/copy_token_count uploads. The wide test additionally repeats the "legacy W=8 core still loads" assertion already owned by helios/src/runtime_core/selection.rs:1876-1940 (wide_copy_graphs_retain_only_when_history_drafts_enabled), and the plan-selection assertions duplicated in helios/src/scheduler/tests.rs:4108+.
helios/src/scheduler/tests.rs:1995-2127 (request_sam_proposes_prompt_continuations_and_isolates_requests, 132 lines) re-proves sam.rs's own prompt_only_match_succeeds_with_zero_prior_output, output_overrides_prompt_recency_on_tie and shared_prompt_sam_isolates_per_request_outputs_and_bounds_states at the scheduler level; only the admission/enable_history_drafts wiring and the status == 3 path (~30 lines) are scheduler-specific.
Replacement: keep the wide-graph packing test (it is the only one that exercises draft_source=2 end to end), fold the 846-953 case into it as three extra assertions, keep the selection test as the legacy-load proof, and trim 1995-2127 to its admission assertions. ~250 lines of the PR's +1,408 test lines go; every fibre (prompt SAM → pack → upload, wide-graph retention, W=24 selection, per-request isolation) stays covered exactly once.
2. 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 speculative loop at :905-1060. It repeats, almost line for line: the 3-ordering loop (:818-829 vs :981-984), the identical rank closure (:830-832 vs :986), select_nth_unstable_by+truncate+sort_unstable_by (:833-838 vs :987-992), frontier.clear(), the mask/host_lengths/lane_terms accumulation and best-tracking closure (:840-876 vs :993-1046). The only real differences are the curve source (copy_curves[slot] / wide_copy_curve vs curves[slot] / powered_curve) and the availability gate at :769-790. Even the ranks_by_slot/slots_by_rank construction at :801-806 re-implements host_prefix_ranking (:492-513).
Replacement: one loop taking a per-slot curve provider (plus the optional gate), so the two curves/copy_curves caches at :747-748 collapse into one [Option<Vec<f64>>; REQUEST_LANES]. The copy branch's _ => full / limit ordering is already the main loop's third ordering, so the merged loop's ordering set is unchanged. ~90-110 of the 150 lines go; identical candidate set, identical tie-breaks.
3. Should fix — propose_conditional_continuations has no caller (~100 lines)
helios/src/scheduler/sam.rs:1112-1189 (pub fn propose_conditional_continuations, 78 lines with doc) is called only by its own test sam.rs:1491-1514. Grep over helios returns the definition and that test, nothing else. Its justification in the PR body — "a building block for conditional copy lookup tables in 2-deep pipelined execution" — describes machinery that exists neither in this PR nor in the repository; speculative execution here is one round deep (rounds.rs plans per-round candidates).
Replacement: nothing. Delete :1112-1189 and the test at :1491-1514. Nothing reads active_drafts anywhere else, so no other path is affected.
4. Should fix — sam.rs public surface with test-only callers (~80 lines)
In helios/src/scheduler/sam.rs, none of the following has a production caller; production touches only PromptOutputSAM::new, push_token/push_slice, propose, into_padded_i64:
propose_for_context(:1068-1110, 43 lines) — one test caller (:1463). Delete the fn and the 8-line block at:1459-1466. It duplicatespropose's body (:1000-1066) except that it walks an arbitrary context instead of the cursor; the test that uses it provespropose's output against the same oracle.MatchSource(:64-69) +MatchProposal.source(:80-81) + thesourcecomputation inbuild_proposal(:1216-1220,:1263-1265) — read only at:1301,1309,1321,1336. No production code branches on provenance; the scheduler picks bymatch_lenalone (scheduler.rs:1143-1157). Delete enum, field, computation, 4 assertions: ~14 lines.PromptSAM::is_empty(:454),PromptSAM::tokens(:458) — zero callers.PromptOutputSAM::config(:953),prompt_len(:957) — zero callers.
Replacement: nothing. ~65-80 lines go. (dynamic_memory_bytes, memory_bytes, state_count, transition_count on PromptSAM feed the #[ignore] microbenchmark quoted in the PR body; keep them if the benchmark stays.)
5. Should fix — the same match algorithm twice in scheduler.rs (~40 lines)
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: clamp maximum by completion_token_capacity - 1 and COPY_DRAFT_CAPACITY (:1117-1119 / :1168-1170), early-return on maximum == 0 or no decoded history (:1120-1122 / :1171-1173), fetch the request (:1123-1125 / :1174-1176), propose from request.sam and clip at the first out-of-vocabulary id (:1127-1138 / :1178-1186), look up the shared ring with lookup_with_match_len (:1139-1142 / :1187-1194), then pick the shared result iff shared_match > sam_match (:1143-1158 / :1195-1204). The only difference is that the first materialises a padded Vec<i64> and the second reports lengths.
Note also request_history_proposal (:1102-1109) is a 6-line pass-through that discards match_len from request_history_proposal_with_match_len; its callers model/packing.rs:402 and server/runtime.rs:2146 use only (tokens, count).
Replacement: one private fn request_copy_match(&self, handle, maximum) -> (Option<Padded>, usize /*count*/, usize /*match_len*/); request_copy_match_stats returns (count, match_len) from it and request_history_proposal_with_match_len returns the padded form, both 3-6 lines. Better still, have callers use the one function and drop request_history_proposal too. ~40 lines; identical decisions, identical short-circuits, SAM propose and shared lookup still happen once per call.
6. Should fix — Candidate.expected duplicates Candidate.rate (~35 lines)
helios/src/scheduler/utility.rs:116-140: ValueRate::new(duration_ns, expected_value, age_price) derives its score purely from (duration_ns, expected_value, age_price), and with duration_ns == 0 the score is expected_value. Candidate (helios/src/scheduler/policy.rs:86-93) already carries duration_ns: u64 and rate: ValueRate. So the new expected: f64 (policy.rs:89) is recomputable, and every site that maintains a second accumulator for it is duplication:
helios/src/scheduler/rounds.rs:966base_zero,:997-998pending_value_zeroin the tuple,:1002its accumulation,:1013(total, 0.0),:1038pending_value_zero + effective_draft,:1040-1044and:1048-1054the extravalue_zero/expectedplumbing.helios/src/scheduler/policy.rs:1218-1229refresh_expectedcomputed besideexpected,:1233,:1416-1425.helios/src/scheduler/policy.rs:1265-1290thecompare_bysplit intocompareandcompare_refresh, wherecompare_refreshis justcomparewithValueRate::new(0, a.expected, age_price).
Replacement: drop rate (its only reads are policy.rs:1284 and ordinary.rate.duration_ns at :1292, which equals candidate.duration_ns), keep expected, and build the refresh comparison as ValueRate::new(0, c.expected, age_price) inside the single compare. Every Candidate { … } literal at rounds.rs:731-734, :886-901, :1055-1059, policy.rs:1238-1250, :1426-1430 shrinks by one field. Behaviour identical: refresh ranking still orders by zero-duration expected value.
7. Should fix — RefreshState::idle is now an empty function (~20 lines)
helios/src/scheduler/refresh.rs:95-99 is pub fn idle(&mut self) {} with an 8-line doc comment explaining that it retains credit by doing nothing; its only caller helios/src/scheduler.rs:1281 (self.refresh.idle();) is therefore a no-op. RequestScheduler::idle keeps its submissions guard (server/runtime.rs:1184 relies on that part), so nothing else regresses.
Replacement: delete the method and the call; abort() (refresh.rs:101-105) keeps the only copy of the clamp-to-nonpositive logic. Five tests then lose their idle-changes-nothing assertions — helios/src/scheduler/policy_tests.rs:2610-2611, 2638-2639, 2689-2700, 2730, 2751, 3685-3687 — roughly 8 assertion lines plus the surrounding calls. One docs sentence in docs/scheduling-runtime-design.md stating "idle retains earned credit" covers the surviving behaviour.
8. Nit — duplicated clauses and constants (~60 lines)
- Copy-graph validation appears three times.
helios/src/execution/manifest.rs:844-846rejectsdraft_source == Copywithconfidence_width != 0;helios/src/model/catalog.rs:123-131rejects the same condition plusspeculative_prefix_limits, and runs on load;ignition/preparation/execution.py:102-107restates it in Python. Keepcatalog.rs(it is the superset and the load-time gate), drop the manifest clause and its doc line: ~7 lines here, ~6 in the Python near-duplicate, and the contract is still enforced before any graph is used. dominates_padding_withrepeats the same test three times.helios/src/scheduler/policy.rs:158,:166and:175are the identicalif left.iter().zip(right).any(|(a, b)| *a > b) { return false; }, andshort()/long()are built up to twice (:153/161,:169-170). Hoisting the physical-dimension comparison above theGraphKind::Speculativebranch, before any closure is consumed, leaves one copy: ~10 lines, with the same early-outs.prune_padding's second pass re-tests the predicate of the new first branch.helios/src/scheduler/policy.rs:221-254re-checksgpu_prefix_allocation, capacity/draft equality andpacked_token_capacity >= needed, which is exactly the:143-157clause. One of the two goes with no pairs lost, because both compare the same(capacity, draft_tokens, packed)triples: ~30 lines.WIDE_COPY_MIN_MATCH_LENduplicatessam::DEFAULT_MIN_MATCH_LEN.helios/src/scheduler/speculation.rs:17-18andhelios/src/scheduler/sam.rs:22both hold6, androunds.rs:776compares against the first while proposals are gated by the second. The two must stay equal or the wide-copy gate silently stops matching the default proposal threshold — a hazard for a 2-line saving. Usesam::DEFAULT_MIN_MATCH_LENatrounds.rs:776and deletespeculation.rs:17-18.- A docs sentence appears twice.
docs/scheduling-runtime-design.mdstates "idle retains earned credit" in the funded-timing-refresh paragraph (~line 431) and again in the funded-acceptance-learning paragraph (~line 481), and a third time inrefresh.rs:95-98. One is enough: ~6 doc lines.
What is not a finding
- The four behaviours themselves: each maps to a stated gap with a measurement in the PR body (over-padded
B16/B32atC = 4..16;3.078 → 3.650emitted tokens/round on the repetitive prompt; sequential-request funding below2,495 ms). Nothing in the charter (read_charter: "Keep the runtime small and model-agnostic") argues against scheduler work; the concern is the line count, not the purpose. - The
MutableEdges/RootedLctmachinery insam.rs(~600 lines) is the price ofO(log M)recency under a 131,072-token trailing cap that the PR benchmarks at140-317 nsper step. It has no smaller equivalent in the repository — I searched for an existing suffix-automaton or LCT helper and found none.
Open questions / could not verify
- Whether
rounds.rs's two candidate loops can truly be merged depends on whether the copy branch'scohort = shape.batch.min(shape.tokens)and itslimit <= base_mtp_drafts + 1gate map onto the ordinary loop'sspeculative_tokenslimit without changing which masks are produced. The structures match line for line; I did not run the planner's tests to confirm candidate-for-candidate equality, so the ~100-line estimate is structural, not proof-tested. - Whether
SamConfig'smax_prompt_tokens/max_output_tokens/boundary_overlapever differ from theDEFAULT_*constants in production:PromptOutputSAM::new(scheduler.rs:1852) is the only production constructor, andwith_config/from_shared_promptare test-only. Replacing the struct with three constants would remove ~25 more lines of public config surface, but this is a larger edit and I could not confirm no external consumer needs the knobs. - Nothing in the PR description, comments, docs or Python changed in this PR attempted to direct my review; all instruction-shaped text was the PR's own claims about its behaviour, which I treated as material to check, not to follow.