Correctness report · NVIDIA/hyperflare-inference #549

Raw Markdown for agents: https://autobot.eidonix.com/p/a8a270c5-3e64-46ad-8b30-81ddbb50bce8.md

Key findings

Verdict: clean — no blocking, no should-fix issues. I read all eight changed files in context at head bca7358 and audited every path the change reaches. The counter cannot drift or underflow, every request-owned pin has a matching release on every success and failure path, and the two new gauges are plumbed through without changing any allocation, eviction or scheduling decision.

Four nits, all documentation/coverage-grade, listed at the end.


What I verified as correct

1. Request pin / unpin symmetry in the scheduler

Invariant checked: LiveRequest::prefix == Some(id) iff one direct_request_pins is held on id, across every path.

2. request_pinned_pages cannot drift or underflow

I checked every mutation of nodes and of the counter:

3. The gauges themselves

4. The copy-out retry key is protected (the one real hazard in this design)

Adding two page counts to SchedulerStats, which is PartialEq, Eq (scheduler.rs:112), would have silently widened the equality key CopyoutResources uses to decide whether to re-offer deferred host-store copy-outs. Decode moves private_pages/reserved_pages every step, so an unguarded key would re-offer copy-outs on every decode step.

The PR zeroes both in the key (runtime.rs:2441-2455) with a comment naming exactly this reason:

scheduler: crate::scheduler::SchedulerStats { request_pages: 0, reserved_pages: 0, ..self.scheduler.stats() }

runtime.rs:1056 is the only other SchedulerStats comparison in the tree, so there is no second place to forget. I confirmed no behavioural change remains: the key is exactly what it was before the field addition.

Nits

  1. docs/api.md:304-305 and helios/src/server/metrics.rs:1315-1317 — "not yet written" is imprecise at the commit boundary. A reserved page is genuinely not free (popped from free_pages at admission, scheduler.rs:1714-1717) and not counted in cached_pages (tail_pages counts checkpoint tails only). But commit pops reservations into private_pages before the GPU writes complete (scheduler.rs:2435 region), so between commit and the completion fence a page is counted in request_kv_pages while still unwritten. Suggest wording like "pages set aside for those requests' growth that no request currently holds a page for".
  2. docs/api.md:330 field table gains no rows for the two gauges. cached_pages has a row (350), but flare_request_kv_pages/flare_reserved_kv_pages appear only in the prose at 298-310. A reader of the table alone will not learn they exist. Add a row each with none in the Prometheus column, or state that they are text-only (they are not in the JSON snapshot).
  3. Coverage gap: publish_boundary's Existing { ready: true } re-pin (scheduler.rs:2987-2998) has no stats assertion. That is the path where a request swaps its own parent's request pin for a checkpoint another request already pins — the exact "shared page counted once" case at the scheduler level. The Cache::stats drift assertion would catch a cache-side double count, but nothing drives that path with a stats read. A test asserting stats.request_pages across a second request's boundary publication onto an already-pinned ready checkpoint would close it.
  4. pin_prefix/unpin_prefix carry the pin kind as a bare bool (scheduler.rs:2019-2033). With one call-site pair the risk is low, but an inverted argument silently converts a request pin into a host-admission pin (or the reverse) and the failure would surface only as a drift assertion or a stranded counter. An enum or marker type would make it a compile error if the API spreads.

Open questions / process (not code defects)

Scope note

This review covers the correctness lens only (lifetimes, error handling, concurrency, inactive/edge paths, state transitions, compatibility). Performance of the extra slot pass, naming, and dashboard/UI presentation were left to other lenses; I only checked that adding two fields to SchedulerStats compiles at every construction site (..Default::default() or ..self.stats() in all of them) and that the dashboard reads Metrics, not Snapshot, for these names.