PR #549: Report KV pages held by active requests

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/993b6a3c-e20f-46fc-9d52-fb9fcf5b436e

Opened by a workflow run, Nov 26, 2026 4:23 PM EST.

screen malicious

Screen Result: All Clear

Evidence:

Limits: this was a static, read-only review of the diff, description, discussion, linked items and targeted head-tree searches; the code was not built or executed, and unrelated repository files were not audited beyond those searches. Unsigned/unaffiliated authorship (GitHub association NONE, first-time contributor in these areas) is a review-attention signal, not evidence of malicious content.

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: WynnD (no GitHub association with the repo; commit name "Wynn Drahorad"; Discord: oystersmiles) — first-time contributor, two same-day draft metrics PRs (#548, #549), nothing merged Motivation: /metrics reports free and cached KV pages but not the pages live requests hold, so an operator cannot compute how much KV a running workload actually occupies the way vLLM's kv_cache_usage_perc does; pages reserved for a request's future growth are invisible entirely, being neither free, cached, nor written. Issue #537 asked for such a gauge, and this PR adds two Prometheus gauges for it. Scale: +218 / −10 lines in 7 files Proposal:

Full report · Notes

Value Proposition

Verdict: worth merging, with small changes

The change is small, in the right layer, backed by real evidence, and closes a documented observability gap (#537). Nothing in it touches a charter non-goal. My requested changes are documentation/API-completeness plus one hardening point on the new dual pin API — not a redesign.

Does it fit the charter?

Correctness of the counter

I checked the places tail_pages mutates for the maintained count to drift: creation (cache.rs:448-465, starts at 0), count/uncount (258-275), and compact_ancestor (613-645). Compaction is handled correctly and asserted: the ancestor may have request_pins > 0 (a descendant's request pin bumps ancestor pins without a direct pin), and the added debug_assert_eq!(node.request_pins, child.request_pins) plus the "pages move into the counted heir" comment covers the both-counted-or-neither case, so the union length is preserved. Leaf retirement cannot strand pages because request_pins > 0 ⇒ pins > 0, and eviction requires pins == 0. Private pages are disjoint from request-pinned cache pages because publication drains them into tail_pages (2978, 3150-3152). The parent/child test asserting 3 rather than 4 (cache/tests.rs:320-341) is the right test for the "shared page counted once" property.

The strongest guard is the extension of the existing test-only drift assertion (cache.rs:819-837), which compares the maintained count with a full scan on every stats() read across the whole suite. That is proportionate for a counter whose only consumer is a gauge, and it is the same pattern the surrounding counters already use.

Known gaps (all small, all should be stated, not necessarily fixed): retiring slots' pages (retire.rs (not opened) path at scheduler.rs:3170-3183, returned to free_pages only after the fence at 3037), in-flight ticket pages reserved for an inbound restore (1704-1706), and snapshot backing pages remain outside both gauges. The evidence in the description is consistent with this: request + reserved stayed below total − free − cached.

Evidence

Meets the charter's bar: four-part description, Discord: line, no invented evidence, and an explicit statement of what was not run (Windows build, full helios suite → CI). The live scrape is the right shape — idle shows 0/0, two concurrent streams show 399/402 request pages, 3/2 reserved, 2037/2043 cached of 21504 total, plus the sanity inequality — and it correctly disclaims comparison with another runtime and notes the agent's own traffic is included. No performance claim is made, which is correct: this is visibility only, so the "benchmark against main" rule does not apply.

Changes I would ask for before merge

  1. Decide the JSON story. Snapshot (metrics.rs:68-129) is the documented format=json surface, and docs/api.md:325-355 is the JSON↔Prometheus table; the PR adds two Prometheus-only gauges and documents them only in prose. Either add both fields to Snapshot (two lines each, and the terminal dashboard in flare/src/dashboard.rs:382 could then show them) or say explicitly in docs/api.md that these two gauges are Prometheus-only and why. Silent divergence between the two formats is the kind of doc drift the repo's own prose rules push against.
  2. Fix the ratio sentence. docs/api.md:303-305 says dividing flare_request_kv_pages by flare_total_kv_pages "gives the KV share held by live requests". That excludes flare_reserved_kv_pages, so it understates what live requests actually hold — which is precisely the vLLM comparison #537 was opened for. Say so, and state which sum is intended (request + reserved).
  3. Harden the dual pin API against silent undercount. Cheapest option that matches house style: a #[cfg(debug_assertions)] (or test-gated) cross-check in Scheduler::stats/Cache::stats that every live request with prefix: Some(_) is backed by a request pin, mirroring the existing drift assertion. Alternatively make the flavor a type (Pin/RequestPin) so mixing cannot compile. Without one of these, the invariant lives only in comments and one unit test.
  4. Say what the gauges exclude. One sentence on retiring slot pages, in-flight ticket pages, and snapshot backing pages, in the HELP text or docs/api.md. The evidence already shows these regions exist; leaving them implicit invites the same "which number is the truth" confusion #537 complained about.

None of these changes the design; 1-4 are ~20 lines plus prose. #549 and #548 (#536) touch disjoint regions of metrics.rs (page gauges beside cached_pages there, histograms beside the completion counter here), so merge order does not matter.

Bottom line

Worth it with changes. A focused, well-evidenced, correctly-layered observability addition to a gap a user reported with reproduction detail, at a complexity cost the cache was explicitly designed to absorb. Request items 1-4, then merge; the Windows build and full helios suite should pass before landing, as the description itself flags.

Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Simplicity

Verdict: should-fix issues only Blocking:

Detail: nothing in the change is a parallel path or an unsupported abstraction, so nothing needs deleting outright — the two new metrics reuse the existing gauge renderer and update tables, the separate request_pinned_pages field and direct_request_pins both have real consumers, and the compaction/eviction invariants hold. The two should-fix items are the only duplication the diff introduces: pin_request calls self.pin(id) (which already computes self.chain(id) at cache.rs:523) and then computes self.chain(id) again at 554, and unpin_request does the same at 569/571, so every admission (scheduler.rs:1645), ticket waiter (1900), boundary publication (2971/2991) and retirement (3159) walks the chain twice; the doc comment at 548-550 describes a page set the cache cannot see. The three nits are three scans of self.slots in SchedulerStats::stats (scheduler.rs:1216-1228) where one fold yields both new totals; a test assertion that checks a generic guard already covered by the pre-existing unpin rejection at cache/tests.rs:358 rather than a request-pin behaviour; and a docs/api.md:298-305 paragraph that duplicates the metric table at api.md:325-349 and narrates implementation. Verified-and-kept items and the one thing that could not be checked from here (the live two-GPU scrape numbers) are laid out in the report.

Full report · Notes

Prose

Verdict: should-fix issues only Blocking:

Full report · Notes

Conventions

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 1 — the two new gauges have no docs/runtime-core-design.md entry, while the neighbouring flare_snapshot_backing_pages has one at docs/runtime-core-design.md:873.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/549

Full report · Notes

Architecture

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 3 (boolean-selected pin API in three mirrored admission blocks; unpin_request failure aborts retirement instead of surfacing as metric drift with only a #[cfg(test)] drift check; LiveRequest already carries the per-slot page sets, so the smallest-footprint option deserved a sentence).

Link: https://github.com/NVIDIA/hyperflare-inference/pull/549

Scope verdict: in scope and the approach is right. It touches only shared runtime layers — cache accounting, scheduler stats, Prometheus text and docs — with no per-model branches, no flags, no optional policy paths, and no allocation, eviction or scheduling change, so it satisfies the charter's "Keep the runtime small and model-agnostic" and "Solve the right problem in the right place" (charter lines 34, 12), AGENTS.md:165-200 and docs/design-review.md principles 1, 3, 10 and 15. Maintaining the count on the pin/unpin paths instead of scanning nodes in Cache::stats is the correct layer for the constraint the PR states. The defects are documentation accuracy — the derived ratio is the point of issue #537 — plus a robustness nit about how the API choice is selected at admission.

Full report · Notes

Correctness

Verdict: should-fix issues only Blocking:

Full report · Notes

Subtractive

Verdict: make it smaller first The change: +218 / -10 lines (7 files) Could remove: about 95–105 lines, in 4 places Biggest subtractions:

Full report · Notes

Pre Test Report

Pre-test report — PR #549 "Report KV pages held by active requests"

Recommendation: DO NOT refer to hardware testing yet. Send back to the author.

The code is fundamentally sound and the approach is right, but the PR cannot be tested as it stands for four reasons: (1) the functional contract — what the gauges mean — is still being changed by two competing readings, one of which I verified as a real behavioural change the author denies; (2) the PR's own evidence shows it does not deliver the number #537 exists to produce; (3) it is a draft with zero CI, so a hardware run would be the first execution of cargo test on this head; (4) there is nothing GPU-specific to test — this is an observability-only change with no kernel, no numerics and no throughput path, so hardware time buys almost nothing that a host-side test does not.

A ready, minimal test plan is below for when the should-fix items land. It deliberately avoids any GPU-time A/B throughput work.


1. What the change is

Two new Prometheus text gauges: flare_request_kv_pages (KV pages active requests reference) and flare_reserved_kv_pages (pages reserved for their growth). Supported by a maintained counter in PrefixCheckpointCache (request_pinned_pages, helios/src/cache.rs:224) updated through a new dual pin API (pin_request/unpin_request, cache.rs:551-580), plus per-slot sums in SchedulerStats (helios/src/scheduler.rs:1216-1228) rendered at helios/src/server/metrics.rs:1306-1318. Prometheus text only — deliberately not in the JSON snapshot. +218/−10 across 7 files. Closes #537.

2. Substantive problems that must be fixed before testing

2.1 BLOCKER — the PR changes a scheduling decision while claiming it does not

I verified this myself. SchedulerStats derives PartialEq/Eq (scheduler.rs:112) and is embedded whole in CopyoutResources (helios/src/server/runtime.rs:1053-1059), whose comparison at runtime.rs:2448 computes retry_copyouts, which decides whether host-store copy-outs deferred for headroom are re-offered to store.store (runtime.rs:2450-2474).

Adding request_pages/reserved_pages to that struct therefore silently joins a behavioural key. The author's PR body says "No allocation, eviction, or scheduling decision changes." That is false — allocation and eviction are untouched, but a scheduling decision (copy-out retry cadence) has changed.

The correctness reviewer is also right about why it can now trigger: refill_reservations (scheduler.rs:1383-1425) pops pages out of free_pages into reserved_pages, and commit (scheduler.rs:2433-2438) moves reserved_pages → private_pages. So the two new fields can move while free_pages/cached_pages/retiring_slots hold. Magnitude is unproven — the correctness reviewer conceded they "could not show a measurable regression," and I agree; free_pages was already in the key and already moves on refill. So this is a narrowing, not a rewrite: compare a resource-only key, or zero the two gauges in the comparison.

Why this blocks testing specifically: it gives a hardware test two possible excesses to chase — extra host_reoffer_calls (a real, if small, behaviour change) and any host-cache throughput/latency effect of the extra re-offers — on a change that is supposed to be inert. Testing the intended change means testing a hybrid. Also, if the fix is to zero the fields or narrow the key, a test that has already been written against "the gauges are in the key" would have to be rewritten.

2.2 BLOCKER — the PR does not deliver the number #537 was opened for

This is the highest-value finding and it is not in any of the reviews, which all treat the design as answering #537.

#537 (by Napuh) is explicitly a vLLM-parity request: current bounds are ~16% (upper) and ~0% (lower) against vLLM ≈9% on the same hardware and load, and the reporter could not tell where the truth lies. The PR's own live numbers are request_kv_pages 399 and 402 of 21504 total → ratio 0.0186 / 0.0187, i.e. ≈1.9%, on two concurrent 1831-token-prefix streams. That is five times below the vLLM reference, not near it.

So the shipped gauge produces a third number that is still far from vLLM semantics. The reason is structural, and the architecture reviewer half-found it: flare_request_kv_pages counts live slots' private pages plus request_pinned_pages, but a vLLM "in use" block is all blocks allocated to running requests. Flare's shared/pinned prefix pages are counted in both request and cached (they are never excluded from cached_pages — cache.rs:258-275), while #537's option 2 (split cached into pinned/idle) would have exposed exactly the pinned set that a vLLM-equivalent needs.

Three things follow:

Do not spend hardware time validating a ratio that is under discussion. Either the docs are corrected to describe what is actually measured (distinct-pages-held, not vLLM usage), or the counting changes — and if the counting changes, the tests change with it.

2.3 BLOCKER — stale contract: the docs state two things that are false

Both are cheap to fix, but a tester who reads docs/api.md will write the wrong assertions:

2.4 SHOULD FIX before merge (not blocking a later test run)

2.5 Nits — safe to ignore for testing purposes

Duplicated if inbound.is_none() branch in three mirrored blocks in admit_planned (this one can't be collapsed to pin_request — the invariants reviewer correctly notes the ticket-parent pin must stay plain so the ancestor survives ensure_resources eviction; the fix is to carry the kind in the existing pinned binding, not to unify the API); three scans of self.slots in stats() where one fold suffices; a test assertion (cache/tests.rs:335) that exercises a generic guard rather than the behaviour it claims; missing docs/runtime-core-design.md (not opened) entry; JSON-snapshot omission unstated in api.md.

2.6 Subtract the duplicated scheduler test — cuts the test plan's cost

The new scheduler test (scheduler/tests.rs:970-1034) reproduces branching_requests_own_distinct_tail_pages_and_terminal_snapshots (tests.rs:1036-1081) step for step — I diffed both: identical scheduler(2,8,5) → admit(spec(64,1)) → … → complete(records(second,7,65,1,90,1)) sequence, and the existing test already asserts the shared/private split at :1078-1079. Only four assertions and a cancel pair are new. Append them to the existing test. This matters for the test plan because it removes a redundant target rather than adding one.

3. What the reviews got right that I confirmed, and one they got wrong

Confirmed sound — this is why the change is salvageable:

One claim I checked and would qualify: the architecture reviewer's knock-on that the description's live inequality (request + reserved < total − free − cached) "does not validate this gauge." Directionally correct — total − free − cached is dominated by snapshot-backing pages — but it is not meaningless as a sanity bound. It just isn't evidence for this gauge. The in-repo drift assertion is the right evidence, and the description should point at that instead.

Process state I verified: draft, no CI checks on head 5ed7af8, discussion contains only the automation case-file notice, author unaffiliated with the repo, and the live scrape was produced from a third-party fork base commit (5ffe4d54) not present in this repository. None of those measurements are reproducible from this branch.

4. Hardware assessment — why the expected value is low

Available: cn5 4× RTX PRO 6000 Blackwell (SM120, amd64), GLM-5.3-Flash-NVFP4 TP4; cn7 1× GB10 (SM121, arm64) Qwen3.8-27B-NVFP4 TP1 (documented qualified native ARM64 path).

Bottom line: expected value of a hardware test on this PR as written is low. It would first run the suite for the first time on a draft, capture a ratio the design discussion may change, and chase a copy-out effect the author says does not exist.

5. Proposed test plan — defer until the §2.1–§2.4 fixes land

Split into two stages so no GPU minute is spent before it is justified.

Stage 1 — host only, no GPU (do this first)

  1. Full suite, release profile. cargo test --release --lib -- cache:: scheduler:: server::metrics plus the full --lib run. The author reports 508 passing on Linux x86_64 but no CI ran on this head; establishing a green baseline is the highest-value check available and costs nothing. Also run the Windows build the description flags as unrun if a Windows runner exists — this is what the description itself asks for.
  2. Drift assertion across the whole suite. Confirm the extended #[cfg(test)] assertion (cache.rs:817-837) now covers request_pinned_pages and that it stays silent across the cache, scheduler and lifecycle tests. This is the real correctness evidence.
  3. The Existing-publication path — currently untested. Both the correctness and conventions reviewers note no test drives pin_request through publish_boundary's shared-checkpoint Existing branch (scheduler.rs:2988-3000), which is exactly where one request pins a checkpoint another request just published, and where a double count or a missing pin would hide. The new test cancels rather than completes its requests, so the PublishResult::Created retire path (scheduler.rs:3146-3153) is also unexercised. Add these two cases before hardware. Cheapest form: the four assertions the subtractive reviewer suggests appended to branching_requests_own_distinct_tail_pages_and_terminal_snapshots (tests.rs:1036-1081), extended with one completed (not cancelled) retirement.
  4. A regression test for §2.1 if the author fixes it by narrowing the key: leave one copy-out deferred for headroom, advance one decode step across a page boundary (moving pages reserved → private while free_pages/cached_pages hold), and assert FakeStore saw no second store call. This test is what makes the "no scheduling decision changes" claim true and checkable — it should exist either way.
  5. A test pinning the Inbound semantics (§2.3): assert both gauges while a request is in RequestPhase::Inbound, so the documented phase boundary is explicit rather than incidental.

Stage 2 — one GPU run, only after Stage 1 is green and §2.2 is settled

One job, one model, ~30 minutes. cn7 preferred (1× GB10, Qwen3.8-27B-NVFP4 TP1, the documented qualified ARM64 path — the simplest single-GPU KV pool, so the ledger arithmetic has the least confounding machinery). If the author's target is the TP4/Blackwell path, cn5 with GLM-5.3-Flash-NVFP4 instead — but not both.

Exact checks, all scrape-based, no benchmarking:

  1. Idle ledger. With no request live: request_kv_pages == 0, reserved_kv_pages == 0. (The author observed 0/0 with cached 2019.)
  2. Scrape freshness (§2.3). Confirm the doc's corrected claim: take one scrape against an idle worker and one immediately after activity, and verify the gauge reflects the last progress pass, not the scrape instant. This validates the doc fix and is the one check that could otherwise be silently wrong.
  3. Two concurrent streams on a shared prefix — the author's scenario. Record request, reserved, cached, free, total. Two assertions:
    • request + reserved < total − free − cached (sanity bound, as in the description);
    • request_pinned_pages <= cached_pages (the invariant that actually attests the gauge — the architecture reviewer's point, and better than the bound above).
  4. The ratio, recorded not asserted. Log request/total. Do not gate the PR on matching vLLM (§2.2) — record the number so the maintainer can judge gap-closure against #537's ≈9% reference on the spot. This is the single most valuable output of the hardware run.
  5. Drain window (§2.3, correctness reviewer's nit 2). Cancel one request mid-flight and scrape immediately: confirm both gauges drop to 0 while the pages are still retiring, and that the docs' corrected wording says so. One scrape, no extra setup.

Explicitly not on the plan, and why: no throughput A/B against main (no perf path changed — pure waste of a GPU slot); no long soak; no multi-model matrix; no repeat of the author's two-GPU DeepSeek run (unreproducible fork base, and it answers a design question rather than a correctness one); no per-model sweeps.

Estimated total: Stage 1 free, Stage 2 one job ≈30 min on cn7. That is the minimum that validates this code.

6. Referral decision

Not referred now. Return to the author for: the CopyoutResources key (§2.1), the #537 value gap and the ratio claim (§2.2 — needs a maintainer/reporter decision, not a code fix alone), the two false doc statements and the inverted PR-body sentence (§2.3), and the chain-walk fold plus saturating_sub and retire ordering (§2.4). Non-draft status with CI green on the new head is a precondition for Stage 2.

When those land, refer for Stage 1 + the single cn7 job above. The underlying accounting logic is sound and well-guarded (maintained counter with a full-scan drift assertion on every stats() read, sound compaction and eviction invariants, symmetric pin/unpin across all nine call sites), so the change is worth landing — its value is real. It just is not yet testable as the vLLM-parity metric it advertises, and its central number is ~1.9% against a ≈9% reference on the same class of load.

Full report · Notes

code review summary

Recommendation: Changes Requested

Scope and approach are right — the count is maintained as pins change so Cache::stats keeps its no-scan-nodes property, and the gauges reuse the existing renderer, update table and test rows. One three-line blocker, five should-fix items (three of them prose accuracy), and about 90 removable lines. Nothing below asks for new code.

Blockers:

Should fix:

Subtract / Simplify:

Could remove ~90 of +218 added lines (up to ~112 if flare_reserved_kv_pages goes):

Nits:

5

Full report · Notes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

screen malicious

Screen Result: All Clear

Evidence: No prompt injection, hidden text, or agent-directed instruction was found in PR #549 (NVIDIA/hyperflare-inference, "Report KV pages held by active requests", WynnD, draft, head 9cca87a, 8 files +246/−16).

I read the complete diff (no new files added), the PR body, and the full 3-comment discussion. Every hunk is ordinary observability work: request-pin counters and a test-only drift assertion in helios/src/cache.rs (79-87, 185-190, 548-583, 817-840), request_pages/reserved_pages plus pin_prefix/unpin_prefix call renames in helios/src/scheduler.rs (127-133, 1213-1228, 2022-2038), two Prometheus gauges in helios/src/server/metrics.rs (262-266, 1306-1319), a zeroing fix in the CopyoutResources key in helios/src/server/runtime.rs (2440-2453), two new tests, and prose in docs/api.md:298-312.

Nothing touches the network, spawns processes, reads environment variables or credentials, adds dependencies, or changes CI/scripts. Searches found no control, zero-width, or bidi characters in the changed files and no injection-style phrasing (ignore|you are|instruction|agent|prompt|autobot) outside ordinary identifiers such as prompt_tokens; no curl|wget|Command::new|std::env|http in the test files.

The only @flare-autobot mentions are the repository's own case-file boilerplate (including its #autobot:ignore opt-out, which narrows agent behaviour) and the author's 2026-11-27 request to re-review pushed changes — a normal workflow request, not an attempt to steer a reviewer's verdict. The automated review's single blocker is a correctness bug (new gauges leaking into the copy-out retry key), already addressed by the runtime.rs change; it is not a security finding.

Caveats: line anchors come from diff hunk headers, not a full post-image read; AGENTS.md (not opened) and README.md (not opened) matched the repo-wide phrasing search but were not opened, and this PR modifies neither. Repo-wide agent-facing text lives only in pre-existing docs untouched here.

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: WynnD (first-time contributor, no GitHub association with the repository; commit name "Wynn Drahorad"; Discord: oystersmiles) Motivation: Operators cannot compute a vLLM-style KV-cache usage ratio because Flare's /metrics reports cached and free pages but not the pages live requests hold, nor the pages reserved for their growth. The PR keeps those two counts current as request pins change, so no per-scrape scan of the checkpoint graph is needed. Scale: +246 / −16 lines in 8 files (was +218/−10 in 7) Proposal:

Full report · Notes

Value Proposition

Verdict: worth merging (with one small follow-up: document the JSON story)

The change is still small, in the right layer, backed by real evidence, and closes a reported observability gap (#537). The latest push (9cca87ac, "Keep page gauges out of the copy-out retry key") fixed the one real blocker I had and two of my prose requests, and it moved the retirement unpin ahead of request.take() as asked. What remains is one documentation/API-completeness item, not a design problem.

Fit against the charter

What the new push changed, and what I verified

Evidence

Meets the charter's bar: why / what / claimed result / evidence, a Discord: line, and an explicit statement of what was not run (Windows build, full helios suite → CI). The live scrape is the right shape — idle 0/0 with 2019 cached of 21504; two concurrent streams 399/402 request pages, 3/2 reserved, 2037/2043 cached; the ratio 0.0186/0.0187; the sanity inequality holding — and it correctly disclaims comparison with another runtime and discloses that the agent's own traffic is included. No performance claim is made, which is correct for a visibility-only change, so the "benchmark against main" rule does not apply.

The one thing still outstanding

The JSON surface diverges silently. Snapshot (metrics.rs:68-129) is the documented format=json body and docs/api.md:332-362 is the JSON↔Prometheus table; these two gauges are Prometheus-only and the prose does not say so. Either add request_pages/reserved_pages to Snapshot (two fields, one line each in Metrics::snapshot, one row each in the table — and the terminal dashboard could then plot them) or add one sentence to docs/api.md saying these two are Prometheus-only and why. Two Prometheus-only gauges among dozens of snapshot fields is fine; leaving it unstated is the drift the repo's own docs rules push against. This is the only item I would actually block on, and it is under ten lines either way.

Two things worth knowing but not worth blocking: the parallel pin flavour still lives only in comments plus the drift assertion (a Debug-only cross-check that every live request with prefix: Some(_) carries a request pin would make a future mispair fail loudly — the release-ordering fix above already removes the silent-leak failure mode), and pages of self.retired and of an in-flight restore ticket remain outside both gauges, which docs/api.md now states.

Bottom line

Worth merging. This is a focused, well-evidenced, correctly-layered observability addition to a gap a user reported with reproduction detail, at a complexity cost the cache was explicitly designed to absorb, and the last push removed the one behavioural regression it had introduced. Ask for the JSON-gauge documentation (or the two fields), then land; the Windows build and the full helios suite should go green in CI first, as the description itself flags. #549 and #548 touch disjoint regions of metrics.rs, so merge order does not matter.

Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Simplicity

Verdict: should-fix issues only Blocking:

Full report · Notes

Conventions

Verdict: should-fix issues only Blocking:

Reviewed at head 9cca87ac through the conventions/duplication lens; all eight changed files read in context. Checked and dropped as non-findings: the new AtomicU64 fields and store follow the cached_pages pattern; SchedulerStats::stats slot iteration matches its neighbours (1203-1212); the gauges' absence from the api.md JSON field table is correct; the drift check reuses the existing #[cfg(test)] assertion. Open: whether the double walk is measurable, and whether Inbound ticket pages should appear in a gauge (their pages are in no gauge though inbound requests count as active).

Full report · Notes

Architecture

Verdict: should-fix issues only Blocking:

Scope and approach are right: the change stays in shared runtime layers (cache accounting, scheduler stats, Prometheus text, docs), adds no per-model branch, flag, environment switch, or allocation/eviction/scheduling decision, and maintaining the count on pin/unpin keeps Cache::stats free of a nodes scan — the constraint the PR states. This satisfies charter lines 12 and 34, AGENTS.md:165-200, and design-review principles 1, 3, 12, 15, 16. Four findings from the earlier review rounds are already fixed at head 9cca87a; one prose defect and three nits remain. The PR's live consistency check (request + reserved < total - free - cached) does not attest the gauge, because total - free - cached is dominated by snapshot-backing pages; the in-repo drift assertion (cache.rs:818-837) is the real evidence and should be cited in the PR body instead. Unverified open question: the description's sibling reference "#536" appears not to match any related PR.

Full report · Notes

Prose

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 5 — api.md:309 "dividing either gauge" muddle; api.md:311–312 carries a #[cfg(test)] assertion in shipped docs (AGENTS.md:52–60); api.md:298–312 never says both gauges are absent from ?format=json; api.md:302–303 "on every scheduler pass" overstates the store frequency (runtime.rs:1148); description's "a checkpoint leaves nodes only at zero pins" is untrue for compaction (cache.rs:613–627).

Link: https://github.com/NVIDIA/hyperflare-inference/pull/549

Full report · Notes

Correctness

Verdict: clean Blocking:

The pin accounting is correct everywhere it reaches. Every request-owned pin goes through pin_request/unpin_request: admission when no inbound restore is in flight (scheduler.rs:1643-1649), ticket waiters in finish_inbound (1889), both publish_boundary outcomes (2977-2979, 2997-2998), and retirement (3151-3155, which now releases before emptying the slot). Host-store copy-out and export keep the plain pin API (2044-2050), so the new "no request pin to release" error cannot fire from them. In the cache the counter is adjusted only at 0↔1 transitions of request_pins (cache.rs:551-580), and every node that leaves nodes (retire_leaf 594, compact_ancestor 613) is gated on pins == 0 (650-663, 682-690), so it never contributed; compaction's new debug_assert_eq!(node.request_pins, child.request_pins) (627) holds because request_pins is the subtree sum. The extended #[cfg(test)] assertion in Cache::stats (818-837) compares the count with a full scan on every read, which makes drift cheap to keep out.

Both findings from the earlier review are verified fixed at head 9cca87a: the two gauges are zeroed when the CopyoutResources key is built (runtime.rs:2441-2454, compared at 2455), so page-boundary movement in commit no longer re-offers deferred host copy-outs; and retire unpins before request.take() (3151-3157), so a failed release leaves the request and pin intact.

Remaining items are nits, none reproduced above.

Full report · Notes

Subtractive

Verdict: make it smaller first The change: +246 / −16 lines across 8 files (docs/api.md +16, helios/src/cache.rs +60/−1, cache/lifecycle_tests.rs +3, cache/tests.rs +24, scheduler.rs +51/−14, scheduler/tests.rs +66, server/metrics.rs +18, server/runtime.rs +8/−1) at head 9cca87a. Could remove: about 104–107 lines, in 5 places (≈43% of the additions). Biggest subtractions:

Full report · Notes

code review summary

Recommendation: Changes Requested

The previous round's blocker is fixed at 9cca87a — the two gauges are now zeroed in the copy-out retry key — as are the retire pin ordering and the wrong cache.rs doc comment. What remains is one self-contradictory API paragraph, four mechanical description corrections, and about 75 of the 246 added lines that can simply be deleted; nothing asks for new code, tests, flags or docs.

Full report · Notes

Pre Test Report

Pre-test report — PR #549 "Report KV pages held by active requests" (head 9cca87ac)

Recommendation: DO NOT refer to hardware testing. Return to the author for a short should-fix round; when it lands, clear the PR on host-side CI plus one optional scrape — no GPU slot.

This supersedes my 2026-11-26 report on 5ed7af8. The new head fixes the one defect that made the PR genuinely untestable (the gauges had leaked into the behavioural copy-out retry key), and I withdraw one of my own prior conclusions — the "#537 not delivered, off by ~5×" claim was overstated (§2.4).


1. What the change is

Two new Prometheus-text-only gauges, +246/−16 across 8 files, closing #537:

Rendered as gauges beside cached_kv_pages (helios/src/server/metrics.rs:1309-1318), stored from SchedulerStats (metrics.rs:517-518), deliberately absent from the JSON Snapshot. Supported by new direct_request_pins/request_pins on Checkpoint and a pin_request/unpin_request API through which every request-owned pin in the scheduler now routes.


2. Substantive assessment

2.1 FIXED and verified — the copy-out retry key no longer sees the gauges

I re-read helios/src/server/runtime.rs:2441-2456. CopyoutResources (:1053-1059) embeds SchedulerStats whole and derives PartialEq; the head zeroes the two new fields when building the key:

scheduler: crate::scheduler::SchedulerStats { request_pages: 0, reserved_pages: 0, ..self.scheduler.stats() },
...
let retry_copyouts = retry || progress || self.copyout_resources != Some(resources);

That restores pre-PR semantics exactly (retry || progress were already in the condition). Also verified fixed: retire now releases the request pin at scheduler.rs:3155 before request.take() at :3157, so a failed release leaves the request inspectable; the cache.rs:548-550 doc comment no longer claims the cache counts private pages; and the three mirrored if inbound.is_none() pin blocks are collapsed into pin_prefix/unpin_prefix (scheduler.rs:1643-1645, :1656, :1678; helpers :2025-2040).

2.2 SHOULD FIX — pin_request/unpin_request walk the ancestor chain twice (this is the testing gate)

cache.rs:551-563: pin_request calls self.pin(id)? — which itself computes self.chain(id)? at :523 — then computes self.chain(id)? again at :554 and walks it again. unpin_request mirrors it at :569/:571. Every admission (scheduler.rs:1645), ticket waiter (:1889), boundary publication (:2977, :2997) and retirement (:3155) pays two Vec<CheckpointId> allocations and two walks.

All four review lenses flag this. It gates testing for a specific reason: the house-style fix (fn pin_with(&mut self, id, request: bool) walking once, with pin/pin_request as thin wrappers) rewrites the two functions that own the counter's 0↔1 transitions — exactly the code a test would otherwise be written against. Fix, then test.

2.3 SHOULD FIX — documentation a tester will read states two false things

  1. docs/api.md:307-310 contradicts itself. It first says request + reserved is the figure comparable to another runtime's used KV cache, then says "Dividing either gauge by flare_total_kv_pages excludes idle cached prefixes and snapshot backing pages." Both cannot be the intended ratio: reserved is 2-3 pages of 21,504 under load, so reserved/total carries no information. The comparable ratio is (request + reserved)/total. The trailing clause also misattributes the exclusion to the division rather than the numerator, and "either gauge" invites a reader to think all of cached is excluded — which api.md:303-306 correctly denies.
  2. docs/api.md:302 "on every scheduler pass" overstates the cadence. The worker stores only when a pass made progress (runtime.rs:1148-1149), plus startup (:722) and a drained shutdown (:745). A stalled worker legitimately leaves the gauge stale; say "on passes that make progress".
  3. docs/api.md:311-312 documents a #[cfg(test)] assertion (cache.rs:818-837) in the operator API page. True, but validation evidence belongs in the PR body.

Fold in with these (not blocking): the JSON field table (api.md:332-362) gains no rows for the two gauges and the prose never states they are Prometheus-only, which is the intent; and api.md never states that Inbound restore-ticket pages appear in neither gauge (they leave the free list at scheduler.rs:1693-1695; the live request starts with private_pages: Vec::new() at :1792).

2.4 CORRECTION — I withdraw my prior "#537 is not delivered" conclusion

My previous report argued the PR fails #537 because 399/21,504 ≈ 1.9% sits five times below #537's ≈9% vLLM reference. Re-reading #537: its proposal is literally "A gauge flare_request_kv_pages … Then flare_request_kv_pages / flare_total_kv_pages matches vLLM's metric." The PR implements the issue's own option 1 as written. The 9% figure is a different model, different pool, different load, so that comparison is not like-for-like and I should not have called it a shortfall. The honest position: comparability with vLLM is unverified, it is a reporter question for #537, and no hardware run on our fleet can settle it — a scrape here yields one more self-consistent number. The gauges do narrow #537's ~0%–16% bounds, which is the value the issue asked for.

2.5 COVERAGE GAP — the author's reported test run does not exercise the runtime.rs change

The description reports 508 passing under --lib -- cache:: scheduler:: server::metrics. phase_tests is a module at helios/src/server/runtime.rs:3956-3958 (server::runtime::phase_tests), so that filter does not select it — and helios/src/server/runtime/phase_tests.rs is where the copy-out deferral behaviour lives (:6357-6384 local_copyout_defers_without_a_pin_until_pending_admission_headroom_returns, :6386-6404 discard-on-eviction, :6407-6431 headroom recheck, :6176 re-offer counters). The one behaviour-changing file in the diff is therefore unexercised by the cited evidence. This is the single highest-value thing a re-run can supply, and it needs no GPU.

2.6 Nits — safe to ignore for a test decision

2.7 Subtract — the new scheduler test replays an existing one

helios/src/scheduler/tests.rs:970-1034 reproduces branching_requests_own_distinct_tail_pages_and_terminal_snapshots (:1036-1081) step for step; lines 972-1009 are identical to 1038-1075 and only 1010-1033 is new evidence. Appending those assertions to the existing test removes ~55 lines and a redundant target from the plan.


3. Verified sound — why the change is worth landing


4. Hardware assessment — a GPU is the wrong instrument

Available: cn5 4× RTX PRO 6000 Blackwell (SM120, amd64), GLM-5.3-Flash-NVFP4 TP4; cn7 1× GB10 (SM121, arm64), Qwen3.8-27B-NVFP4 TP1.

Expected value of a hardware run today: low — it would be the first suite execution on a draft, against pin functions about to be refolded, producing a ratio the reporter may still redefine.


5. Testing plan — after §2.2, §2.3 and §2.7 land

Stage 1 — host only (this is the validation)

  1. Full suite, release profile, no path filter: cargo test --release --lib (not the reported cache:: scheduler:: server::metrics filter) so server::runtime::phase_tests runs. The copy-out deferral tests at phase_tests.rs:6357-6431 and re-offer counters at :6176 are the only coverage of the runtime.rs change.
  2. Drift assertion across the suite: confirm cache.rs:818-837 covers request_pinned_pages and stays silent through cache, scheduler and lifecycle tests.
  3. Add the Existing-publication case. A grep for Existing in helios/src/scheduler/tests.rs returns nothing, so nothing drives pin_request through publish_boundary's shared-checkpoint branch (scheduler.rs:2990-3006) — the one place a request swaps its own parent's pin for a checkpoint another request already pinned, exactly where a double count or missing pin would hide. The new test cancels rather than completes (tests.rs:1029-1030), so the Created retire path is also unexercised. Cheapest form: the §2.7 merge plus one completed retirement beside the two cancels.
  4. Write the regression test the fix deserves: leave a copy-out deferred for headroom, advance one decode step across a page boundary (moving reserved → private while free_pages/cached_pages hold), assert the FakeStore saw no second store. This makes "no scheduling decision changes" checkable in CI rather than by inspection.
  5. Windows build, which the description itself flags as unrun.

Stage 2 — optional, only if the maintainer wants a number for #537

One job, ~15 minutes, cn7 (1× GB10, Qwen3.8-27B-NVFP4 TP1 — simplest single-GPU KV pool, least confounding arithmetic). Five scrape checks, no benchmarking:

  1. Idle: request_kv_pages == 0, reserved_kv_pages == 0.
  2. Publish freshness: scrape idle, then immediately after activity; confirm the value reflects the last progressing pass, validating the corrected api.md:302.
  3. Two concurrent streams on a shared prefix: record request, reserved, cached, free, total; assert request_pinned_pages <= cached_pages (the invariant that attests the gauge) and request + reserved < total - free - cached.
  4. Record (request + reserved)/total. Do not gate on matching vLLM.
  5. Cancel one request mid-flight and scrape: both gauges drop to zero while pages are still retiring.

Excluded, with reasons: no throughput A/B against main (no perf path changed); no long soak; no multi-model matrix; no repeat of the author's two-GPU DeepSeek run (unreproducible fork base, answers a reporter question); no per-model sweeps.


6. Referral decision

Not referred to hardware testing. Send back for the pin_with fold (§2.2), the ratio sentence + removal of the #[cfg(test)] reference + publish-cadence wording (§2.3), the test merge (§2.7), and a PR body that names runtime.rs and drops the two false claims (§2.6). Non-draft status with CI green on the new head is a precondition.

When those land, no GPU referral is needed: Stage 1 is the validation and the Stage 2 scrape is a reporting convenience for #537, not a correctness gate. The accounting logic is sound and well-guarded (maintained counter with a full-scan drift assertion on every stats() read, sound compaction and eviction invariants, symmetric pin/unpin across every request-owned path), so the change is worth landing — it simply does not need our hardware to prove it.

Full report · Notes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

screen malicious

Screen Result: All Clear

Evidence: PR #549 ("Report KV pages held by active requests", head bca7358, 8 files, +202/−34) contains no prompt injection, hidden instruction, or agent-directed content.

One benign point already raised by the earlier review: the description's "no scheduling decision changes" is a mild overstatement, since the new fields ride inside SchedulerStats/CopyoutResources; the PR deliberately zeroes them at helios/src/server/runtime.rs:2441-2450. Descriptive imprecision, not a planted instruction.

Not verified: the PR's own test counts and live scrape figures (no re-run). This does not affect the screening.

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: WynnD (no GitHub association with the repository; commit name "Wynn Drahorad"; Discord: oystersmiles) — first-time contributor Motivation: /metrics shows cached and free KV pages but not the pages live requests hold, so an operator cannot compute the KV share in use the way vLLM's kv_cache_usage_perc does (issue #537). This PR maintains that count as pins change and exports it as two new Prometheus gauges. Scale: +202 / −34 lines in 8 files Proposal:

Full report · Notes

Value Proposition

Verdict: worth merging — one documentation clause, no code changes required

Head bca7358 (+202/−34, 8 files) is the strongest version of this PR: the round-one blocker is fixed, retirement releases the request pin before the slot empties, the duplicated pin-flavour branches are folded behind pin_prefix/unpin_prefix, the two copied page tests are merged one-per-layer, and the API paragraph now states the awkward truths. Nothing in the diff changes an allocation, eviction, or scheduling decision.

Fit against the charter

A reported defect, not a wish. #537 is version-cited and reproducible (v0.3.2 c0c4f79): with the shipped gauges an operator can only bound KV use — ≈16 % upper, ≈0 % lower, against ≈9 % on vLLM — because a request's pinned prefix pages stay inside flare_cached_kv_pages and its reserved growth pages appear in no gauge. That is squarely the charter's merge list ("a reproducible bug … or bad docs"), and it is the missing half of the monitoring story #541 is shipping.

Right layer, no new switches. The counter lives where the quantity lives: helios/src/cache.rs maintains request_pinned_pages as pins change (cache.rs:519–589), helios/src/scheduler.rs adds its live slots' private and reserved pages in the same pass that already counted active requests (scheduler.rs:1199–1221), helios/src/server/metrics.rs renders two gauges (metrics.rs:1309–1318). No flag, env variable, per-model branch, or backend abstraction — nothing near a non-goal or the "no configuration switches" rule.

It respects the invariant it could have broken. The cache already keeps ready_checkpoints/unready_checkpoints/tail_pages precisely so stats never scans nodes (cache.rs:257–275, 825–861). The new counter follows that established pattern instead of adding the per-scrape graph walk the existing comment forbids. No simpler route to the same end exists: #537's own alternative (splitting cached_kv_pages into pinned/idle) needs identical bookkeeping and yields a less directly usable number; a ready-made ratio gauge would hide the reserved term and freeze the arithmetic.

Correctness, re-verified at this head

Cost and beneficiaries

Two u64 per Checkpoint, one usize on the cache, one add/sub per pin on a chain already walked, and per stats one loop over at most slot-count live requests. No GPU work, no allocation, no scheduling decision; the description states the cost was read from code and not measured, which is correct for a visibility-only change.

Beneficiaries are operators migrating vLLM/Grafana dashboards and #541's KV panel, which otherwise shows only bounds. reserved_kv_pages is the cheap half — the measured value was 2–3 pages under two streaming chats — but it accounts for pages that leave free_pages at admission and appear in no other gauge, and it makes the documented (request + reserved) / total the vLLM-comparable figure that #548's mapping table will point at. The request gauge is the valuable half.

Evidence

Four-part description with a Discord: line and an explicit not-run list (Windows build, full helios suite, exported core → CI). The live scrape is the right shape and honestly scoped: idle 0/0 with 2019 cached of 21504; two concurrent streams 399/402 request pages, 3/2 reserved, ratio 0.0186/0.0187; the implied bound request + reserved ≤ total − free holds; no cross-runtime comparison claimed; the author discloses that the instance also served the agent's own traffic. The description correctly notes the scrape ran on 9cca87a and that bca7358 changed only docs, tests, and pin-bookkeeping structure — which the cache and scheduler tests assert directly.

What remains

One clause, no longer a gate. Snapshot (metrics.rs:70–129) is the documented format=json body and these two gauges are Prometheus-only. Earlier I treated that as blocking; at this head it is not, because docs/api.md:292–296 already frames that table as the JSON subset ("Beyond the JSON fields below, the text includes …"). One added sentence to the paragraph at docs/api.md:298–310 — "these two are Prometheus-only; the snapshot does not carry them" — closes it. Adding the two fields to Snapshot would also let the terminal dashboard plot them; that is a follow-up, not a merge condition.

Worth knowing, not worth blocking: SchedulerStats now doubles as the deferred-copy-out key, so every future field must be judged for key-worthiness (the manual two-field exception is commented — the cheap mitigation); a Debug-only cross-check that every live request with prefix: Some(_) carries a request pin would make a future mispair fail loudly, and the release-ordering fix already removes the silent-leak failure mode; pages of self.retired and of an in-flight restore ticket stay outside both gauges, which the docs now state.

Bottom line: worth merging. Focused, correctly layered, honestly evidenced, at a complexity cost the cache was designed to absorb, answering a defect a user reported with reproduction detail. Ask for the one-clause JSON sentence in docs/api.md and let CI cover the Windows build and full helios suite the description already flags; #549 and #548 touch disjoint regions of metrics.rs, so merge order does not matter.

Full report · Notes Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Simplicity

Verdict: clean (nits only) Blocking:

Simplicity review of PR #549 at head bca7358. Both should-fix items from the previous round are fixed by that commit: pin_request/unpin_request now collapse onto one pin_with/unpin_with that walks the chain once (helios/src/cache.rs:519-589), and the duplicated scheduler test is folded into branching_requests_own_distinct_tail_pages_and_terminal_snapshots (helios/src/scheduler/tests.rs:970-1032). Three earlier nits are also gone (the generic-guard re-test, the #[cfg(test)] clause in docs/api.md, one redundant slots scan), and the comparable-share sentence is now correct.

Six reductions remain, none changing a gauge value:

  1. cache.rs:529-532/554-557 — two nodes.get_mut lookups back to back per pin and per release, plus self.checkpoint(id)? twice at 547 and 550; bind the node once. Callers are the admission, ticket-waiter, boundary-publication and retirement paths.
  2. scheduler.rs:1213/1216/1222-1233 — retiring_slots, checkpoint_anchor_guards and inbound_waiting still each walk self.slots although the new loop at 1205-1209 already does; fold all four into one pass (~14 lines, three passes fewer) — stats() runs every scheduler progress step.
  3. scheduler.rs:3144-3148 — the moved retirement block re-reads prefix and error_code although both are in hand at 3113/3110; use the locals.
  4. scheduler.rs:2018-2033 — pin_prefix/unpin_prefix are 16 lines re-dispatching the bool the cache already dispatches; make the cache entry points pub(crate) and delete the pair (three call sites, all in admit_planned).
  5. cache.rs:83/461/531/547-549/556 — direct_request_pins exists only for the unpin_request guard, and bca7358 deleted the only assertion that reached it (cache/tests.rs:336 now tests the plain-unpin guard); restore that one line or drop field plus guard, per AGENTS.md:194-199.
  6. docs/api.md:298-310 — 13 lines for two gauges that get one table row each elsewhere; trim to ~7 lines (two definitions, overlap plus exclusions, publication timing, comparable share).

Noted, not requested: the ..self.scheduler.stats() mask at runtime.rs:2441-2450 exists because CopyoutResources embeds all of SchedulerStats, so each future field silently joins the copy-out key.

Kept with reasons: transitive request_pins, the separate CacheStats::request_pinned_pages, the request/plain pin split at admission, compaction's assert plus heir inheritance, the test-only drift assertion, and the Prometheus-only atomics reusing the existing gauge table. No CUDA or low-level GPU code in the PR. The live-scrape numbers are the author's own measurement and outside this lens.

Full report · Notes

Correctness

Verdict: clean Blocking:

Reviewed PR #549 at head bca7358 through the correctness lens; all eight changed files read in context.

Verified sound: (1) the invariant "LiveRequest::prefix == Some iff a request pin is held" holds on admission (scheduler.rs:1636-1638), ticket waiters (1882), both boundary outcomes (2970-2972, 2990-2991), retirement (3144-3150, release now before the slot is emptied), cancel, preemption and shutdown; host-ticket and copy-out pins correctly keep the plain API (2037-2043), so the new "no request pin to release" error has no reachable caller. (2) request_pinned_pages cannot drift or underflow: all guards precede mutation in pin_with/unpin_with (cache.rs:519-570), the counter moves only at 0↔1 crossings, retire_leaf/compact_ancestor are gated on pins == 0 so no counted node leaves nodes, compaction keeps the count in the heir, and the test-only full-scan assertion (827-846) checks it on every stats() call. (3) Both gauges are summed in the existing slot loop (1200-1221) and stored/rendered correctly (metrics.rs:517-518, 1309-1318), absent from the JSON snapshot as documented. (4) The one real hazard — SchedulerStats equality widening CopyoutResources, which would re-offer deferred host copy-outs on every decode step — is explicitly defused by zeroing both fields in the key (runtime.rs:2441-2455), and runtime.rs:1056 is the only other comparison.

Nits: "not written yet" wording is imprecise across the commit→completion window (docs/api.md:304-305, metrics.rs:1315-1317); the docs field table still lacks rows for both gauges (docs/api.md:330); the Existing { ready: true } re-pin path (scheduler.rs:2987-2998) has no stats assertion; pin_prefix's bare bool pin kind (2019-2033) is a latent footgun.

Process, not code: the live scrape builds on fork commit 5ffe4d54, absent from this repository, so the evidence cannot be reproduced from the branch; no CI checks on the head commit; no GPU run, exported core, Windows build or full suite was done.

Full report · Notes

Architecture

Verdict: clean

Blocking:

Should fix:

Nits: 1 — CopyoutResources (helios/src/server/runtime.rs:1053-1059) still embeds all of SchedulerStats and feeds the deferred-copy-out retry comparison (2455-2456); the new request_pages/reserved_pages are hand-zeroed when building the key (2443-2450), so every future gauge added to SchedulerStats silently perturbs copy-out scheduling unless the zeroing list grows. Giving the key only the cache fields it depends on would remove the coupling (AGENTS.md:188-193).

Link: https://github.com/NVIDIA/hyperflare-inference/pull/549

Detail: the change belongs in the repository and the approach is right. It stays inside shared runtime layers — cache accounting (helios/src/cache.rs), scheduler stats and the request-pin API (helios/src/scheduler.rs), Prometheus text (helios/src/server/metrics.rs), docs/api.md — with no per-model branch, flag, environment switch, or change to allocation/eviction/scheduling decisions, and the count is maintained on pin/unpin so Cache::stats never scans nodes, the constraint the PR states. It implements exactly option 1 of issue #537, which demonstrates a concrete metric gap (AGENTS.md:165-169; charter "What gets merged"). All four findings from my previous round are verified fixed at head bca7358: single ratio (request + reserved)/total (api.md:308-310), no test-only assertion in the operator page, publish cadence matching runtime.rs:1148-1149/722/743-746, and pin_prefix/unpin_prefix chosen once via request_pin (scheduler.rs:1636, 2018-2033) with retire releasing before the slot empties (3142-3149). Count maintenance is exact across compaction (cache.rs:632-641) and leaf retirement; a test-only drift assertion compares the counter with a full nodes scan on every stats read (cache.rs:825-846) and is the real evidence for the gauge — the PR body's live request + reserved < total − free − cached check does not attest it, since total − free − cached is dominated by snapshot-backing pages.

Full report · Notes

Conventions

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 1 — the new gauges get no docs/runtime-core-design.md entry where flare_snapshot_backing_pages has one (docs/runtime-core-design.md:873).

Link: https://github.com/NVIDIA/hyperflare-inference/pull/549

Full report · Notes

Prose

Verdict: nits only

Blocking:

Should fix:

Nits: 2 — (1) docs/api.md:298-310 never states that flare_request_kv_pages and flare_reserved_kv_pages are absent from the ?format=json snapshot, although the PR description says so, api.md:292-296 already routes text-only families explicitly, and the JSON field table at api.md:330-360 (and Snapshot, metrics.rs:70-108) has no such field. (2) docs/api.md:308-310 asserts the ratio "is the share comparable to vLLM's kv_cache_usage_perc" with no qualification, while the description disclaims any cross-runtime comparison ("No comparison with another runtime is claimed"), against AGENTS.md:55-57 and :95-102. One consistency point not counted as a nit: api.md:298 says "requests owning a model slot" while scheduler.rs:130 and metrics.rs:1311 say "active requests"; all three describe slot.request.as_ref() (scheduler.rs:1205), so unifying the wording would prevent a reader asking whether Inbound waiters count.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/549

Full report · Notes

Subtractive

Verdict: make it smaller first The change: +202 / −34 lines across 8 files (bca7358) Could remove: about 57 lines, in 4 places

Biggest subtractions:

Left behind: None. Cache::pin/unpin keep real callers (scheduler.rs:1864, 1900, 2037–2043; runtime checkpoint pins; ~13 test sites) and has_pins (cache.rs:291) is not superseded.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/549

Full report · Notes

Pre Test Report

Pre-test report — PR #549 "Report KV pages held by active requests" (head bca7358, +202/−34, 8 files)

Recommendation: REFER to hardware testing — but as ONE bounded job (~30 min, 1× GB10 on cn7), gated on CI green first. No throughput A/B.

This reverses my previous "do not test" verdict, because every item I gated on is now fixed at bca7358. I re-verified each in the code, not from the summaries. What remains is idiom duplication, one missing docs sentence, and a coverage nit — none of which changes a gauge value or any assertion a hardware test would carry, so hardware time would not be spent on code that will be rewritten.


1. What the change is

Two Prometheus-text-only gauges, closing #537:

Rendered beside cached_kv_pages (helios/src/server/metrics.rs:1309-1318), stored from SchedulerStats (metrics.rs:517-518), deliberately absent from the JSON Snapshot. Supported by new direct_request_pins/request_pins on Checkpoint and a pin_request/unpin_request API that every request-owned pin now routes through.

2. Prior gating items — all verified closed at this head

  1. Single chain walk. pin_with/unpin_with (cache.rs:519-570) compute chain(id) once (523, 553); pin/unpin (572-578), pin_request (583-585) and unpin_request (587-589) are one-line wrappers. The duplicate walk and duplicate Vec allocation I gated on are gone.
  2. Docs ratio fixed. docs/api.md:308-310 now states one ratio, (flare_request_kv_pages + flare_reserved_kv_pages) over flare_total_kv_pages. The self-contradictory "dividing either gauge" sentence is gone.
  3. Publish cadence correct. docs/api.md:305-307 ("when a scheduler pass makes progress, and again at startup and after the shutdown drain") matches runtime.rs:1148-1149, 722, 743-746.
  4. #[cfg(test)] scaffolding removed from the operator API page.
  5. Duplicated tests folded. cache/tests.rs:320-373 is one test (3 not 4 at 334; plain copy-out pin neutral at 342-345; compaction keeps the count at 357-358; 0 on last release at 359-360). scheduler/tests.rs:970-1032 is one test (sums at 1021-1023, drain-to-zero at 1027-1031).
  6. The round-one blocker stays fixed. runtime.rs:2441-2453 builds CopyoutResources with SchedulerStats { request_pages: 0, reserved_pages: 0, ..stats() }, compared at 2455. runtime.rs:1056 is the only other SchedulerStats comparison, so the gauges cannot re-offer deferred host copy-outs.

3. Remaining issues — none blocks testing

Nothing here is a substantive architecture or quality problem. The accounting is exact: adjustments occur only at the 0↔1 crossings of request_pins; every nodes removal is gated on pins == 0; chain includes the target node, so a publication promoting an already-pinned ancestor cannot double count; compaction asserts ancestor/heir agreement and moves tail pages into the counted heir. The test-only drift assertion (cache.rs:825-846) compares the maintained count with a full scan on every stats() read across the suite — the strongest evidence in the PR and host-independent.

4. What CI already covers — correction to my own earlier claim

I previously said the author's filter omitted server::runtime::phase_tests. That was wrong. phase_tests is declared at runtime.rs:3956-3958, so -- server:: scheduler:: cache:: does select it, and the copy-out deferral tests (phase_tests.rs:6357-6431) and the re-offer counter test (6176-6197) were inside the reported 809-passed run.

More important for resource use: the repository's own CI runs exactly the suite a tester would run — .github/workflows/native-serving.yml:56-68 (not opened) executes cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) --features runtime-core,server on ubuntu-24.04 and windows-2022, with FLARE_TEST_TEMPLATE_DIR prepared at :28-31 (which also explains the author's single reported failure). :69-77 adds the CLI and flare-app suites.

So Stage 0 is free: get CI green on the head. There are no checks on bca7358. Do not spend a GPU slot running cargo test — that is what CI is for, and running the suite on a GPU host would be the definition of wasted hardware time on an observability-only change.

Genuine test gaps that a unit test should close (author-side, cheap, not hardware work):

5. Expected value of the hardware run — moderate but narrow

What our hardware genuinely adds, and nothing else can:

  1. The gauges exist and move through a real progress-gated publish cycle in a serving worker (runtime.rs:1148-1149) — the unit test drives Metrics directly, so it proves rendering, not the loop.
  2. Distinct-page semantics in a live pool. Two requests on the same prompt: the second pins the same checkpoint, so the cache counter does not move and only its private pages add. Assert R2 − R1 is far smaller than R1. A double count would show R2 − R1 ≈ R1. The author's own numbers show this working (399 → 402, a differential of 3 against a ~29-page shared prompt) but on a fork base absent from this repo.
  3. The Inbound/restore window, whose size depends on real restore timing (scheduler.rs:1686-1688 pops ticket pages from free_pages; 1882 pins only at ticket resolution). Documented as outside both gauges; only real timing shows the window is small.
  4. Optionally, the runtime.rs key fix under a real host store via flare_host_cache_reoffer_calls_total (metrics.rs:1172-1179, incremented only on a genuine re-offer at runtime.rs:2482-2494). This bites only when deferred copy-outs exist, so it is optional, not a gate.

What it does not add, and why we are spending only 30 minutes:

6. Test plan

Stage 0 — free, precondition (author / CI, no hardware)

CI green on the head: native-serving.yml Linux and Windows. Note the PR is still a draft with no checks run; if it is merged or promoted without green CI, bca7358 has never been through cargo test on a clean runner and this PR should not consume hardware before then.

Stage 1 — one job, ~30 minutes, cn7 only

cn7, 1× GB10, nvidia/Qwen3.8-27B-NVFP4 TP1 — the simplest single-GPU KV pool, so the ledger arithmetic has the least confounding machinery. Do not also run cn5/TP4; that would duplicate the same scrape at 4× the cost.

Serve once, no restarts, and scrape /metrics text only. Checks, in one session:

  1. Idle ledger. No request live: flare_request_kv_pages == 0 and flare_reserved_kv_pages == 0, with flare_cached_kv_pages > 0 after a warm request. (Author: 0/0 with cached 2019.)
  2. Publish freshness. Scrape, idle 10 s, scrape again — unchanged; then send one request and scrape again — it moves. This validates the corrected api.md:305-307 and documents that a stalled worker legitimately holds a stale value. Take post-activity scrapes after one further step, not at the instant of cancel.
  3. Shared-prefix differential (the real assertion). Send two concurrent streaming requests on an identical ~1–2k-token prompt, max_tokens ~1500. Scrape; admit the second; scrape again. Assert R2 − R1 is on the order of one request's private pages, i.e. much smaller than R1. This is the distinct-page property nothing else tests live.
  4. The bound. Assert request + reserved ≤ total − free (the bound the definitions imply). Do not subtract cached — the docs correctly state pinned checkpoints count in both gauges.
  5. Record, do not assert: (request + reserved) / total, plus free, cached, total. This is the artifact a maintainer needs for #537; it is the single most valuable output of the run and it must not become a pass/fail gate.
  6. Drain. Cancel one request mid-flight, take one scrape after the next step: both gauges fall to 0 while flare_cached_kv_pages stays > 0. (Retirement releases the pin before the slot empties — scheduler.rs:3144-3150 — so a stale nonzero at the instant of cancel is expected, not a bug.)
  7. Optional, only if configured anyway: start with flare run --prefix-cache-memory SIZE (docs/prefix-cache-offload.md:884), record flare_host_cache_reoffer_calls_total twice across decode, confirm no per-step growth. Skip if deferred copy-outs never occur — the key is then never compared against differing resources and the check is vacuous.

Pass criteria: 1, 3, 4, 6 hold; 2 and 7 consistent with the docs; 5 recorded.

Explicitly excluded, with reasons: no throughput A/B against main (no perf path changed); no soak; no multi-model or multi-hardware matrix; no repeat of the author's two-GPU DeepSeek scrape (fork base 5ffe4d54 is not in this repository, and it answers a reporter question, not a correctness one); no per-model sweeps; no JSON-snapshot assertions (the gauges are deliberately absent, and the docs do not yet say so).

Re-scope trigger: if the maintainer accepts the subtractive suggestion to drop flare_reserved_kv_pages (a gauge #537 did not request), drop checks on it and keep 1, 3, 4, 5, 6 — roughly half the assertions survive unchanged, so the job does not need re-planning.

7. Security / instruction-integrity note

The screening passes (all clear) agree with my own reading: no injection, no agent-directed instruction in the PR body, diff, or discussion. Two items worth naming for completeness, both benign: the author's one-line "review the pushed changes" comment is an ordinary workflow request, and the #autobot:ignore opt-out token appears only in this repository's own automation boilerplate. The PR body's live-scrape figures are an honest measurement caveat ("the instance also served this agent session's own requests"), not an instruction.

8. Decision

Refer — bounded. Expected value is moderate but narrow: one ~30-minute cn7 job validates the parts only a live worker can show (gauge movement, distinct-page semantics under a real shared prefix, the restore window, the drain) on a change whose accounting is already proven correct and whose unit coverage comes free from existing CI. The PR is worth landing: it is correctly layered, model-agnostic, respects the Cache::stats no-scan constraint, and closes a reported observability gap.

Before merge, and not gating the hardware run: restore the unpin_request guard test (or delete the field plus guard), collapse or rename pin_prefix/unpin_prefix, add the one sentence that the two gauges are Prometheus-only, and get CI green on the head.

Full report · Notes

code review summary

Recommendation: Changes Requested

bca7358 fixes every item from the previous round and folds the duplicate tests; what remains is one API-doc sentence, one restored test assertion, and about 55 of the +202 added lines that can simply be deleted. Nothing here asks for new code, tests, flags, or docs.

Full report · Notes Decision to Test: no (91%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

screen malicious

Screen Result: All Clear

Evidence:

Open questions: none affecting the verdict. Author WynnD has no repository association (0 merged) and CI has not run on the head commit, which are ordinary review-risk notes, not injection signals.

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: WynnD (@WynnD on the PR; commit name "Wynn Drahorad"; Discord: oystersmiles); first-time contributor, no GitHub association with the repository Motivation: /metrics reports free and cached KV pages but not the pages live requests hold, so an operator cannot compute KV utilisation the way vLLM's kv_cache_usage_perc does. This PR keeps a pin-time counter for request-held pages and adds two gauges so that share becomes scrapeable. Scale: +202 / −34 lines in 8 files Proposal:

Full report · Notes

Value Proposition

Verdict: worth merging — the change belongs in Flare; the remaining items are cheap polish, not gates

Head bca7358, +202/−34 across 8 files, no new commits since the last review round. The only new material is WynnD's live-validation table (2026-11-28 03:26) and a bot review asking for "Changes Requested" with 0 blockers, 2 should-fix items, ~55 deletable lines and 7 nits. I re-verified the counter's invariant from the code at this head (not from the description) and re-checked the fit against the charter; the verdict is unchanged: merge it, ideally after folding in the one doc sentence and the reviewer's two should-fix items.

Charter fit — this is on the merge list, at the right layer

It closes a reported, reproducible defect. #537 (hyperflare-inference v0.3.2 c0c4f79) shows that with the shipped gauges an operator can only bracket KV use: 1 − (free + snapshot_backing)/total ≈ 16 % as an upper bound, 1 − (free + cached + snapshot_backing)/total ≈ 0 % as a lower bound, versus ≈9 % on vLLM for the same load. Two mechanisms cause it — a request admitted on a prefix hit shares the checkpoint's pages in place, so they stay inside flare_cached_kv_pages; and reserved growth pages leave free_pages at admission while appearing in no gauge at all. The charter's "What gets merged" list explicitly includes "a reproducible bug … or bad docs", and this is the KV half of a monitoring story #541 is already shipping. It is not a speculative feature request.

Solve it in the right place, with the smallest footprint. The counter lives where the quantity lives: PrefixCheckpointCache maintains request_pinned_pages as pins change (helios/src/cache.rs:536–566, reported at 851), the scheduler adds its live slots' private_pages and reserved_pages in the loop that already counted active_requests (helios/src/scheduler.rs:1200–1221), and the renderer emits two gauges with help text (helios/src/server/metrics.rs:1309–1318). No flag, env var, per-model branch, backend abstraction or new switch — nothing touching a non-goal, nothing near the "no configuration switches / no per-model special cases" rules. This is a runtime-observability concern, which is exactly helios's remit.

It respects the invariant it could have broken. The cache keeps ready_checkpoints/unready_checkpoints/tail_pages specifically so stats never walks nodes (helios/src/cache.rs:257–275, 825–861). The new counter follows that pattern instead of introducing a per-scrape graph walk the code forbids. That is the strongest architectural argument for this PR over the obvious alternative.

No duplication and no simpler route. #537's own second proposal — split cached_kv_pages into pinned and idle — needs identical bookkeeping and yields a number you must combine with private pages anyway. A ready-made flare_kv_cache_usage_ratio would hide the reserved term and freeze arithmetic that #548's metric-mapping work wants to state in prose. Nothing already in the tree reports request-referenced pages: flare_free_kv_pages, flare_cached_kv_pages, flare_snapshot_backing_pages and flare_active_requests are the whole existing set.

Correctness, re-derived at this head

Who benefits, and how much

Operators who migrated vLLM/Grafana dashboards, and #541's KV panel, which today can only show bounds. flare_request_kv_pages is the valuable half — it makes (request + reserved) / total the documented vLLM-comparable figure (docs/api.md:298–310). flare_reserved_kv_pages is the cheap half but accounts for the only pages that vanish from every other gauge at admission, and it keeps the documented arithmetic honest. The audience is real but modest: this is a focused local-inference prototype, not a fleet server, so the benefit is one dashboard-grade number, not an SLO primitive.

Cost

Two u64 per Checkpoint, one usize on the cache, one add/sub per pin on a chain already walked, and per stats one loop over at most slot-count live requests. No GPU work, no allocation, no scheduling decision, no new test infrastructure. The description states the cost was read from code rather than measured, which is the right disclosure for a visibility-only change. The one structural cost worth naming: SchedulerStats now doubles as the deferred-copy-out key, so every future field must be judged for key-worthiness — mitigated by the commented exception, and worth a follow-up only if the struct keeps absorbing fields.

Evidence — adequate, honestly scoped, weaker than it looks on KV pressure

Four-part description with a Discord: line and an explicit not-run list (Windows build, full helios suite, exported core → CI). The new live table adds a second hardware configuration and a shared-prefix case: 54–80 request pages and 16–22 reserved of 20,480 pages at 16 concurrent streams, and 399–402 / 2–3 of 21,504 on two-GPU DeepSeek-V4.1-Flash with two chats; 809 tests, one unrelated template test requiring FLARE_TEST_TEMPLATE_DIR.

My honest reservation, which does not change the verdict: those request-page numbers are ~0.4 % and ~1.9 % of the pool, so the live data proves the gauges move, are monotone with load, and satisfy the implied bound — it does not reproduce #537's ≈16 %-vs-≈9 % heavy-context gap, where a vLLM dashboard would actually mislead. A scrape during a long-context run at high page occupancy would be the data that closes that loop, and it is cheap to add. Also note the validation image mixes #549 with #548 and #560, so the scrape does not isolate this PR's effect (though the unit tests do).

What I would ask for, none of it a gate

  1. One doc sentence (the reviewer's main should-fix): the two gauges are Prometheus-only; Snapshot (metrics.rs:70–129), which is the format=json body and the table at docs/api.md:330–360, does not carry them. The paragraph at docs/api.md:298–310 should say so, and the existing "Beyond the JSON fields below, the text includes …" sentence at 292–296 could name them. This matters because the JSON table is otherwise the authoritative field list, even though flare_snapshot_backing_pages is already a gauge with no table row.
  2. The reviewer's second should-fix and the ~55 subtractable lines — micro-scale (helper shape, one guard, folded test assertions). They improve the patch; they do not change whether the patch is right.
  3. Follow-up, not this PR: adding the two fields to Snapshot would let the terminal dashboard plot them (dashboard.rs:514–529 currently prints cached/free/total only).

Bottom line: this is a defect-driven, correctly layered, honestly evidenced observability change whose bookkeeping cost the cache was already designed to absorb, and whose whole point is a number the project currently cannot compute. Worth merging; ask for the JSON sentence and let CI cover the Windows build and full suite the description already flags. #549 and #548 touch disjoint regions of metrics.rs, so merge order does not matter.

Full report · Notes Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Simplicity

Verdict: should-fix issues only Blocking:

Detail: both prior should-fix items are fixed at head bca7358 — pin_request/unpin_request now share one pin_with/unpin_with chain walk (cache.rs:519-589), and the duplicated scheduler test is folded into branching_requests_own_distinct_tail_pages_and_terminal_snapshots (scheduler/tests.rs:970-1032). Nothing blocking; no gauge value, allocation, eviction or scheduling decision is changed by any finding.

The six nits, each with a smaller version: two back-to-back nodes.get_mut/checkpoint(id)? per pin and release (cache.rs:529-532, 547-557); stats() still walks self.slots four times (scheduler.rs:1205-1209 vs 1213, 1216, 1222-1233); the moved retirement block re-reads prefix/error_code already in hand (scheduler.rs:3144-3148); pin_prefix/unpin_prefix re-dispatch a bool the cache already dispatches (scheduler.rs:2018-2033, −16 lines); the 13-line api.md gauge paragraph (docs/api.md:298-310, trim to ~7); and a redundant debug_assert!(node.request_pins > 0) (cache.rs:562).

Kept with reasons: transitive request_pins, the separate CacheStats::request_pinned_pages, the admission-time request/plain split, compaction's assert plus heir inheritance, the test-only drift assertion, the two Prometheus atomics reusing the existing table, and the CopyoutResources mask (noted as coupling, not a defect).

Full report · Notes

Conventions

Verdict: should-fix issues only Blocking:

At head bca7358 (unchanged since the previous round; the only new activity is the author's live-validation comment), all eight changed files were read in context and every line re-verified by search.

The one should-fix finding is a convention departure judged against docs/design-review.md:16 ("Keep Helios as simple as possible") and AGENTS.md:188-193 ("Reject unsupported abstractions and churn… Refactoring must directly support the requested behavior or remove a demonstrated source of defects or cost"). pin_checkpoint/unpin_checkpoint is the sole entry point for copy-out pins, with every runtime call going through it (runtime.rs:2360-2710); the new wrapper instead takes a bool and covers only admission (1638, 1649, 1671), where the kind actually comes from let request_pin = inbound.is_none(); at 1636, so the call site no longer says which counter moves. A swapped kind is silent in release: the only check is the #[cfg(test)] drift assertion in Cache::stats (cache.rs:826-846). Fix: one named entry point per kind — add pin_request/unpin_request and route the six direct sites through it, keeping the ticket-parent pin on plain cache.pin/unpin. The cache level is already right (pin_with/unpin_with, cache.rs:519-589, mirroring count/uncount).

Earlier findings are fixed at this head and not re-reported: the double chain walk (now one chain(id) per call), the three duplicated admission branches, and the two docs/api.md prose errors. Checked and dropped: the Metrics plumbing mirrors cached_pages exactly, the stats slot pass matches its neighbours and has no existing helper, the compaction debug_assert_eq! extends the existing block, the CopyoutResources zeroing reuses the dashboard.rs:993-997 fill style.

Open: whether the wrapper issue is more than readability — a targeted fault swapping one unpin kind and rerunning the scheduler suite would settle the adequacy of the drift assertion. Not verified: the live measurements, GPU workloads, the Windows build, the full suite. Review is static, on the code.

Full report · Notes

Architecture

Verdict: clean Blocking:

Scope and approach hold at head bca7358: the change is confined to shared runtime layers (cache accounting, scheduler stats and the request-pin API, Prometheus text, docs) with no per-model branch, flag, environment switch, or change to allocation, eviction or scheduling. Need rests on issue #537, which this implements as its option 1 verbatim (charter line 35; AGENTS.md:165-169). Cache::stats still never scans nodes: the count is maintained on the pin/unpin paths (helios/src/cache.rs:519-589), with a test-only drift assertion against a full scan (826-846). All four findings from earlier rounds are fixed: docs/api.md:298-310 now states one ratio, (request + reserved)/total, the non-disjointness with flare_cached_kv_pages, the exclusions, and a publish cadence matching runtime.rs:722, 743-746 and 1148-1149; the pin kind is chosen once (scheduler.rs:1636, 2019-2033); retire releases the request pin before the slot empties (3142-3149).

Report-only: the PR body's live inequality request + reserved < total − free − cached does not attest the gauge, since total − free − cached is dominated by snapshot-backing pages (metrics.rs:1294-1298); the in-repo drift assertion is the real evidence. Authorization rests on a user-filed issue rather than an explicit maintainer request, and the author's live figures, exported-core and Windows checks could not be reproduced here.

Full report · Notes

Correctness

Verdict: clean Blocking:

Reviewed PR #549 at head bca7358 (fourth pass; no new commits since the third, only the author's live-validation comment and a flare-autobot review whose two should-fix items coincide with nits 1 and 3 and are not demonstrable correctness defects).

Verified sound: the invariant LiveRequest::prefix == Some(id) iff one request pin is held holds on admission (scheduler.rs:1636-1638, releases 1649/1671), ticket waiters (1882), both boundary outcomes (2970-2972, 2990-2999), cancel, preemption, finish and shutdown; retirement releases at 3148 before request.take() at 3150. Host-ticket and copy-out/export pins correctly keep the plain API (2037-2043), so the new "no request pin to release" error (cache.rs:547-549) has no reachable caller. request_pinned_pages moves only at request_pins 0↔1 crossings (cache.rs:519-589), all guards precede mutation, and retire_leaf/compact_ancestor are gated on pins == 0 (659, 670), so no counted node can leave nodes; a test-only full-scan assertion checks the counter on every stats() (827-846). Gauges are summed in the existing slot loop (scheduler.rs:1200-1221), stored and rendered (metrics.rs:514-518, 1309-1318), absent from the JSON snapshot as documented (355-393). The one real hazard — SchedulerStats equality widening CopyoutResources so deferred copy-outs re-offer every decode step — is defused by zeroing both fields in the key (runtime.rs:2440-2455), and runtime.rs:1056 is the only other comparison. The bca7358 pin_with/unpin_with refactor and test merges are behaviour-preserving.

Nits: (1) "not written yet" is imprecise across the commit→completion window (docs/api.md:304-305, metrics.rs:1315-1317); (2) the docs/api.md field table (line 330) gained no rows for either gauge; (3) no stats assertion across the Existing { ready: true } re-pin (scheduler.rs:2987-2999); (4) pin_prefix's bare bool pin kind (scheduler.rs:2019-2033).

Not verifiable from the branch: the live-scrape numbers were built on a fork combination (commit 5ffe4d54 is not in this repository), and there are no CI checks on the head commit.

Full report · Notes

Prose

Verdict: nits only Blocking:

Prose review of PR #549 at head bca7358 (8 files, +202/−34; the only documentation change is one 14-line hunk at docs/api.md:298-310). Judged against AGENTS.md:43-65, :72-113, :114-140, :142-151, .agents/skills/repo-prose/SKILL.md:25-46 (not opened)/:56-59, docs/design-review.md (not opened) principle 16, and charter line 35.

The description now answers why / what changed / result / evidence in order, and the earlier defects are fixed: the helios/src/server/runtime.rs retry-key bullet is present (matches runtime.rs:2441-2450), shared ancestor pages are described as counted once in total (matches cache.rs:536-541 and the PR's own test), the false "leaves nodes only at zero pins" rule is gone, and api.md now says the worker publishes only when a scheduler pass makes progress rather than claiming a per-scrape read.

Four nits remain:

  1. docs/api.md:298-310 never says the two new gauges are absent from the ?format=json snapshot, although docs/api.md:292 routes other text-only families explicitly, the JSON table at :330-360 has no such row, Snapshot gains no field (metrics.rs:265-266, :517-518, :1310-1317 only), and docs/api.md:317-318 tells readers absent fields read as zero.
  2. docs/api.md:308-310 (and the matching description bullet) call the ratio "the share comparable to vLLM's kv_cache_usage_perc" with no qualification, while issue #537 — which this PR closes — reports a mismatch (~9% vLLM vs ~16% Flare upper bound). AGENTS.md:55-57 and :95-99 ask for present qualification.
  3. Description cache.rs bullet: "Compaction moves the count into the surviving checkpoint" — compact_ancestor (cache.rs:622-645) adjusts no count; it removes the node via uncount (:625), moves the pages into a heir already counted (:638-640), and the invariant rides on debug_assert_eq!(node.request_pins, child.request_pins) (:636).
  4. The two live-run evidence bullets do not say the image was built with #548 and #560 merged (the author's 2026-11-28 comment does), contrary to AGENTS.md:98-100 on combined-stack results.

Everything else — pin/unpin mechanics, the plain-pin exclusion, the scheduler bullet and retirement ordering (:3144-3150), publish conditions (metrics.rs:1148-1153, :722, :745), the drift assertion, the stated cost, and the trailing "Discord: oystersmiles" — matches the code. One non-defect observation: api.md:298 says "requests owning a model slot" while scheduler.rs:130 and metrics.rs:1311 say "active requests"; the docs wording is the precise one and the code could adopt it. Commit message bodies were not readable with these tools; only subjects were reviewed and they are accurate.

Full report · Notes

Subtractive

Verdict: make it smaller first The change: +202 / −34 lines across 8 files at head bca7358 Could remove: about 55 lines, in 4 places Biggest subtractions:

Full report · Notes

Pre Test Report

Pre-test report — PR #549 "Report KV pages held by active requests" (head bca7358c, +202/−34, 8 files)

Recommendation: DO NOT REFER to hardware testing. Return to the author for one short round; when it lands, validation is host-side (CI + two unit assertions) and any GPU contact is an optional 10–15 minute scrape piggybacked on an already-scheduled run, not a dedicated job.

This reverses my previous run's "refer, one bounded cn7 job". The reversal is driven by new information, not by the code: the author's own 2026-11-28 validation numbers now show the gauges moving 54–80 pages of a 20,480-page pool (~0.3 %) with ~50 % jitter between scrapes at fixed load — which destroys the one assertion my plan relied on hardware to make — and an active proposal in this review round is to delete half the new surface outright.


1. What the change is (re-verified in code, not from summaries)

Two Prometheus-text-only gauges, closing #537:

The cache half is maintained incrementally on pin/release (helios/src/cache.rs:519-570: pin_with/unpin_with, plus the one-line wrappers pin 572, unpin 576, pin_request 583, unpin_request 587), adding at the request_pins 0→1 crossing (539) and subtracting at 1→0 (565) — never by scanning nodes, which is the constraint the PR states and the reason Cache::stats stays scan-free in release. Rendered beside cached_kv_pages (helios/src/server/metrics.rs:1309-1318), stored from SchedulerStats (metrics.rs:517-518), deliberately absent from the JSON Snapshot (metrics.rs:68-129).

2. Why it is not ready to consume hardware

2.1 (Gating) The head has never been built or tested by anything

Head bca7358c has no CI checks (search_history confirms it is the newest commit; the PR is a draft with no human review). The repository's own CI runs exactly the suite a tester would run — .github/workflows/native-serving.yml:56-68 (not opened) executes cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) --features runtime-core,server on ubuntu-24.04 and windows-2022, with FLARE_TEST_TEMPLATE_DIR prepared at :28-31, and :69-77 adds the CLI and flare-app suites. Running the suite on a GPU host would be the first execution anywhere, and the definition of wasted hardware time on an observability-only change. The author's "809 passed" is a filtered local run (-- server:: scheduler:: cache::) on an unstated host; the Windows build is explicitly unrun.

2.2 (Gating) Half the changed surface is an active deletion candidate

The subtractive review — repeated across three review rounds, now with stronger arithmetic — asks to delete flare_reserved_kv_pages entirely (~20 lines across scheduler.rs:132-133, 1204, 1208, 1221, metrics.rs:266, 518, 1314-1318, 1791, 1836, runtime.rs:2448, docs/api.md:304-305, 308-309, scheduler/tests.rs:1019 (not opened), 1023, 1030) because #537 asks only for request-held pages. The author's own numbers now make that argument stronger, not weaker: reserved measured 16–22 pages of 20,480 (0.08–0.11 %) on Blackwell and 2–3 of 21,504 on DeepSeek. A test plan written today would spend assertions on a gauge that may not exist at merge.

2.3 (Gating) Two should-fix items named by the bot review on this same head

These are cheap fixes, not a redesign — but they mean assertions written now would test code that changes before merge, which priority 1 rules out.

2.4 The new live numbers invalidate the hardware plan's core assertion

Author's 2026-11-28 comment: 16 concurrent streams on one RTX PRO 6000 Blackwell serving the prepared Qwen3.8-Flash-Next-FLARE gb202 package (20,480 KV pages) → flare_request_kv_pages 54–80, flare_reserved_kv_pages 16–22. Two-GPU DeepSeek-V4.1-Flash, 2 concurrent chats → 399–402 request, 2–3 reserved, of 21,504.

2.5 There is no GPU-specific behaviour to validate

3. Verified sound — this is why the PR is worth landing

I re-derived these at bca7358 rather than trusting the summaries:

Remaining non-blocking items worth folding into the same round: docs/api.md:298-310 never says the two gauges are absent from ?format=json (a JSON consumer reads zeros per api.md:317-318, and the field table at api.md:330-360 gains no row) — test-plan consequence: assert only against /metrics text, never the JSON object; stats() still scans self.slots four times (scheduler.rs:1213, 1216, 1222-1233); retire re-reads prefix/error_code already bound at 3113/3110; CopyoutResources still embeds all of SchedulerStats, so each future field silently joins the copy-out key.

Two genuine test gaps a unit test should close (author-side, not hardware):

  1. publish_boundary's Existing { ready: true } branch (scheduler.rs:2987-2999) — the shared-checkpoint re-pin, exactly where a double count would hide — has no stats().request_pages assertion.
  2. The folded scheduler test cancels rather than completes (scheduler/tests.rs:1027-1030 (not opened)), so the Created-retire path is not directly asserted.

4. Test plan (for when the preconditions land — do not run today)

Stage 0 — free, and the actual validation (author + CI, no hardware)

  1. CI green on the head, Linux and Windows, via native-serving.yml (not opened) (full helios suite, not the filtered local run). This has never happened on bca7358.
  2. Restore the guard assertion (cache/tests.rs:336) or delete direct_request_pins plus the guard — not both. Confirm the drift assertion at cache.rs:825-846 stays silent across the cache, scheduler and lifecycle tests.
  3. Add the two missing unit assertions from §3 (the Existing{ready:true} re-pin, and one completed retirement beside the two cancels). Both are host-side and cost minutes.

Stage 1 — optional, ~10–15 min, cn7 only, and only piggybacked

Do not book a slot for this. If a dashboard or qualification run is already going out on cn7 (1× GB10, nvidia/Qwen3.8-27B-NVFP4 TP1 — the simplest single-GPU KV pool, least confounding arithmetic), add five scrapes of /metrics text. Do not also use cn5/TP4; that duplicates the same scrape at 4× the cost.

  1. Idle ledger. No request live: flare_request_kv_pages == 0, flare_reserved_kv_pages == 0, flare_cached_kv_pages > 0 after a warm request.
  2. Publish freshness. Scrape, idle 10 s, scrape again — unchanged; send one request, scrape after one further step — it moves. Validates the corrected api.md:305-307 and documents that a stalled worker legitimately holds a stale value.
  3. Ledger bound. request + reserved ≤ total − free. Do not subtract cached: the docs correctly state pinned checkpoints count in both gauges.
  4. Differential — record, do not assert. Two concurrent streams on one ~1–2k-token prompt; log R1, R2, cached, free, total. Given §2.4 the spread swamps the signal, so treat it as data for #537, not a pass/fail.
  5. Drain. Cancel one request mid-flight, scrape after the next step: both gauges fall to 0 while flare_cached_kv_pages stays > 0. (A stale nonzero at the instant of cancel is expected — retirement releases the pin before the slot empties.)
  6. Record (request + reserved) / total. The single most valuable output, and the only thing that helps a maintainer judge #537. Never a gate.

Excluded, with reasons: no throughput A/B against main (no perf path changed); no soak; no multi-model or multi-hardware matrix; no repeat of the author's two-GPU DeepSeek scrape (unreproducible fork base, answers a reporter question); no JSON-snapshot assertions (gauges deliberately absent); nothing at all on flare_reserved_kv_pages if §2.2 is accepted — a re-scope of that item drops checks 1's second gauge but leaves 2–6 intact.

5. Expected value

6. Recommendation and re-referral condition

Not referred to hardware testing. Return to the author for: CI green on the head; the unpin_request guard assertion restored (or field+guard deleted); pin_prefix/unpin_prefix collapsed or the six direct sites routed; the Prometheus-only/JSON sentence in docs/api.md; and a decision on whether flare_reserved_kv_pages stays. None of this is a redesign — the accounting has been independently traced as exact across admission, ticket resolution, both boundary outcomes, compaction, eviction, retirement, cancel, preemption and shutdown, and the copy-out retry key is correctly insulated.

Re-refer only if the maintainer wants a fleet-measured KV figure for #537 after the above lands — and then as the 10–15 minute piggyback scrape above, not a dedicated job.

7. Security / instruction-integrity note

The screening passes (all clear) agree with my own reading: no prompt injection or agent-directed instruction in the PR body, diff or discussion. Two benign items for completeness: the author's one-line "review the pushed changes" comment is an ordinary workflow request, and the #autobot:ignore opt-out token appears only in this repository's own automation boilerplate. The PR body's live-scrape figures carry an honest measurement caveat ("the instance also served this agent session's own requests"), not an instruction. Nothing in the review material attempts to direct this assessment.

Full report · Notes

code review summary

Recommendation: Changes Requested

No new commits: bca7358 still fixes every item from the previous round, and the description has since been corrected. What remains is deleting a redundant pin-dispatch layer, restoring one test assertion, and cutting about 50 of the +202 added lines. Nothing here asks for new code, flags, or docs.

Full report · Notes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

Apply Labels

Applied: +triage:review, +enhancement, +area:api, +area:caching, +area:memory

Classification Confidence

Threshold: 65%

Triage

Priority

Type

Area

Model