Final review report · NVIDIA/hyperflare-inference #655

Raw Markdown for agents: https://autobot.eidonix.com/p/e4e358d0-7b8b-465e-873d-77f3b8fd5903.md

Recommendation: Changes Requested

PR #655 is a lean, well-scoped (~20 net production lines) fix for three genuine upstream serving scenarios where ActionCosts::fresh_duration(GraphKind::Snapshot, 1) self-locks terminal Endpoint checkpoint capture behind unknown_cost skips, backed by clean live SM120 A/B evidence and green CI. There are no merge-blocking defects, but three should-fix issues remain before landing: the Fixes #534 claim auto-closes an issue whose cold-boot premise was rebutted twice as fork-specific without addressing that thread, two supporting design docs now contradict the updated rule in docs/scheduling-runtime-design.md, and under concurrent Snapshot work (or client cancel before Snapshot execution) a burned probe slot can fail to refresh smallest_batch_key.

Merge Risk

Level: Low

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. Do not auto-close #534 without addressing its fork-specific premise (PR description): Issue #534 reported a cold-boot captures == 0 deadlock that both mark-yong (2026-11-28) and flare-autobot (2026-11-30) traced to a third-party fork (AzallazA/hyperflare-inference, PrefillTailMerge). This PR fixes three genuinely reproducible upstream scenarios (>30 s decode, >30 s idle on a cached anchor, warm disk/pool restart) rather than #534's cold-boot deadlock. Change Fixes #534 to Related to #534 (or explicitly document the upstream vs. fork distinction on #534) so merging does not silently close the issue under a disputed premise.
  2. Update the contradicting checkpoint-rule docs (docs/core-design.md:1452-1453, helios/README.md:378-379): Both files still state the pre-change rule ("Unknown prefill costs or unknown or stale snapshot-copy costs exclude extras without excluding the selected anchor" and "Unknown costs exclude extras while preserving best-effort anchor retention"), directly contradicting the new terminal-capture probe now documented at docs/scheduling-runtime-design.md:620-626. Per AGENTS.md:52-60 (and merged precedents #285 and #568), add a one-clause update to both files so the specification stays consistent across documents.
  3. Handle probe-slot loss under concurrent batch > 1 Snapshot coalescing and pre-execution cancellation (helios/src/scheduler/checkpoints.rs:1071-1074, helios/src/scheduler/cost.rs:783-786, 865-890):
    • probe_duration / fresh_duration target only self.batches(GraphKind::Snapshot).first() (typically batch = 1), while ActionCosts::observe (cost.rs:865-890) updates only step.batch_capacity. On cores exporting multiple Snapshot batch sizes (ignition/components/capacity.py:66-68), if a probed terminal capture shares a select_plan tick with another RequestPhase::Snapshot request (e.g., an unconditional Anchor capture at checkpoints.rs:962-963, a ConditionedWindow capture at scheduler.rs:2864-2866, or a finish_early/preempt_newest capture at scheduler.rs:1447-1450), policy.rs:1147-1156, 1424-1426 selects the wider batch >= 2 cohort whenever both batches are unmeasured or both are stale. observe then records batch >= 2, leaving fresh_duration(GraphKind::Snapshot, 1) == None while last_probe_ns is already burned for 30 s.
    • Similarly, if a client cancels (scheduler.cancel, scheduler.rs:3022-3024, 3116) in the window between allocate_terminal_capture (at EOS) and Snapshot execution, the global TTL slot stays burned with no observation.
    • Important constraint on the fix: Do not simply move record_probe to completion—if multiple requests finish in the same complete_inner loop (scheduler.rs:2854-2903) or before the first Snapshot step finishes, leaving last_probe_ns unstamped at allocation would admit multiple concurrent probes at once (violating the 1-per-TTL bound and immediately forcing batch > 1 coalescing). Instead, keep allocation-time gating, clear/restore last_probe_ns if a probing request retires without its probed Snapshot key being observed (or allow fresh_duration / probe refresh to be satisfied or retried when a coalesced batch runs), and add an end-to-end plan -> commit -> complete test verifying that a probed terminal capture closes the loop through observe_execution.

Subtract / Simplify

  1. Collapse the triplicated unknown_cost skip in allocate_terminal_capture (helios/src/scheduler/checkpoints.rs:1032-1049): Three separate branches increment self.stats.checkpoint_skip_unknown_cost += 1 and return Ok(None). Computing fresh, probed, and cost once and matching (cost, accounting.initial_prefill_ns) collapses 18 lines to ~11 with a single skip/return site:
    let fresh = self.costs.fresh_duration(GraphKind::Snapshot, 1);
    let probed = fresh.is_none() && self.policy.checkpoint_extra_work_fraction > 0.0;
    let cost = match fresh {
        Some(cost) => Some(cost),
        None if probed => self.costs.probe_duration(GraphKind::Snapshot, 1),
        None => None,
    };
    let (Some(cost), Some(prefill)) = (cost, accounting.initial_prefill_ns) else {
        self.stats.checkpoint_skip_unknown_cost += 1;
        return Ok(None);
    };
    
  2. De-duplicate the verbatim test fixtures in helios/src/scheduler/cost.rs:1016-1055: probe_duration_uses_smallest_declared_batch_and_bounds_by_ttl repeats the exact 15-line GraphDescriptor and 10-line ScheduledStep literals from fresh_duration_uses_smallest_declared_batch_when_batch_one_is_absent directly above it (cost.rs:983-1008). Extracting a tiny shared helper (e.g., fn snapshot_b2_fixture() -> (ActionCosts, ScheduledStep)) removes ~30 lines of boilerplate.

Nits

Dropped on verification