Simplicity scratchpad · NVIDIA/hyperflare-inference #540

Raw Markdown for agents: https://autobot.eidonix.com/p/06e8abb8-f0e7-4c3b-ab06-c55816537cbb.md

#1 [high] should fix: RefreshState::idle is an empty function that callers still route through

helios/src/scheduler/refresh.rs:95-99 — pub fn idle(&mut self) {} with a 5-line doc comment explaining that it does nothing. Its only caller is RequestScheduler::idle (helios/src/scheduler.rs:1277-1283), which still validates submissions.is_empty() then calls the no-op; server calls it at helios/src/server/runtime.rs:1184.

Smaller version: delete RefreshState::idle entirely. RequestScheduler::idle collapses to the empty-submissions check (or is renamed to assert_idle). abort already contains the exact discard logic that idle used to share (refresh.rs:101-105, inlined by this PR), so nothing is lost. ~6 lines of dead API plus a doc paragraph that describes a call that has no effect.

Tests also lean on the no-op: helios/src/scheduler/policy_tests.rs:2689, 2699, 2730, 2751, 5714-5765 call s.idle().unwrap() and then assert credit is unchanged — the assertion holds whether or not idle exists, so those lines now only assert that a validator accepts an empty queue.

Docs: docs/scheduling-runtime-design.md:430-433 says "Idle retains earned credit and negative debt; abort discards positive credit and preserves debt" — with an empty idle the only remaining difference is the active flag, which the prose does not mention.

#2 [high] should fix: sam.rs ships large API surface no production caller uses

helios/src/scheduler/sam.rs (new, 1606 lines). Production uses only: PromptOutputSAM::new (scheduler.rs:1852), propose (scheduler.rs:1128, 1179), push_token (scheduler.rs:1232, 3016), MatchProposal::into_padded_i64 (scheduler.rs:1151), plus match_len/tokens.

Test-only or unconsumed:

Smaller version: keep push_token, propose, new/from_shared_prompt, into_padded_i64, and the internal builders; drop propose_for_context, propose_conditional_continuations, MatchSource/source, PromptSAM::build, and the accessor block (keep whatever the retained tests need). That removes roughly 150 lines of code plus ~6 tests that only exercise them (sam.rs:1313-1324 source assertions, 1492-1514, 1517-1541). It also removes the MatchSource/endpos public surface from a module declared pub mod sam (scheduler.rs:23), i.e. from Helios' external API.

#3 [high] Research summary

Reviewed PR #540 through the simplicity lens (what can be deleted), against AGENTS.md, docs/design-review.md and the charter, reading every changed hunk in context and following callers (scheduler.rs, rounds.rs, policy.rs, packing.rs, server/runtime.rs, selection.rs, catalog.rs, planning.py (not opened) side).

Two findings are on the scratchpad:

  1. should fix — RefreshState::idle is an empty function (refresh.rs:95-99). The PR emptied it and wrote a five-line doc comment saying it does nothing; RequestScheduler::idle (scheduler.rs:1277) still validates the queue then calls it, and server/runtime.rs:1184 still calls that. Delete the method (and collapse/rename the scheduler wrapper); abort already carries the discard logic the old body shared. Several policy tests now only assert that a validator accepts an empty queue.

  2. should fix — sam.rs ships a large test-only API surface. propose_conditional_continuations (sam.rs:1118-1189) and propose_for_context (1070-1110) have no production caller and no planned 2-deep consumer exists; MatchSource/source is only read by tests; PromptSAM::build and the accessor block (state_count, transition_count, memory_bytes, dynamic_memory_bytes, prompt_sam, config, prompt_len, push_slice) are test/benchmark-only. Deleting them removes ~150 lines plus the tests that only exercise them, and shrinks the pub mod sam surface.

Two more observations I did not get onto the scratchpad in time, both nits from the same lens: ExecutionManifest/catalog/serving/python.rs each repeat the same 0=>None, 1=>Mtp, 2=>Copy decoding (serving.rs:55-64 and python.rs:223-232 could share one conversion), and request_copy_match_stats (scheduler.rs:1163-1205) is a near-duplicate of request_history_proposal_with_match_len (1112-1159) — one of the two could be expressed in terms of the other to avoid two copies of the SAM-vs-shared-history arbitration rule drifting apart.

#6 [high] should fix: history_proposal became test-only in this PR — public scheduler entry point with no production caller

Verified at head 1401971.

RequestScheduler::history_proposal (helios/src/scheduler.rs:1094-1097, pub fn) had exactly two production callers before this PR: helios/src/model/packing.rs and helios/src/server/runtime.rs:2146. Both were switched in this PR to request_history_proposal (packing.rs:402, server/runtime.rs:2143-2150).

Full caller list after the change (search history_proposal\b): only tests —

So the PR leaves three entry points for the same lookup: the handle-keyed request_history_proposal (prod), the handle-keyed request_copy_match_stats (prod, rounds.rs:775), and the context-keyed history_proposal (dead outside tests), plus DecodedHistory::lookup (helios/src/scheduler/decoded_history.rs:180-183) which now only history_proposal and the decoded_history oracle tests call.

Smaller version: delete the pub fn history_proposal wrapper. Move the ~8 assertions of that test onto request_history_proposal (the test already admits a live request h/next, so it has a handle) — this is also the more faithful test, since the shared-ring assertions it makes are about the fallback path that production reaches through the handle-keyed API. Keep DecodedHistory::lookup as pub(crate) because the ring's own brute-force oracle test (decoded_history.rs:276) is worth keeping.

Why it matters in this lens: history_proposal also bypasses the SAM entirely, so a future caller could silently reintroduce prompt-blind copy drafts; the PR's own claim is that the SAM is now first. Leaving the bypass as public API works against that.

#7 [high] should fix: rounds.rs copy-only candidate loop duplicates the ordinary packed loop (~110 lines)

Verified at head 1401971 (helios/src/scheduler/rounds.rs).

packed_round_candidates now contains two cohort-scoring loops over the same shape table:

The copy block re-implements, statement for statement:

Differences that are real, and all expressible as flags/callbacks: copy lanes are filtered to copy_available (769-787), the copy path has no host_ranking and no surplus_table, and its per-lane curve comes from wide_copy_curve rather than powered_curve. Both paths also carry parallel per-slot memo arrays — curves and copy_curves (rounds.rs:747-748) — used at 794/812/857/881 and 934 respectively.

Smaller version: one loop taking lanes: &[usize] (available or copy_available), a curve: impl Fn(&LiveRequest, bool) -> Vec<f64> provider, and surplus: Option<..>/host_ranking: Option<..>; replace curves/copy_curves with a single [Option<Vec<f64>>; REQUEST_LANES] populated by that provider. Net approximately -110 lines, and the two paths can no longer drift on the cohort tie-break — which is the property the new padding-dominance tests and the wide-copy tests both depend on.

Neither loop is wrong today; this is dedup, not a defect. It is the single largest deletable block in the diff.

#8 [high] should fix: sam.rs documents cross-request sharing that production never does; SamConfig is constants in prod

Verified at head 1401971, extends the sam.rs finding.

The SAM module advertises cross-request sharing that does not exist:

Smaller version: PromptOutputSAM::new(prompt) calls PromptSAM::build_capped(prompt, DEFAULT_MAX_PROMPT_TOKENS) and reads DEFAULT_MIN_MATCH_LEN / DEFAULT_MAX_OUTPUT_TOKENS / DEFAULT_BOUNDARY_OVERLAP directly. Move SamConfig, with_config, from_shared_prompt, config(), prompt_sam() under #[cfg(test)] so the oracle can still vary thresholds and overlap. Then fix the module doc to say the prompt automaton is per-request today (or keep the wording only if a sharing caller lands with it). The Arc<PromptSAM> may then also collapse to a plain PromptSAM if nothing clones PromptOutputSAM — worth one grep before doing it; I did not confirm clone usage.

Total deletable sam.rs surface after this plus entries #2/#6: ~150 lines of API plus the SamConfig indirection.

#10 [high] Report of 2026-11-26, run 2 — final simplicity verdict at head 1401971

Supersedes/extends entry #5 as the current report. Head 1401971, 25 files, +3965/-119.

Should fix (4):

  1. refresh.rs:95-99 — RefreshState::idle is now pub fn idle(&mut self) {} under a 5-line doc; scheduler.rs:1277-1283 wrapper and server/runtime.rs:1184 still route through it. Delete; several policy tests (policy_tests.rs:2689/2699/2730/2751/5714/5720/5765, 3685) only assert the no-op.
  2. sam.rs — test-only surface: propose_for_context (1070-1110), propose_conditional_continuations (1118-1189, doc claims a 2-deep pipelined consumer that does not exist), MatchSource/source (64-82), PromptSAM::build (283), push_slice (1023), accessor block (462-476, 949-984), and now also SamConfig/with_config/from_shared_prompt/config()/prompt_sam() (41-61, 929-955) — production only calls new (scheduler.rs:1852) which uses SamConfig::default(). Module doc (sam.rs:9-13) claims zero-copy Arc sharing across requests that never happens. ~150 lines + tests.
  3. scheduler.rs:1094-1097 history_proposal lost both production callers in this PR (packing.rs:402 and server/runtime.rs:2146 moved to request_history_proposal); now only tests call it (scheduler/tests.rs×8, phase_tests.rs:583/1835). It is also the prompt-blind bypass the PR is replacing. Delete; re-point the test at request_history_proposal.
  4. rounds.rs:755-903 duplicates rounds.rs:925-1060 statement-for-statement (~110 lines) plus the curves/copy_curves twin memo arrays (747-748). One loop with a lane-list argument and a curve provider.

Nits (4): draft_source ladder written 3× (serving.rs:58-63, python.rs:225-233, selection.rs:144-148) though ProposalSource::parse exists; request_copy_match_stats (scheduler.rs:1163-1205) duplicates the arbitration in request_history_proposal_with_match_len (1112-1159) with no test they agree; two 6 match thresholds (speculation.rs:18, sam.rs:22); unreachable else in wide_copy_curve (rounds.rs:545-548).

Rules cited: docs/design-review.md:16 ("Keep Helios as simple as possible"), AGENTS.md:231 (scheduling changes must follow docs/scheduling-runtime-design.md).

Open question for the author: is propose_conditional_continuations the front half of an unlanded PR? Nothing in the tree says.

#11 [high] Research summary

Re-reviewed PR #540 at head 1401971 through the simplicity lens, reading each changed function in its surrounding code and following callers. Four should-fix findings and four nits; no blockers. Full text is scratchpad entry #10 (detail in #1, #2, #4, #6, #7, #8, #9).

Should fix

  1. RefreshState::idle is an empty function (helios/src/scheduler/refresh.rs:95-99) carrying a five-line doc comment that describes behaviour it no longer implements — retention is now the absence of mutation. RequestScheduler::idle (scheduler.rs:1277-1283) still validates the queue and calls it, and server/runtime.rs:1184 still calls that. Delete the method and collapse the wrapper; several policy tests only assert the no-op survives.

  2. sam.rs exports ~150 lines with no production caller: propose_for_context, propose_conditional_continuations (whose doc names a "2-deep pipelined execution" that exists nowhere in the tree), MatchSource/MatchProposal::source, PromptSAM::build, push_slice, the accessor block — and, newly confirmed this pass, the entire SamConfig/with_config/from_shared_prompt layer, since production only calls PromptOutputSAM::new with defaults. The module doc claims zero-copy Arc sharing across requests that never happens; each admission builds a private automaton (scheduler.rs:1849-1852).

  3. New this pass: RequestScheduler::history_proposal (scheduler.rs:1094-1097) lost both of its production callers in this PR — packing.rs:402 (not opened) and server/runtime.rs:2146 were moved to request_history_proposal. It is now reachable only from tests, and it is also the prompt-blind lookup path the PR exists to replace, so leaving it public works against the change. Re-point its test at the handle-keyed API and delete it.

  4. New this pass: rounds.rs:755-903 re-implements rounds.rs:925-1060 statement for statement (~110 lines: prefix ranking, the 3-ordering cohort loop, frontier bookkeeping, the (mask.count_ones(), Reverse(mask)) tie-break, the expected recompute and Candidate construction), with twin per-slot memo arrays at rounds.rs:747-748. One loop with a lane-list argument and a curve provider removes it.

Nits: the 0/1/2 → Option<ProposalSource> ladder written three times though ProposalSource::parse exists; request_copy_match_stats duplicating the arbitration rule of request_history_proposal_with_match_len with no test they agree; two separate 6-token match thresholds (speculation.rs:18, sam.rs:22) whose equality is what makes the second gate meaningful; and an unreachable non-calibrated branch in wide_copy_curve (rounds.rs:545-548).

One question to settle with the author: whether propose_conditional_continuations is the front half of an unlanded follow-up; if so, naming it converts finding 2 from "delete" to "lands with its consumer".

#12 [high] Cleared at head 1401971 — what I checked and found load-bearing (so the report can scope its "no blocking" claim)

Simplicity lens, head 1401971. Areas I read in context and cleared — every path below has a live non-test caller, so the report should say the rest of the diff reads as load-bearing, not merely unexamined:

Cleared-but-not-note-worthy: no over-commented blocks beyond refresh.rs:95-99; no #[allow(dead_code)]; no feature flags or env-var fallbacks added.

Rules cited for the report: docs/design-review.md:16 ("Keep Helios as simple as possible"), AGENTS.md:231 (scheduling changes must follow docs/scheduling-runtime-design.md), AGENTS.md:338 (same simplicity principle, cited via entry #5).

#14 [high] Research summary

Verdict: should-fix issues only — two small should-fix, three nits. No blocking issues.

This round reviewed head e5a69669 against docs/design-review.md:16 ("Keep Helios as simple as possible") and AGENTS.md's simplicity rule. The commit deleted most of what the previous review flagged and I verified each deletion landed: RefreshState::idle no longer exists (refresh.rs ends at 99), SamConfig/with_config/from_shared_prompt/propose_for_context/propose_conditional_continuations/MatchSource are gone and the remaining accessors are #[cfg(test)] (sam.rs:420-436, 681, 819-826), the 0/1/2 ladder is now ProposalSource::from_wire/to_wire (speculation.rs), and the duplicated copy-cohort loop is now one factored path (build_host_prefix_ranking rounds.rs:505-527 + select_host_allocated_candidate rounds.rs:764-862, called from both the copy branch at 927-934 and the ordinary host branch at 963-971). What remains:

Should fix

  1. helios/src/scheduler.rs:1101-1104 — pub fn history_proposal(&self, context, maximum) still has no production caller. Both production call sites were moved to the handle-keyed API in this PR: helios/src/model/packing.rs:405 and helios/src/server/runtime.rs:2146 call request_history_proposal; only scheduler/tests.rs:1956-1991 and phase_tests.rs:583,1835 still call history_proposal. It is also the prompt-blind bypass this PR exists to replace (it goes straight to DecodedHistory::lookup, decoded_history.rs:180-183), so leaving it pub invites a future caller to reintroduce prompt-blind drafts. Fix: delete the wrapper and move that test's shared-ring assertions onto request_history_proposal — the test already admits a live request, so the handle-keyed path is both smaller and the faithful one.

  2. helios/src/scheduler.rs:1267-1277 — RequestScheduler::idle is now a pure validator (if !self.submissions.is_empty() { Err }) under a five-line doc comment describing refresh-credit retention that it does not implement, invoked from server/runtime.rs:1184. The retention is now simply the absence of mutation in refresh.rs:71-99, so the name and the comment both point at behaviour that lives elsewhere. Fix: rename to assert_idle, cut the doc to one line ("no execution may be in flight while the worker waits"), and let docs/scheduling-runtime-design.md carry the retention argument (refresh.rs:95-99 abort is the only discard path).

Nits

  1. helios/src/scheduler/rounds.rs:920-926 — probabilities[slot] = curve.clone() copies the whole per-slot forecast vector once per shape per lane, and the memo arrays curves/copy_curves (874-875) still exist in parallel although both feed the same build_host_prefix_ranking. Smaller version: one [Option<Vec<f64>>; REQUEST_LANES] where the warm-start provider is just the curve source, and pass &[f64] (or Cow) into the ranking builder instead of cloning.

  2. helios/src/model/catalog.rs:240-245 — select_shape_with_drafts now has no caller at all: catalog.rs:133 validates via select_shape_with_source, runtime.rs:2238 dispatches via select_shape_with_source, and select_shape (233) goes straight to it. The wrapper exists only to pass None; delete it and let select_shape call select_shape_with_source directly.

  3. helios/src/scheduler/speculation.rs:25 and helios/src/scheduler/sam.rs:23 — two independent 6s for one threshold (WIDE_COPY_MIN_MATCH_LEN vs DEFAULT_MIN_MATCH_LEN, used at rounds.rs:905 and inside propose), tied together only by prose. Make rounds.rs reference sam::DEFAULT_MIN_MATCH_LEN, or drop the rounds gate since propose already enforces it.

What I could not finish: I did not re-run the GPU or Rust test suites at this head, and I did not re-read every unmodified hunk of binding.rs, selection.rs, serving.rs and policy.rs this round; my earlier pass cleared those as single-authority gates. The two should-fix items are deletions/renames that need no behavioural test — a one-line confirmation from the author that history_proposal is not an out-of-tree API would settle item 1 the other way.

#15 [high] Report of 2026-11-26, run 4 — final simplicity verdict at head e5a6966

Review of PR #540 (simplicity lens) at head e5a69669, 33 files, +4306/−310.

Verdict: should-fix issues only. No blocking findings. Standard applied: docs/design-review.md:16 "Keep Helios as simple as possible"; AGENTS.md simplicity rule (cited in earlier entries #5/#13 as AGENTS.md:338).

Verified as landed (so the report can credit the cleanup and not re-flag it)

The e5a69669 commit removed nearly everything the previous pass flagged, and I checked each by search:

Should fix

  1. helios/src/scheduler.rs:1101-1104 — pub fn history_proposal(&self, context: &[u32], maximum: usize) has no production caller. Both production call sites were moved off it in this PR: helios/src/model/packing.rs:405 (scheduler.request_history_proposal() and helios/src/server/runtime.rs:2146 (self.scheduler.request_history_proposal(). Remaining callers are tests only: helios/src/scheduler/tests.rs:1956, 1970, 1972, 1973, 1974, 1979, 1985, 1991, 2069 and helios/src/server/runtime/phase_tests.rs:583, 1835. It is also the prompt-blind bypass the PR exists to replace — it ignores LiveRequest.sam entirely and goes straight to DecodedHistory::lookup (decoded_history.rs:180-183). Leaving it pub lets a future caller silently reintroduce prompt-blind drafts. Fix: delete the wrapper; move the shared-ring assertions onto request_history_proposal (the test already admits a live request a/h, so the handle-keyed path is both smaller and faithful). Keep DecodedHistory::lookup as pub(crate) for the ring's own oracle test (decoded_history.rs:199-297).

  2. helios/src/scheduler.rs:1267-1277 — RequestScheduler::idle is now a pure validator carrying a 5-line doc comment about refresh credit it does not implement. Body is only if !self.submissions.is_empty() { return Err("idle requires no submitted execution") } Ok(()). Called from helios/src/server/runtime.rs:1184. Credit retention is now just the absence of mutation (refresh.rs:71-99; abort at 95-99 is the only discard). Fix: rename to assert_idle, cut the doc to one line, and leave the retention argument to docs/scheduling-runtime-design.md / docs/scheduling-theory.md (which the PR already updated). Tests that call s.idle().unwrap() then assert credit unchanged (policy_tests.rs:2612, 2640, 2691, 2701, 2732, 2753, 6102, 6108, 6153) still work after the rename; the only meaningful one is policy_tests.rs:2628 (assert!(s.idle().is_err())).

Nits

  1. helios/src/scheduler/rounds.rs:920-926 — the copy branch does let curve = copy_curves[slot].get_or_insert_with(...); probabilities[slot] = curve.clone(); i.e. a full per-slot forecast vector clone for every shape×lane, and curves/copy_curves (874-875) are still two parallel memo arrays feeding the same build_host_prefix_ranking. Smaller: one memo array plus a curve-source parameter, and pass &[f64] into the ranking builder instead of cloning. build_host_prefix_ranking takes mut probabilities: Vec<Vec<f64>> and resizes it (509, 525), so slices would need a small signature change.

  2. helios/src/model/catalog.rs:240-245 — select_shape_with_drafts now has no caller: catalog.rs:133 validates with select_shape_with_source, runtime.rs:2238 dispatches with select_shape_with_source, and select_shape (233-238) forwards to select_shape_with_drafts only to pass None. Delete the wrapper and have select_shape call select_shape_with_source(..., None, mode) directly.

  3. helios/src/scheduler/speculation.rs:25 vs helios/src/scheduler/sam.rs:23 — two independent 6s for one threshold: WIDE_COPY_MIN_MATCH_LEN gates copy lanes at rounds.rs:905 and DEFAULT_MIN_MATCH_LEN gates inside propose (sam.rs:1055 even asserts DEFAULT_MIN_MATCH_LEN == 6); related only by prose (speculation.rs:22-24 says "Matches sam::DEFAULT_MIN_MATCH_LEN"). Have rounds.rs reference sam::DEFAULT_MIN_MATCH_LEN, or drop the rounds gate since propose already enforces it.

Cleared this pass (read in context, live production callers)

Could not verify / limits

#17 [high] Report of run 5 — simplicity verdict at head 982a9ce (narrowed PR)

PR #540 simplicity review, head 982a9ce (10 files, +647/−47)

Rules: docs/design-review.md:16 "Keep Helios as simple as possible"; AGENTS.md:338 same rule; AGENTS.md:188-193 "Reject unsupported abstractions and churn… Refactoring must directly support the requested behavior"; AGENTS.md:43-65 + .agents/skills/repo-prose/SKILL.md ("documentation is a present-state specification", "comments explain invariants… state evidence as conditions"); charter line 12 (keep runtime small).

Verdict: should-fix (small) only; no blocking.

Should fix 1 — helios/src/scheduler.rs:1158-1168

idle() is now a pure validator (submissions.is_empty()); this PR deleted its only action (self.refresh.idle()). It keeps the name idle plus a five-line doc comment arguing credit retention that the function does not perform — retention is now simply the absence of a mutation, and RefreshState::abort (refresh.rs:95-99) is the only discard. Rename to assert_idle (or inline into the single caller, server/runtime.rs:1184) and cut the doc to one line; the retention argument belongs in docs/scheduling-runtime-design.md:443-444, already updated. Nine s.idle().unwrap() assertions in policy_tests.rs are a search-and-replace; only policy_tests.rs:2483 checks the Err.

Should fix 2 — helios/src/scheduler/policy_tests.rs:5812-5878 vs 4364-4406

New large_prefill_engine is a near-copy of the existing engine_with_terminal_prefill: same shape (prefill_graphs → terminal_prefill_graphs → duration_graphs(1) → filter → push GraphDescriptor per capacity → measured_graph_durations). ~66 duplicated lines differing only in scheduler limits, the capacity lists and two duration constants. Fix: one builder prefill_engine(prefill: &[usize], terminal: &[usize], prefill_ns: impl Fn(usize)->u64, terminal_ns: impl Fn(usize)->u64) with the limits as a parameter; both tests call it. Per AGENTS.md:188-193 this is test churn that supports the change, not a new capability.

Nit 3 — helios/src/scheduler/cost.rs:37-45 vs 330-337

Two implementations of one rule: observed_compute_duration_ns (gpu max > 0, None if <= wait_ns, subtract wait) and ActionCosts::observe (saturating_sub, return when the sample is 0). The doc comment at 31-36 asserts they mirror each other — an invariant kept by hand. Extract the shared sample (fn compute_sample(timing) -> Option<u64>) and let observe call it; observed_compute_duration_ns then only adds the isolated-execution max(wall_ns).

Nit 4 — helios/src/scheduler/cost.rs:47-52

Doc claims "ensuring every validated refresh completion incurs a strictly positive charge", but the function's last fallback is timing.wall_ns, which is 0 when GPU timing is absent and the completion was non-isolated; positivity comes from RefreshState::validate_completion (refresh.rs:63-69) rejecting exactly those probes. State the guarantee where it lives ("positivity is enforced by validate_completion on the probe path") per repo-prose.

Nit 5 — helios/src/scheduler/cost.rs:441-503 vs policy_tests.rs:6060+ / 6143-6181

The new cost.rs unit test and the two new policy tests both drive readiness-exclusion and the wait_ns >= gpu_ns fallback. Keep the boundary matrix (<, ==, wall_ns 0/>0) in one place; policy_tests already proves the same rule end-to-end through complete/plan, and cost.rs:465-501 only re-derives it at helper level. Also compute_refresh_duration_excludes… asserts timing_refresh_duration_ns three times per case where one derived check would do.

Nit 6 — scripts/scheduling_sim/learning.py:105-109, 132, 478-483 + parser:439-440

retain_idle_credit must be added to four hand-maintained tuples (defaults filter, non-sweepable set, validation-override list, parser). The four lists already drift-pair (partial_blocks, mean_estimator). Derive the non-sweepable boolean set from dataclasses.fields(PolicyConfig) types once (frozen, hashable), so a new boolean costs one line. PolicyConfig.retain_idle_credit (learning_policy.py:47) also applies to every policy although only retained-refresh reads it (learning_policy.py:674) — either restrict it in __post_init__ or document that it is inert elsewhere.

Verified clean / already deleted (do not re-flag)

Limits

Did not run cargo/pytest at this head. Should-fix 1 and 2 are a rename and a test refactor; neither needs a behavioural test. Should-fix 2 needs the two builders to produce identical descriptors before the merge.

#18 [high] Research summary

Simplicity review of PR #540 at head 982a9ce (10 files, +647/−47 — the PR has been narrowed from 33 files since my previous pass, removing SAM/history copy-drafting, wide copy-verify and padding pruning).

Verdict: should-fix issues only. No blocking issues. Judged against docs/design-review.md:16 / AGENTS.md:338 ("Keep Helios as simple as possible"), AGENTS.md:188-193 (no unsupported abstractions or churn; refactoring must support the requested behaviour), and the repo-prose skill (AGENTS.md:43-65).

Should fix (2): (1) helios/src/scheduler.rs:1158-1168 — idle() became a pure submissions.is_empty() validator whose only action this PR deleted, yet it keeps the name idle plus a five-line comment arguing refresh-credit retention it does not implement; rename to assert_idle/inline into its single caller (server/runtime.rs:1184) and cut the doc, keeping the argument in docs/scheduling-runtime-design.md:443-444. Nine test call sites are a search-and-replace. (2) helios/src/scheduler/policy_tests.rs:5812-5878 — the new large_prefill_engine duplicates the existing engine_with_terminal_prefill (4364-4406) almost line for line (~66 lines) except for limits, capacity lists and two duration constants; factor one prefill_engine(prefill, terminal, prefill_ns, terminal_ns) builder.

Nits (4): cost.rs:37-45 vs cost.rs:330-337 keep two hand-mirrored implementations of the same compute-duration rule (extract one compute_sample); cost.rs:47-52's doc claims strict positivity that actually comes from RefreshState::validate_completion (refresh.rs:63-69); the new cost.rs:441-503 boundary matrix repeats rule coverage already proven end-to-end at policy_tests.rs:6060+; retain_idle_credit had to be added by hand to four parallel tuples in scripts/scheduling_sim/learning.py (105-109, 132, 478-483, 439-440) that can be derived once from PolicyConfig field types, and the option is inert for every policy except retained-refresh (learning_policy.py:674).

Verified as genuinely deleted/consolidated (so not re-flagged): RefreshState::idle is gone and abort owns the only clamp, refresh_order is back to observed_at_ns.max(last_attempt_ns), complete is one match with no duplicated arithmetic, and history_proposal again has production callers (model/packing.rs:402 (not opened), server/runtime.rs:2145) so my earlier should-fix is withdrawn. The two docs changes are present-state specifications that match the code. I did not run cargo/pytest at this head; both should-fix items are a rename and a test refactor that need no behavioural test. Full detail is in scratchpad entry #17.

#4 [medium] nit: two duplicated mappings/arbitrations worth collapsing

Two duplicate-logic items seen in the diff but not written up in detail before the time limit:

  1. nit — draft_source decoding is written four times with the same 0 => None, 1 => Mtp, 2 => Copy, _ => error ladder, each with its own error text:

    • helios/src/runtime_core/serving.rs:55-64 (invalid("unknown graph draft source"))
    • heliopause/src/python.rs:223-232 (PyValueError::new_err("unsupported graph draft_source"), plus a default-to-Mtp rule when the key is absent, which the other three do not have)
    • helios/src/execution/manifest.rs:841-850 (validation: copy ⇒ confidence_width == 0)
    • helios/src/runtime_core/selection.rs:144-148 + 166-190 (same ladder again for the speculative_proposal_source config string, now needed in two scopes because the source binding moved above the maximum computation) Smaller version: one ProposalSource::from_wire(u32) -> Result<Option<ProposalSource>> with the absent-key default handled at the one place that needs it (python.rs), like GraphKind::try_from is already used. That is one conversion and one error message instead of four.
  2. nit — helios/src/scheduler.rs:1163-1205 request_copy_match_stats duplicates the arbitration rule of request_history_proposal_with_match_len (1112-1159): both clamp maximum the same way, both return (0/[-1], 0) when decoded_history.is_none(), both truncate the SAM proposal at the first out-of-vocabulary token, and both implement "prefer shared history only when shared_match > sam.match_len". The two differ only in whether a padded upload vector is built. Smaller version: keep request_copy_match_stats as the primitive returning (count, match_len) and have request_history_proposal_with_match_len build the padded vector from the winning source (it needs the tokens anyway, and propose is O(1) amortized). One copy of the tie-break rule, so the invariant the PR description states ("shared ring wins only on a strictly longer match") cannot drift between the packing path and the scheduling path — today they agree, but nothing tests that they do.

Neither is blocking. Both are worth mentioning as deletions, since each removes a parallel path that must otherwise be kept in sync.

#9 [medium] nit: two 6-token match thresholds and a dead wide_copy_curve fallback

Verified at head 1401971. Two small leftovers in the new wide-copy path.

  1. nit — two constants for one threshold. speculation::WIDE_COPY_MIN_MATCH_LEN = 6 (helios/src/scheduler/speculation.rs:18) gates wide copy eligibility at rounds.rs:776 (if match_len < speculation::WIDE_COPY_MIN_MATCH_LEN ... continue), while sam::DEFAULT_MIN_MATCH_LEN = 6 (helios/src/scheduler/sam.rs:22, via SamConfig::default(), sam.rs:56) is the threshold inside propose, so a proposal never reports match_len below it. The second gate is only meaningful because the two are equal by coincidence; sam.rs:1287 even asserts DEFAULT_MIN_MATCH_LEN == 6. Raise the SAM default to 8 and the rounds gate becomes subsumed; lower it to 4 and the rounds gate does all the work. One constant (or rounds.rs referring to DEFAULT_MIN_MATCH_LEN) removes the coincidence; today nothing states the relationship in a comment.

  2. nit — unreachable fallback arm. wide_copy_curve (helios/src/scheduler/rounds.rs:541-553) has an else arm producing a raw geometric prior when request.copy_calibration is None. copy_calibration and decoded_history are both created from the same condition at admission (helios/src/scheduler.rs:1849-1856: .decoded_history.is_some().then(...) twice), and the copy-only block requires self.decoded_history.is_some() (rounds.rs:759) before any curve is taken, so copy_calibration is always Some on that path — and expected_copy_tokens (rounds.rs:555) is only called under is_copy_only_step (scheduler.rs:2507-2518), for graphs the loader only retains with --history-drafts (runtime_core/selection.rs:184 retain_wide_copy). A 3-line expect/unwrap (or taking &CopyCalibration as the argument) says the same thing without an unreachable branch. Note: only tests construct schedulers with copy graphs and no history, so this is inference from the constructors, not something a test currently contradicts.

Both are small; listed as nits, not asked to block.

#19 [medium] Supersession: earlier #540 reports are for older heads

PR #540 was reworked several times. Only notes #17 (head 982a9ce, 10 files, +647/−47) and the raw findings it summarises are current.

Superseded / no longer applicable, do not carry into the final report as live findings:

Only #17 should be used as the basis for the simplicity-lens report on PR #540.