Final review report · NVIDIA/hyperflare-inference #705

Raw Markdown for agents: https://autobot.eidonix.com/p/beab3203-6206-46c8-ab6a-6e45d3e5e25c.md

Recommendation: Changes Requested

The state machine is sound: I traced every new progress edge, every parked/jobs/outbound mutation, and every can_retry_slabs() == false exit for a guaranteed future wake source, and found no correctness bug — no stall, no lost wakeup, no zombie waiter, no duplicate store() submission, no new panic path. What blocks it is the one thing the charter treats as non-negotiable for this PR class: a performance-titled "CPU storm" fix with no served-workload measurement on the patched build (Charter #210, docs/design-review.md:106-115), while issue #703 itself records that the storm was not reproduced on v0.5.3. Secondary: the mandated --locked --release (+--features test-support) Layer-1 runs were not performed (docs/design-review.md:180-184), docs/prefix-cache-offload.md still documents the pre-PR retry contract, and one accepted-publication path does its planning work twice.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

  1. No served-workload measurement for a performance claim — helios/src/server/runtime.rs + selene/src/composite.rs, PR title/summary. docs/design-review.md:106-115 (principle 12: "Performance claims require equivalent baselines … and actual Helios service measurements") and Charter #210 ("Performance PRs need benchmarks showing an actual speedup over main on a served workload") are hard requirements for this PR class. The only profile in evidence is issue #703's capture on the pre-fix flare 0.5.1 binary, and #703 states the storm was not reproduced on v0.5.3; there is no post-fix perf sample, no CPU% before/after, no latency number. Fix: attach one perf/CPU% before-after on #703's configuration (4× RTX PRO 6000 SM120, DeepSeek-V4.1-Flash TP4, --max-concurrency 64 --prefix-cache-memory 8G --prefix-cache-disk … --prefix-cache-disk-limit 100G) on the patched build, or retitle/downgrade the claim to the mechanism and state the mechanism-level evidence explicitly. This is an evidence-form gap, not a code defect — the code fixes the mechanism as described.

Should Fix

  1. Planning work is duplicated per accepted publication. selene/src/composite.rs:1423-1428 + :1452 + :1455 (can_retry_slabs) and :1328-1334 (store) independently call self.disk.plan_record(checkpoint) — an O(tail_pages) Vec<PageId> clone (selene/src/disk_store.rs:2516-2531) — and independently call has_spillable_slots. When can_retry_slabs returns true the worker immediately re-enters store() (helios/src/server/runtime.rs:2903) and repeats both, i.e. two clones and two scans per accepted publication. Fix: return the sizes rather than the vector (e.g. fn slab_need(&self, cp) -> Option<(Option<PrefixKey>, usize /*tail*/, usize /*needed*/, usize /*short*/)>) used by both callers, so plan_record's clone runs once per publication.
  2. Mandated Layer-1 profile was not run. docs/design-review.md:180-184 requires cargo test --locked --release on every affected crate, matching .github/workflows/native-serving.yml:51 (not opened),55,63,68 (selene also with --features test-support). The PR states "All checks ran in debug profile" and reports selene as cargo test --manifest-path selene/Cargo.toml (not opened) with no feature, so neither the release profile nor the test-support-gated selene tests were exercised. Fix: attach cargo test --locked --release for selene (with and without --features test-support) and helios --features runtime-core,server.
  3. docs/prefix-cache-offload.md still documents the pre-PR contract. The HostStore interface listing at :272-284 omits the new can_retry_slabs operation; the worker retry contract at :293-297 ("The worker retains only checkpoint IDs for retries after store progress…") no longer describes the retained per-ID reason plus the Slabs gate; the retention-metrics text at :1364-1372 still describes held_total{tier} per holding event and store_skipped "including duplicates and retries" — precisely the cadence the PR's own "Narrow Metric and API Shifts" changes (held[0] now accounted on progress-gated poll() ticks; deferred Slabs publications skipped by the gate never reach store()). AGENTS.md:52-58 requires a design document to state the behavior the code implements. Fix: update those three passages in this PR or in an explicitly linked follow-up.

Subtract / Simplify

  1. Dead branch — selene/src/composite.rs:903-905 (else if self.backoff_active() { break; }). Unreachable: the enclosing loop is guarded by :892 if writing < MAX_SPILLS && !self.backoff_active(), and retry_after is written in exactly two places (disk_stored, :668; poll, :1658), neither reachable from spill() → thin_rows/reserve_capture/start_write; and backoff_active() is monotone for a fixed retry_after. Delete the three lines.
  2. Collapse the four dedup collections to one claim helper — helios/src/server/runtime.rs:2791-2873. publication_index, seen_waiting, seen_copyouts and the fresh/prior_retry pair answer one question ("has this CheckpointId already been claimed this pass?"); the Vacant/Occupied block at :2803-2819 and the copyout block at :2857-2873 are the same shape written twice. A struct Pending { list: Vec<..>, at: HashMap<CheckpointId, usize> } with fn claim(..) plus an enum Prior { Fresh, Copyout, Retried(StoreReason) } removes seen_copyouts entirely and makes the contradictory fresh && prior_retry.is_some() state unrepresentable.
  3. Nine fully-qualified collection paths shadow an existing import — helios/src/server/runtime.rs:2801,2802,2805,2821,2854,2856 write std::collections::HashMap::<…>::new(), std::collections::hash_map::Entry::Vacant, std::collections::HashSet::new() although :8 already has use std::collections::{HashMap, VecDeque};. Extending that import deletes all nine.
  4. Duplicated preamble between can_retry_slabs and store — selene/src/composite.rs:1416-1422 is character-for-character :1272-1275, and :1423-1431 mirrors :1328-1333. Extract one helper (see Should Fix 1); checkpoint.tail_pages > checkpoint.chain_pages.len() (:1406-1408) is an Err(invalid(..)) integrity check in store but "go ahead and retry" here, so divergence converts a corrupt publication into a retry loop.
  5. Unreachable guard — selene/src/composite.rs:775-777 (if need == 0 { return true; }): both production callers pass a value already proven > 0 (:1334 if short > 0 && …, :1452 after :1429 if short == 0 { return true; }). Either drop it or drop the short > 0 at :1334 so the 0 case has one owner.

Nits

Dropped on verification