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:
- The gauges do narrow #537's bounds, so the change has real value. But
request/totalis not the vLLM metric the docs promise, and the advertised ratio is off by roughly 5× against the reporter's reference. - The "each page counted once" semantic is the right call for a distinct-pages gauge, but it is a different quantity from vLLM's.
- #537 offered a cheaper alternative using counts the cache already had. The PR takes neither alternative and does not explain why. That is an unresolved design question to settle with the maintainer/reporter, not something a test engineer can resolve on hardware.
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:
docs/api.md:302— "Both are gauges read from scheduler state on each scrape." False, verified.Metrics::renderonly loads atomics; the worker stores them exclusively on iterations where it made progress (runtime.rs:1148-1149), plus once at start (:722) and once at drain (:745). With an idle or blocked worker the gauge is arbitrarily stale — which is precisely the state an operator watches forrequest_kv_pagesto fall back to zero.docs/api.md:300vs the PR body — the doc's "each page counted once even when several requests reference it" is correct; the PR body's "a page shared through a pinned ancestor therefore counts once for every request that references it" is its exact opposite, and contradicts the PR's own test (cache/tests.rs:331-332asserts 3, not 4). The prose reviewer caught this; the description must be fixed so reviewers and testers are reasoning about the same quantity.- Also stated by the prose reviewer and worth folding into the same edit: the ratio paragraph omits the reserved set, and pages held by an
Inboundrestore ticket are in neither gauge (scheduler.rs:1704-1706pops them fromfree_pages;scheduler.rs:1803starts the live request withprivate_pages: Vec::new()). Both are real gaps between the prose and the code.
2.4 SHOULD FIX before merge (not blocking a later test run)
- Double ancestor-chain walk.
pin_request(cache.rs:551-563) callsself.pin(id)?(which already computesself.chain(id)?at:523) and then callsself.chain(id)?again at:554;unpin_requestmirrors it at:569/:571. Two walks and twoVec<CheckpointId>allocations on every admission, ticket waiter, boundary publication and retirement. All four lens reviews independently flagged this; folding into one privatepin_with(id, request)worker is the house-style fix and also puts therequest_pins0↔1 transitions in a single site. Structural, so do it before testing — it is the code the tests would otherwise be written against. - Unchecked
usizesubtraction.cache.rs:576(self.request_pinned_pages -= node.tail_pages.len()) is guarded only by thedirect_request_pins == 0early-out at:566plus the subset invariant. In a release build a violated invariant wraps silently instead of erroring. I agree with the conventions reviewer that no path reaches it today with the invariant intact, but for a counter whose entire job is trustworthiness,saturating_subor a debug assert is cheap. Fold into the same edit. retireerror ordering.request.take()atscheduler.rs:3143precedesunpin_request(prefix)?at:3159, so anErrthere leaks the prefix pin permanently after the slot is already emptied. Latent (I found no path that fires it), but the new error path makes a future unpair bug worse than before. Cheap to reorder.- Silent prompt-path failure.
pin_requestruns on the prompt path atscheduler.rs:1900and2971/2991, and its error propagates with?. The only drift detector is#[cfg(test)](cache.rs:817-837) and the invariant is a comment plus one unit test. Cheapest hardening matching house style: a debug-gated cross-check instats(). This is a judgment call, not a blocker.
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:
- The maintained counter cannot drift on any path I could find. I checked every
tail_pagesmutation (cache.rs:264, 274, 617, 629-631) and everyprefix = Some(...)(scheduler.rs:1902, 2979, 2996) againstpin_request/unpin_request. The key detail the reviews under-sold:pin_request's chain walk includes the target node itself, so an ancestor'srequest_pinsis already >0 before a publication promotes it torequest.prefix— that is why the publication transitions don't double count. Correct. - Compaction preserves the count:
compact_ancestor(cache.rs:613-646)uncounts the ancestor (:616) then restorestail_pages(:617), carries pages into the heir (:629-631), and asserts agreement (:627). Sound. - A request-pinned node can never leave
nodesas a leaf:eviction_candidates(cache.rs:658-664) requirespins == 0for thechild_count == 0case, andrequest_pins <= pins. Sound. - The
#[cfg(test)]full-scan drift assertion (cache.rs:817-837) now covers the new counter on everystats()read in the whole suite. This is the single highest-value piece of test evidence in the PR, and it is host-independent — which is central to my recommendation below. - Gauges are additive, in the existing gauge block, and merge cleanly with #548 (disjoint regions of
metrics.rs).
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).
- No GPU code is touched. No kernel, no numerics, no attention/MoE change. Blackwell-specific validation buys nothing.
- No throughput risk exists to A/B. The only conceivable perf effect is the extra
Vecallocation per pin (§2.4) and the extra copy-out re-offers (§2.1) — both measurable on a host withcargo test/a micro-benchmark, neither worth a GPU slot. - The metric is host-computable.
request_pagesis derived from cache + slot bookkeeping plus one global "free pages" counter; nothing is booleanized, offset or rounded at RPC boundaries the way logprobs/vocab handling can be. A test running on any host exercises the identical arithmetic the GPU worker executes. - The advertised live evidence is already a GPU run — on an unreproducible third-party base. Re-running it on our hardware would confirm self-consistency on a different checkpoint, which is marginal; it cannot resolve §2.2, which is a design question.
- Residual GPU-only risk is genuinely low, and I can name it precisely: the existing gauges
flare_free_kv_pages/flare_cached_kv_pagesare trusted, so the free-list/checkpoint accounting they rest on is trusted; the new gauges reuse it. The one genuinely GPU-coupled unknown is theInbound/restore window (§2.3) — those ticket pages appear in no gauge, and the size of that window depends on real restore timing. That is one focused check, not a suite.
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)
- Full suite, release profile.
cargo test --release --lib -- cache:: scheduler:: server::metricsplus the full--librun. 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. - Drift assertion across the whole suite. Confirm the extended
#[cfg(test)]assertion (cache.rs:817-837) now coversrequest_pinned_pagesand that it stays silent across the cache, scheduler and lifecycle tests. This is the real correctness evidence. - The
Existing-publication path — currently untested. Both the correctness and conventions reviewers note no test drivespin_requestthroughpublish_boundary's shared-checkpointExistingbranch (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 thePublishResult::Createdretire path (scheduler.rs:3146-3153) is also unexercised. Add these two cases before hardware. Cheapest form: the four assertions the subtractive reviewer suggests appended tobranching_requests_own_distinct_tail_pages_and_terminal_snapshots(tests.rs:1036-1081), extended with one completed (not cancelled) retirement. - 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→privatewhilefree_pages/cached_pageshold), and assertFakeStoresaw no secondstorecall. This test is what makes the "no scheduling decision changes" claim true and checkable — it should exist either way. - A test pinning the
Inboundsemantics (§2.3): assert both gauges while a request is inRequestPhase::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:
- Idle ledger. With no request live:
request_kv_pages == 0,reserved_kv_pages == 0. (The author observed 0/0 with cached 2019.) - 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.
- 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).
- 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. - 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.