Final review report · NVIDIA/hyperflare-inference #660

Raw Markdown for agents: https://autobot.eidonix.com/p/147f04b9-1b0d-4bd4-9135-eb37e9d1cf2e.md

Recommendation: Changes Requested

The core scheduler change in helios/src/scheduler/checkpoints.rs is lean, well-motivated, and well-tested—closing the fraction == 0.0 vs. nonzero-fraction discontinuity for interior conversation anchors without adding flags, config knobs, ABI surface, or unsafe, backed by strong 4× RTX PRO 6000 A/B results on 22cac916834f vs. 5d53040e. However, generalizing the anchor check from 0.0 to arbitrary fractions left two anchor-decision sites (request_anchor_endpoint vs. checkpoint_selection_uncached) using different budget bases and spent-work rules, and helios/README.md (required reading for scheduling changes per AGENTS.md:227) was left contradicting the new contract. Fixing those two items will make this ready to land.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. Unify the two diverged anchor-affordability decision sites (helios/src/scheduler/checkpoints.rs:500-516 vs. :588-601). Under #582 (fraction == 0.0), allowance(base, 0.0) was always 0 and split_ns == 0 did not depend on extra_spent_ns, so both sites agreed. After generalizing to fraction > 0.0, checkpoint_selection_uncached (:589-597) prices against budget_base = accounting.initial_prefill_ns.unwrap_or(whole) and checks split_ns == 0 || accounting.extra_spent_ns.saturating_add(split_ns) <= allowance(budget_base, fraction), while request_anchor_endpoint (:509) only checks split_ns <= allowance(whole, fraction)—ignoring request.checkpoints.initial_prefill_ns, request.checkpoints.extra_spent_ns, and the split_ns == 0 || exemption.

    • Verified impact: Whenever budgeted_anchor is absent or invalidated (for example, a preempted request whose grown prompt makes latched_prompt != request.prompt_tokens while carrying initial_prefill_ns and extra_spent_ns > 0, or after clear_reservations / policy updates):
      • promote_request_anchor (checkpoints.rs:857-886, called during commit at helios/src/scheduler.rs:2405 before commit_checkpoint_plans at :2406) can call request_anchor_endpoint, decide raw_anchor fits, and promote an already-ready cached raw_anchor to RetentionRole::Anchor, while checkpoint_selection_uncached on the next prefill step rejects raw_anchor (due to extra_spent_ns or initial_prefill_ns) and captures prompt_tokens as a second RetentionRole::Anchor.
      • is_request_anchor_endpoint (checkpoints.rs:519-522, called at helios/src/scheduler.rs:1797) can misclassify a full-prompt inbound restore (inbound.consumed_tokens == prompt_tokens, which does not hit the :449 short-circuit) as Endpoint instead of Anchor or vice versa.
    • Fix: Extract one private helper fn anchor_split_affordable(budget_base: u64, split_ns: u64, spent_ns: u64, fraction: f64) -> bool returning split_ns == 0 || spent_ns.saturating_add(split_ns) <= allowance(budget_base, fraction). Call it from both request_anchor_endpoint (passing request.checkpoints.initial_prefill_ns.unwrap_or(whole) and request.checkpoints.extra_spent_ns) and checkpoint_selection_uncached. Add a unit test asserting request_anchor_endpoint and checkpoint_selection return the same endpoint when extra_spent_ns > 0 (and initial_prefill_ns is set) without a matching budgeted_anchor latch.
  2. Synchronize helios/README.md:372-380 with the updated design docs. helios/README.md:372-380 (named in AGENTS.md:227 as required guidance for Helios scheduling changes) still states: "Checkpoint selection prioritizes the last eligible message boundary, using the prompt end when no message boundary is eligible. Earlier messages and a distinct prompt end compete within a work allowance of scheduler_checkpoint_extra_work_fraction times estimated uncached prefill work, defaulting to 0.05. Extra captures charge snapshot-copy cost and additional prefill caused by splitting chunks." This now contradicts docs/core-design.md:1434-1460, docs/cli-design.md:696-710, and docs/scheduling-runtime-design.md:613-630.

    • Fix: Update helios/README.md:372-380 to state that an interior message boundary is retained as the anchor only when its predicted split fits the request's extra-work allowance (falling back to the prompt end otherwise), and that a retained interior anchor charges its split work against the shared allowance while its anchor snapshot copy remains uncharged.

Subtract / Simplify

  1. Deduplicate split-overhead pricing (helios/src/scheduler/checkpoints.rs:438-441 and :685-701). Both anchor_split_ns and the optional-candidate loop compute the exact same before + after - whole interval formula with identical saturating semantics. Extract a single split_overhead_ns(request, catalog, terminal_window, left, whole, endpoint, right) -> Option<u64> helper so anchor and optional-cut pricing cannot drift.
  2. Deduplicate the zero-split test fixture setup (helios/src/scheduler/tests.rs:3305-3318 and helios/src/scheduler/boundary_tests.rs:74-85, 438, 569). Both repeat the same 100_000 + g.token_capacity as u64 prefill-duration loop and &[64, 128, 256, 512] capacity list. Extract a small helper next to duration_graphs (tests.rs:157), matching the existing linear_checkpoint_costs pattern (boundary_tests.rs:175-182).
  3. Avoid three-way prose duplication (docs/scheduling-runtime-design.md:614-627). Once helios/README.md is updated, the same rule will live in four places. Consider tightening docs/scheduling-runtime-design.md:614-627 to a concise summary with a cross-reference to docs/core-design.md#exact-endpoint-capture.

Nits

Dropped on verification