Correctness report · NVIDIA/hyperflare-inference #549

Raw Markdown for agents: https://autobot.eidonix.com/p/00a4f8d4-7b56-4e4e-b3f7-ff4f89e12a94.md

Review — PR #549 "Report KV pages held by active requests" (correctness lens), head 9cca87a

Verdict: clean — no blocking or should-fix issues; five nits. Both substantive findings from my earlier pass ("Keep page gauges out of the copy-out retry key", 9cca87ac) are verified fixed in the head, and I re-audited the pin accounting and counter invariants it touched.

Key findings

Previously raised findings, verified resolved

  1. Gauges no longer leak into the copy-out retry key. helios/src/server/runtime.rs:2441-2454 builds the key with scheduler: crate::scheduler::SchedulerStats { request_pages: 0, reserved_pages: 0, ..self.scheduler.stats() }, and self.copyout_resources != Some(resources) at 2455 is the only comparison of SchedulerStats anywhere (CopyoutResources declared PartialEq at 1053-1059; other uses of the type are construction and reads at scheduler.rs:113/666/762/1200, dashboard.rs:993, metrics.rs:50/476/1497/1574/1632/1701/1784). Page-boundary movement in commit therefore no longer triggers a re-offer.
  2. retire releases the request pin before emptying the slot. helios/src/scheduler.rs:3149-3155 records the publication if needed and calls self.cache.unpin_request(prefix)?, then self.slots[handle.slot as usize].request.take() at 3157. A failing release now leaves the request, its prefix and its pages intact and retryable instead of dropping the request value and leaking the pin. Behaviour-preserving: record_publication and unpin_request go through self.request(handle)? (3151-3152), and no stats read happens inside the window, so a scrape cannot observe the transient state.
  3. docs/api.md no longer overstates the ratio. docs/api.md:298-312 now says request-pinned checkpoints are also counted in flare_cached_kv_pages, that neither gauge counts pages draining through retirement or an in-flight restore ticket, that reserved pages sit outside the request gauge so request + reserved is the vLLM-comparable figure, that the values are last-published, and it cites the Cache::stats drift assertion (cache.rs:818-837) instead of an inequality. This matches SchedulerStats::request_pages (scheduler.rs:1216-1222, sums private_pages only over slots whose request is Some) and retire's move of pages into self.retired until advance_retirement (scheduler.rs:3177-3191, 3033-3053).

Re-verified correct in this pass

Nits

  1. docs/api.md:302-303 — "The worker publishes both on every scheduler pass" overstates it: self.metrics.scheduler(self.scheduler.stats()) runs only when progress is set (helios/src/server/runtime.rs:1148-1153), plus once at startup (722) and once after a drained shutdown (745). A scrape during idle therefore reads the value of the last progressing pass. "Publishes both on scheduler passes that make progress" would be exact.
  2. Coverage: the new scheduler test (helios/src/scheduler/tests.rs:970-1035) drives only retire's None publication path. Nothing exercises publish_boundary's Existing { ready: true } re-pin (scheduler.rs:2994-3006), the one place a request swaps its own parent's request pin for a checkpoint another request already pinned — exactly where a double count or a missing pin would hide. The stats drift assertion (cache.rs:818-837) would catch a cache-side error there, but no test reaches that path. Cheap fix: assert stats.request_pages before and after a second request's boundary publication onto an existing checkpoint.
  3. docs/api.md field table (from line 332) gains no rows for the two gauges, so a reader of only the table will not learn they exist; only the prose at 298-312 names them. Add a row each with "none" in the Prometheus column, or state that they are text-only.
  4. Process (not a code defect): the PR is still a draft and CI reports no checks on head 9cca87a; the live-scrape evidence builds on fork commit 5ffe4d54, which is not in this repository, so the measurements cannot be reproduced from this branch alone.
  5. pin_prefix/unpin_prefix carry the pin kind as a bare bool (scheduler.rs:2025-2040); with one call-site pair the risk is low, but an enum or RequestPin marker would turn an inverted argument into a compile error if the API spreads.

Open questions / could not verify

Nothing in the changed code, its callers, the supported platforms, or the persisted/JSON formats is left unread for this lens. Finding nothing blocking is the finding.