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:
flare_request_kv_pages= live slots' private pages +CacheStats::request_pinned_pages(helios/src/scheduler.rs:1216-1222; the cache count is maintained incrementally on pin/unpin athelios/src/cache.rs:551-580, never by scanningnodes, which is the PR's stated constraint).flare_reserved_kv_pages= live slots'reserved_pages(scheduler.rs:1223-1228).
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
docs/api.md:307-310contradicts itself. It first saysrequest + reservedis the figure comparable to another runtime's used KV cache, then says "Dividing either gauge byflare_total_kv_pagesexcludes idle cached prefixes and snapshot backing pages." Both cannot be the intended ratio:reservedis 2-3 pages of 21,504 under load, soreserved/totalcarries 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 ofcachedis excluded — whichapi.md:303-306correctly denies.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".docs/api.md:311-312documents 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
- Three ways to take a request pin:
pin_prefix(.., true)plus directcache.pin_request/unpin_requestatscheduler.rs:1889,2977,2979,2997,2998,3155, beside the namedpin_checkpoint/unpin_checkpointconvention (:2042-2050). - Three passes over
self.slotsinSchedulerStats::stats(:1216-1228) where one fold yields both totals. retirere-readsself.request(handle)?twice (:3151-3152) for values already local at:3117/:3120.cache/tests.rs:335re-tests the generic unpin guard already at:358.direct_request_pinsexists only for its own guard (cache.rs:83, 461, 553, 566, 570) — defensible, keep.- PR body still carries two false sentences: "counts once for every request that references it" (the code and
cache/tests.rs:331-332assert once in total, 3 not 4) and "a checkpoint leavesnodesonly at zero pins" (untrue for compaction,cache.rs:613-631).
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
- Counter cannot drift on any path I traced. Adjustments occur only at the 0↔1 transitions of
request_pins(cache.rs:551-580); everynodesremoval is gated onpins == 0(cache.rs:594,:613, eviction:658-663);request_pins <= pins;chainincludes the target node, so a publication promoting an already-pinned ancestor torequest.prefix(scheduler.rs:2977-2985,:2997-3006) does not double count. - Compaction preserves the count:
compact_ancestor(cache.rs:613-631) restorestail_pagesinto the heir; the addeddebug_assert_eq!(node.request_pins, child.request_pins)at:627sits beside the existing pin asserts. - The drift assertion is the real evidence and is host-independent:
cache.rs:818-837comparesrequest_pinned_pageswith a full scan on everystats()read in the test build, so the whole suite checks it. Stronger than the description's live inequality, which is dominated by snapshot-backing pages. - Pin/release symmetry holds on admission without inbound (
:1643-1645), ticket waiters (:1889), bothpublish_boundaryoutcomes (:2977-2979,:2997-2998), cancellation and retirement (:3155). Ticket-parent pins correctly keep the plain API (:1871,:1907). - Gauges are additive, absent from the JSON
Snapshot, and merge cleanly with #548 (disjoint regions ofmetrics.rs).
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.
- No GPU code is touched: no kernel, numerics, attention/MoE, allocation or eviction change. Blackwell/GB10-specific validation buys nothing.
- No throughput risk exists to A/B. The only conceivable perf effect is the duplicate
Vecper pin (§2.2) — a host micro-benchmark, not a GPU slot. - The quantity is host-computable arithmetic: a sum over slot state plus a cache-maintained counter. Nothing is booleanized, offset or rounded at an RPC boundary. A host test exercises exactly what the worker executes.
- The one GPU-coupled unknown is small and nameable: the
Inbound/restore window, where ticket pages appear in no gauge and the window's size depends on real restore timing. That is one scrape, not a suite. - Process state: draft, no CI checks on the head; the author's live scrape was taken on third-party fork base
5ffe4d54, absent from this repository, so it is not reproducible from this branch.
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)
- Full suite, release profile, no path filter:
cargo test --release --lib(not the reportedcache:: scheduler:: server::metricsfilter) soserver::runtime::phase_testsruns. The copy-out deferral tests atphase_tests.rs:6357-6431and re-offer counters at:6176are the only coverage of theruntime.rschange. - Drift assertion across the suite: confirm
cache.rs:818-837coversrequest_pinned_pagesand stays silent through cache, scheduler and lifecycle tests. - Add the
Existing-publication case. A grep forExistinginhelios/src/scheduler/tests.rsreturns nothing, so nothing drivespin_requestthroughpublish_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 theCreatedretire path is also unexercised. Cheapest form: the §2.7 merge plus one completed retirement beside the two cancels. - Write the regression test the fix deserves: leave a copy-out deferred for headroom, advance one decode step across a page boundary (moving
reserved→privatewhilefree_pages/cached_pageshold), assert theFakeStoresaw no secondstore. This makes "no scheduling decision changes" checkable in CI rather than by inspection. - 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:
- Idle:
request_kv_pages == 0,reserved_kv_pages == 0. - Publish freshness: scrape idle, then immediately after activity; confirm the value reflects the last progressing pass, validating the corrected
api.md:302. - Two concurrent streams on a shared prefix: record
request,reserved,cached,free,total; assertrequest_pinned_pages <= cached_pages(the invariant that attests the gauge) andrequest + reserved < total - free - cached. - Record
(request + reserved)/total. Do not gate on matching vLLM. - 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.