Explore report · NVIDIA/hyperflare-inference #549

Raw Markdown for agents: https://autobot.eidonix.com/p/c610511d-7999-4d89-85a1-f95a4168a213.md

Case file: PR #549 — "Report KV pages held by active requests"

Author WynnD, opened 2026-11-26 as a draft, head 5ed7af8, base main, 7 files, +218/−10. No reviews, no comments, no CI checks on the head commit, and — unlike its sibling PRs — no automated intake comment. Closes issue #537.

Key findings

  1. The PR's own evidence does not show the problem solved. The motivating issue (#537) is that an operator cannot compute a vLLM-style KV-usage ratio. In the PR's live scrape, flare_request_kv_pages reads 399 and 402 against flare_total_kv_pages 21504, while free (15582/15400) and cached (2037/2043) leave ~3,885 pages unaccounted for — an order of magnitude more than the new gauge reports. The new metric is a correct, deduplicated count of page ids that live requests hold; it is not the term that closes the ledger. The description only claims the weaker statement that request+reserved stayed below total−free−cached.
  2. #537 offered a cheaper design that this PR neither took nor discussed. The issue proposed (1) a distinct-pages gauge, (2) splitting flare_cached_kv_pages into pinned vs idle using the existing pins/direct_pins counts, and optionally (3) a ready-made ratio gauge. The PR implements (1) plus an extra reserved gauge, silently drops (2) and (3), and adds a second bookkeeping dimension on every checkpoint plus a new pin API pair — the more invasive of the offered options (charter asks for the smallest footprint).
  3. Two claimed mechanisms are weaker than the description reads. compact_ancestor gains debug_assert_eq!(node.request_pins, child.request_pins) (cache.rs:627) — a debug-build assertion, not release enforcement; and "a checkpoint leaves nodes only at zero pins" is pre-existing behaviour (eviction_candidates already requires direct_pins == 0, cache.rs:658-663), not something this PR adds.
  4. Documentation is half-done. docs/api.md:298-305 gains prose, but the field↔Prometheus table at docs/api.md:325-355 — the one-row-per-field contract — was not extended for the two new gauges, which also deliberately do not appear in the JSON snapshot.
  5. A single unreproducible evidence base. One local two-GPU scrape on a container built on a fork commit (AzallazA 5ffe4d54, carrying engram encoding from still-open upstream #482), self-admittedly polluted by the agent's own traffic, plus a partial test run (508 tests, --lib -- cache:: scheduler:: server::metrics) whose Windows and full-suite halves are deferred to a CI that has not run.
  6. Direct successor to merged work. #460 (yatesdr, merged 2026-11-23) created exactly the counters and the test-only drift assertion that #549 extends, and supplies the measured reason stats must not scan nodes (49–58% of runtime samples). #549 is a follow-on in yatesdr's own series, which also makes yatesdr the natural reviewer.

The change

What it does, in plain terms. The runtime's prefix cache tracks pin counts per checkpoint so it can tell which cached pages are still referenced. This PR adds a second pin dimension: pins taken on behalf of an active request. Because a request pin is propagated up the ancestor chain, a checkpoint knows how many live requests reference it; when that count rises from zero, its tail pages are added to a maintained request_pinned_pages total, and subtracted when it falls back to zero (helios/src/cache.rs:551-580, verified). The scheduler then sums two things for the HTTP /metrics route: its live slots' private pages plus the cache's request-pinned pages (request_pages, scheduler.rs:1216-1222), and its live slots' reserved pages (reserved_pages, scheduler.rs:1223-1228). Those numbers are rendered as two Prometheus gauges (metrics.rs:1309-1318).

Size and files (from pr_files):

File Lines
docs/api.md +9
helios/src/cache.rs +60/−1
helios/src/cache/lifecycle_tests.rs +3
helios/src/cache/tests.rs +24
helios/src/scheduler.rs +38/−9
helios/src/scheduler/tests.rs +66
helios/src/server/metrics.rs +18

Verified against the head — what the diff actually does:

What the description says that the change does not do (or says more strongly than the code):

The why

Recent activity

People

Community

Project fit

Where it lines up:

Where it does not:

Claims and evidence

Claim What backs it
"508 passed" on Linux x86_64 release, --lib -- cache:: scheduler:: server::metrics Description only. No CI checks on head 5ed7af8. Windows build and full helios suite explicitly not run, deferred to "CI covers". Compare #460, same machinery, which reported the full helios library (1,542 passed) plus a revert check.
The counter cannot silently drift True in test builds: the cfg(test) assertion in stats compares request_pinned_pages with a full scan on every stats read (cache.rs:818-837), so all cache/scheduler tests exercise it. Release builds have no such check — an accounting bug would only surface as a wrong gauge.
request_pins_count_each_shared_page_once (cache/tests.rs:320-341) Present as described: parent with two children over pages 0/1/2, both pinned for requests, count 3 not 4; plain pins leave it unchanged; releasing the parent without a request pin errors; count returns to zero.
request_kv_pages_count_shared_prefix_pages_once (scheduler/tests.rs:971-1032) Present, but it cancels its two requests rather than completing them, so the terminal-publication path (retire with publish) is only covered indirectly through shared unpin_request code.
counters_expose_fixed_names_without_request_payloads Covers both gauges' types and values as described.
"No allocation, eviction, or scheduling decision changes" Consistent with the diff: nothing reads the new counts except stats and Metrics. Caveat: an extra O(chain) walk per pin as noted above.
Live scrape: request 399/402, reserved 3/2, free 15582/15400, cached 2037/2043, total 21504 Single two-GPU DeepSeek-V4.1-Flash run on a container built from the repo Dockerfile with #536's counterpart, swapped into a llama-swap entry, base AzallazA fork 5ffe4d54 (needs the engram encoding that exists only in still-open upstream #482). The instance also served the agent's own traffic. Not reproducible by a reviewer; no other runtime compared.
Gauge definition: "each page counted once even when several requests reference it" Verified for the cache half: a checkpoint's tail pages are counted once if any request pins it (cache.rs:558-560). Verified for the slot half: each private page belongs to one slot. request.shared_pages (the chain a request actually reads) is never used directly — it is covered through the pinned checkpoints after the boundary publication drains prompt pages into shared_pages (scheduler.rs:2976-2978). Net: the definition holds; the two halves are not cross-deduped, but no scenario was found where a page appears in both.
Reported ratio 0.0186 / 0.0187 Arithmetic checks out (399/21504, 402/21504).
"request+reserved stayed below total−free−cached" True, but this is a weak claim: the same numbers show 21504 − 15582 − 2037 = 3885 pages still unexplained by free+cached, roughly ten times the new gauge's value.

Why reserved_pages is additive rather than overlapping (relevant because it is the one genuinely new term): at admission the scheduler pops reserved_count page ids out of free_pages into request.reserved_pages (scheduler.rs:1732-1735, rebound for vision windows at 2183-2197), and only later moves them into private_pages (scheduler.rs:2434-2438, and 3170 on retirement). A reserved page is by construction not free, not in any checkpoint's tail_pages, and not yet in private_pages — which is exactly the docs' "neither free, cached, nor written" (docs/api.md:301-302). The residual in the live scrapes is unattributed, but #351's conservation identity points at flare_snapshot_backing_pages as the largest missing term; the scrape did not report it. Also outside the four gauges: ticket pages held for in-flight host restores (scheduler.rs:1704-1706) and retired pages awaiting a fence (scheduler.rs:843-847).

Reach

Process

Open questions / could not be found

  1. What accounts for the ~3,885-page residual in the PR's own scrape? #351's identity suggests snapshot backing; the scrape does not report flare_snapshot_backing_pages, and I did not attempt to reconcile further. Until that is attributed, it is unclear whether flare_request_kv_pages gives an operator a ratio they can trust against vLLM's number — the thing #537 was about.
  2. Why was #537's cheaper option rejected? Nothing in the description says. The existing pins/direct_pins counts already distinguish pinned from idle checkpoints, which is option (2); the PR chooses a second bookkeeping dimension instead.
  3. Is the missing intake comment a draft gate or a queue artefact? Not verified.
  4. Multi-rank/TP and multi-host Selene behaviour of the gauges is untested by the author and not exercised by the new tests; the per-rank semantics above are read from code, not measured.
  5. Would the maintainers accept a new public miss path? unpin_request returns an error when no request pin exists (cache.rs:566-568). It was unreachable in the paths I traced, but it is a new failure mode on the retirement path where previously an unpin could not fail that way.

Nothing found under an angle that is absent above: all ten angles produced entries (#1–#11, #13–#15), with the summary at #12.