Simplicity report · NVIDIA/hyperflare-inference #540

Raw Markdown for agents: https://autobot.eidonix.com/p/4ab81c09-6914-4524-952b-eebfd1486457.md

Review of PR #540 — simplicity lens (what can be deleted)

Head e5a69669, 33 files, +4306/−310. Rules applied: docs/design-review.md:16 (not opened) ("Keep Helios as simple as possible"), AGENTS.md (not opened)'s simplicity rule (the same principle; scheduling changes must also follow docs/scheduling-runtime-design.md (not opened), AGENTS.md:231 (not opened)), and the charter's runtime-size constraint (charter line 12: keep the runtime small and model-agnostic).

Key findings

What this PR already cleaned up (verified, so the report does not re-flag it)

I checked each by search at this head:

Should fix

1. helios/src/scheduler.rs:1101-1104 — history_proposal became test-only in this PR, and it is the prompt-blind path the PR replaces

pub fn history_proposal(&self, context: &[u32], maximum: usize) -> (Vec<i64>, usize) {
    let maximum = maximum.min(self.capabilities.completion_token_capacity - 1).min(speculation::COPY_DRAFT_CAPACITY);
    self.decoded_history.as_ref().map_or((vec![-1; maximum], 0), |history| history.lookup(context, maximum))
}

Why it matters. Both production call sites were moved off it by this PR: helios/src/model/packing.rs:405 and helios/src/server/runtime.rs:2146 now call scheduler.request_history_proposal(...). The only remaining callers are tests: scheduler/tests.rs:1956 (not opened), 1970, 1972-1974, 1979, 1985, 1991, 2069 and server/runtime/phase_tests.rs:583 (not opened), 1835. Worse than dead code, it is exactly the prompt-blind behaviour the PR is fixing — it ignores LiveRequest.sam entirely and goes straight to DecodedHistory::lookup, so leaving it pub invites a future caller to silently reintroduce prompt-blind drafts. It also duplicates the capacity clamp that clamp_copy_capacity (scheduler.rs:1106-1110) already owns.

Fix. Delete the method. Move the shared-ring assertions in scheduler/tests.rs:1950-1991 (not opened) onto request_history_proposal — that test already admits live requests (a/b at 2064-2070 in the same file), so the handle-keyed path proves the same ring behaviour and additionally proves the SAM/ring arbitration the PR adds. Keep DecodedHistory::lookup visible to the ring's own oracle test in decoded_history.rs (make it pub(crate) if the deletion removes its last pub user). Net: −4 lines here, −1 duplicated clamp, −1 bypass route.

2. helios/src/scheduler.rs:1267-1277 — idle is a validator with a doc comment describing work it does not do

/// Validates that no execution is in flight across an idle gap.
///
/// Timing-refresh and acceptance-learning ledgers retain bounded earned credit
/// (`<= CREDIT_CAP_NS`) and negative debt across idle intervals because idle adds
/// neither credit nor ordinary duration.
pub fn idle(&mut self) -> Result<()> {
    if !self.submissions.is_empty() { return Err("idle requires no submitted execution".into()); }
    Ok(())
}

Why it matters. The body only validates the queue. Credit retention is now simply the absence of any mutation (refresh.rs:71-99; abort at 95-99 is the only discard path), so the doc comment and the name both point a reader at behaviour that lives elsewhere — the previous round's complaint about the empty RefreshState::idle survives here as a vestigial name plus a five-paragraph-argument comment on a three-line function. The single production caller is server/runtime.rs:1184.

Fix. Rename to assert_idle (or move the submissions.is_empty() check into the call site), cut the doc to one line ("no execution may be in flight while the worker waits"), and leave the retention argument to docs/scheduling-runtime-design.md (not opened) / docs/scheduling-theory.md (not opened), which the PR already updated. The nine s.idle().unwrap() credit-retention assertions in policy_tests.rs:2612 (not opened), 2640, 2691, 2701, 2732, 2753, 6102, 6108, 6153 keep working after the rename (a search-and-replace); the only semantically meaningful one is policy_tests.rs:2628 (not opened) (assert!(s.idle().is_err())).

Nits

3. helios/src/scheduler/rounds.rs:874-875, 920-926 — one clone per shape×lane and two parallel memo arrays for one purpose

The copy branch does let curve = copy_curves[slot].get_or_insert_with(...); probabilities[slot] = curve.clone(); — a full per-slot forecast vector clone for every shape×lane — then hands the owned Vec<Vec<f64>> to build_host_prefix_ranking, which only reads it and resizes it (rounds.rs:509, 515, 525). curves and copy_curves (874-875) are two arrays of the same type feeding the same builder, one for MTP and one for copy.

Smaller version. One [Option<Vec<f64>>; REQUEST_LANES] memo, parameterised by a curve source (the wide_copy_curve vs powered_curve choice), and take &[Vec<f64>] / &[&[f64]] in build_host_prefix_ranking instead of an owned, mutated vector — the resize at 525 exists only because the caller passes an array sized for REQUEST_LANES but partially filled.

4. helios/src/model/catalog.rs:240-245 — select_shape_with_drafts has no caller outside select_shape

select_shape_with_drafts (240-245) forwards to select_shape_with_source(..., None, mode). Its only caller is select_shape (237), which exists only to hard-code drafts = 0. catalog.rs:133 validates through select_shape_with_source directly and server/runtime.rs:2238 dispatches through select_shape_with_source, so the drafts-taking wrapper is a leftover of the pre-source plumbing. Fix: have select_shape call select_shape_with_source(..., 0, None, mode) directly and delete the 240-245 wrapper (the same drafts argument already reaches select_shape_with_source at 249).

5. helios/src/scheduler/speculation.rs:25 vs helios/src/scheduler/sam.rs:23 — two independent 6s for one threshold

WIDE_COPY_MIN_MATCH_LEN = 6 gates copy lanes at rounds.rs:905; DEFAULT_MIN_MATCH_LEN = 6 gates inside propose (sam.rs:853), and sam.rs:1055 even asserts DEFAULT_MIN_MATCH_LEN == 6. They are related only by prose (speculation.rs:22 says "Matches sam::DEFAULT_MIN_MATCH_LEN"). Two constants for one user-visible threshold is a drift hazard the PR's own docs then have to keep consistent (docs/mtp-design.md (not opened), docs/cli-design.md (not opened)). Fix: have rounds.rs:905 reference sam::DEFAULT_MIN_MATCH_LEN, or drop the rounds gate entirely since propose already refuses matches shorter than it — the copy lane's match_len < 6 check is then redundant with the proposal it just received.

Cleared (read in context, live production callers — so the "no blocking" claim is scoped)

Open questions

  1. Is history_proposal intended as a stable out-of-tree/embedding API? Nothing in the tree or the PR description says so, and it has no in-tree non-test caller; a one-line reply settles item 1 the other way.
  2. Does anything plan to consume speculation::WIDE_COPY_MIN_MATCH_LEN separately from sam::DEFAULT_MIN_MATCH_LEN? If the gates are meant to diverge later, item 5 becomes a comment fix rather than a deletion.

Limits