Simplicity scratchpad · NVIDIA/hyperflare-inference #549

Raw Markdown for agents: https://autobot.eidonix.com/p/13fd9bcb-d889-407f-b99f-ed11273b981e.md

#1 [high] should fix: cache pin_request/unpin_request walk the chain twice

helios/src/cache.rs:519-580. pin_request calls self.pin(id)? (which itself computes self.chain(id)? at line 523) and then computes self.chain(id)? again at line 554 to bump request_pins. unpin_request does the same at 569/571. So every request pin and unpin walks the ancestor chain twice and allocates two Vec. Call sites on the hot path: scheduler.rs:1645 (every admission), 1900 (every ticket waiter), 2971/2991 (every boundary publication), 3159 (every retirement), plus the two error-path unpins at 1660/1686.

Smaller version (one traversal, one code path, no new public API):

fn pin_kind(&mut self, id: CheckpointId, request: bool) -> Result<()> {
    if !self.checkpoint(id)?.ready { return Err("cannot pin a checkpoint before GPU readiness".into()); }
    let chain = self.chain(id)?;
    if self.nodes[&id].direct_pins == u64::MAX || chain.iter().any(|id| self.nodes[id].pins == u64::MAX) {
        return Err("checkpoint reference count exhausted".into());
    }
    self.nodes.get_mut(&id).unwrap().direct_pins += 1;
    for ancestor in chain {
        let node = self.nodes.get_mut(&ancestor).unwrap();
        node.pins += 1;
        if request {
            node.request_pins += 1;
            if node.request_pins == 1 { self.request_pinned_pages += node.tail_pages.len(); }
        }
    }
    if request { self.nodes.get_mut(&id).unwrap().direct_request_pins += 1; }
    Ok(())
}
pub fn pin(&mut self, id: CheckpointId) -> Result<()> { self.pin_kind(id, false) }
pub fn pin_request(&mut self, id: CheckpointId) -> Result<()> { self.pin_kind(id, true) }

and the same for unpin. This deletes ~30 lines and one whole traversal per call.

#2 [high] should fix: pin_request doc comment claims it counts private pages

helios/src/cache.rs:548-550:

"/// Pins a checkpoint on behalf of an active request. Request pins also track the /// pages the request keeps referenced: its private pages plus the pinned /// ancestors' pages, each page counted once."

The cache has no knowledge of a request's private pages; request_pinned_pages only counts node.tail_pages of nodes with request_pins > 0 (cache.rs:558-560, verified against the full scan at 830-834). Private pages are added by the scheduler at helios/src/scheduler.rs:1216-1222 (request.private_pages.len() summed over slots). A reader of pin_request cannot tell whether double counting is possible.

Fix: state only what the cache does, e.g. "Pins a checkpoint on behalf of an active request and adds the tail pages of every checkpoint on its chain to request_pinned_pages while at least one request pin remains. A request's private pages are not cache pages; the scheduler adds them (see RequestScheduler::stats)."

#8 [high] Research summary

Reviewed PR #549 through the simplicity lens (what can be deleted), against the charter, AGENTS.md's rejection criteria ("Reject unsupported abstractions and churn", "Require focused, meaningful validation") and the repo-prose skill.

Three findings worth fixing, none blocking:

  1. should fix — helios/src/cache.rs:551-580. pin_request calls self.pin(id)? (which already walks the chain at line 523) and then walks chain(id) a second time; unpin_request does the same. Two chain allocations per request pin, on every admission, ticket waiter, boundary publication and retirement. Smaller version: one private pin_kind(id, request: bool) that walks the chain once and bumps pins and, when request-pinned, request_pins/request_pinned_pages, with pin/pin_request as one-line wrappers — deletes ~30 lines and a whole traversal.

  2. should fix — helios/src/cache.rs:548-550. The doc comment says request pins track "its private pages plus the pinned ancestors' pages", but the cache never sees private pages; request_pinned_pages counts only tail_pages of nodes with request_pins > 0 (verified against the full scan at 830-834), and the scheduler adds private pages at scheduler.rs:1216-1222. The comment should state only the cache's part and point at RequestScheduler::stats.

  3. nit — helios/src/scheduler.rs:1216-1228. stats() now scans the slot array three times (active count, private pages, reserved pages); one fold yields both new totals. Also nipped: two of the new test assertions do not prove what their comments imply (cache/tests.rs:335 rejects a plain guard case already covered at tests.rs:358; the private-page half of scheduler/tests.rs:1024 is tautological, though the shared-page half is real evidence), and the docs/api.md:298-305 paragraph duplicates the metric table at api.md:325-346 and narrates implementation ("read from scheduler state on each scrape", "Both are gauges") where one home for the content would do.

Examined and deliberately kept: direct_request_pins (its only consumer is the unpin_request guard, but without it a duplicate request unpin would silently corrupt the count when the same node is also pinned for host-store copy-out), the separate request_pinned_pages field, the two Prometheus-only metrics atomics, and the plain-pin path for inbound admissions (those requests are not live yet; they are re-pinned at finish_inbound). The compaction and eviction invariants for the new counters check out.

#9 [high] report outline: verdict, ordering, rule citations

Report structure and verdict for the simplicity lens (PR #549, head 5ed7af8):

Verdict: three findings, none blocking; the change reuses existing mechanisms rather than adding parallel paths, so nothing needs to be deleted outright. Ordered by importance:

  1. should fix — helios/src/cache.rs:551-580 — pin_request/unpin_request walk the ancestor chain twice; collapse into one pin_kind(id, request) helper (see scratchpad entry 1 for the code).
  2. should fix — helios/src/cache.rs:548-550 — doc comment claims the cache tracks a request's private pages; it does not (see entry 2).
  3. nit — helios/src/scheduler.rs:1216-1228 — three scans of self.slots where one fold suffices (entry 3). Supporting nits in the same report: two test assertions that do not prove the named behaviour (cache/tests.rs:335; scheduler/tests.rs:1024 private half) and the docs/api.md:298-305 paragraph duplicating the metric table (entries 5 and 6 respectively). "Examined and kept" paragraph from entry 7, including why direct_request_pins is not dead weight.

Rules cited when judging: charter line 12 (keep the runtime small), line 35 (what gets merged), line 44 (GPU kernel defects only — not applicable, this PR has no kernel code); AGENTS.md lines 188-199 "Reject unsupported abstractions and churn" and "Require focused, meaningful validation"; docs/design-review.md principle 1 (keep Helios as simple as possible) and principle 16 (write without hidden context, via the repo-prose skill); .agents/skills/repo-prose/SKILL.md lines 38-39 (comments explain invariants, never history) and 44-46 (state the fact, not commentary about it).

Struct-field plumbing forced by the new fields, not findings: helios/src/cache/lifecycle_tests.rs:77-78 and :95 copy the two new counts in the lifecycle fixture's fork(); without them the fixture's projection would silently drop the request-pin state.

#11 [high] should fix: new scheduler test duplicates an existing test's setup line for line

helios/src/scheduler/tests.rs:970-1034 request_kv_pages_count_shared_prefix_pages_once duplicates branching_requests_own_distinct_tail_pages_and_terminal_snapshots (1036-1081) step for step: identical scheduler(2, 8, 5), seed admit spec(64,1), init(1), plan/commit(Fence(2)), complete(records(seed,2,64,1,77,2)), freeze(seed,3), finish(seed), two admits of spec(65,4), init(4), commit(5), complete(records(first,5,65,1,88,1)), retain_prompt(6), prefill of second, commit(7), complete(records(second,7,65,1,90,1)). Lines 972-1009 == 1038-1075.

Only 1010-1033 is new: the five lengths read off the two LiveRequests, the two stats assertions (request_pages == shared + first_private + second_private, reserved_pages == first_reserved + second_reserved), the two cancels, and the zero/cached_pages > 0 checks after retirement.

Smaller version: append 1010-1033 to the branching test (it ends at 1076-1080 by borrowing first/second; the stats assertions can precede those borrows and the cancels follow them), or extract fn shared_prefix_pair(&mut RequestScheduler) -> (RequestHandle, RequestHandle) used by both. Deletes ~38 lines of setup, or the whole 66-line test if merged.

Rule: AGENTS.md:188-199 "Reject unsupported abstractions and churn"/"Require focused, meaningful validation"; charter "smallest footprint".

Verified the two blocks are character-identical in steps (read 960-1140).

#12 [high] should fix (unchanged): cache pin_request/unpin_request walk the chain twice

Re-checked at head 9cca87a: unchanged from the previous report. helios/src/cache.rs:551-563 pin_request calls self.pin(id)? (which computes self.chain(id)? at 523 and walks it at 530-532) and then computes self.chain(id)? again at 554; unpin_request (565-580) does the same at 569 (unpin chains at 540) and 571. Two chain walks and two Vec<CheckpointId> allocations per request pin/unpin, and the ready/u64::MAX guard suite duplicated.

Call sites: scheduler.rs:1889 (ticket waiters), 2977/2979 and 2997/2998 (boundary publications), 3155 (retirement), plus the admission paths through pin_prefix/unpin_prefix (scheduler.rs:2025-2040, used at 1645/1656/1678).

Fix: one private fn pin_kind(&mut self, id, request: bool) that walks the chain once and bumps pins always plus request_pins/request_pinned_pages when request; pin/pin_request become one-line wrappers (unpin/unpin_request the mirror). Deletes ~30 lines and one traversal per call; the request_pins ⊆ pins invariant and the stats drift assertion (cache.rs:817-837) stay intact.

#17 [high] Report of 2026-11-27, run 2 (head 9cca87a)

Head 9cca87a (new commit "Keep page gauges out of the copy-out retry key"). Verdict: should-fix only, nothing blocking.

Fixed by 9cca87a, drop from the previous report: the copy-out key leak (blocker) — runtime.rs:2446-2450 now zeroes request_pages/reserved_pages; cache.rs:548-550 doc comment now says the cache counts only tail pages and the scheduler counts private pages; the retirement-block ordering (previous should-fix about request.take() before a fallible unpin) — scheduler.rs:3149-3156 now releases the pin before take().

Still open:

Nits (all present at 9cca87a): scheduler.rs:1216-1228 three scans (entry 3); scheduler.rs:3149-3156 re-derives locals already at 3116-3120 (entry 13); cache/tests.rs:335 redundant guard, already at 358 (entry 5); docs/api.md:309-312 test scaffolding in the API reference (entry 14); scheduler.rs:2025-2040 pass-through pin_prefix/unpin_prefix (entry 15); runtime.rs:2441-2450 field-masking literal because CopyoutResources embeds all of SchedulerStats (entry 16).

Withdrawn from the previous report: the "api.md prose duplicates the metric table" nit — api.md:332-355 is the JSON-snapshot-to-Prometheus-name table, and these two gauges have no JSON field, so the prose is their only home.

Increased: scheduler/tests.rs:970-1034 is now the single largest deletable block (~38 lines if merged into 1036-1081), bigger than the pin helper.

Evidence still unverifiable here: the live two-GPU scrape numbers. Rules cited: charter "smallest footprint in shared code"; AGENTS.md:188-193 (churn) and 194-199 (meaningful validation); docs/design-review.md principle 1 and 16; repo-prose SKILL.md 13-14, 26-29, 44-46.

#18 [high] Research summary

Verdict: should-fix issues only, nothing blocking.

Head 9cca87a ("Keep page gauges out of the copy-out retry key") fixed the previous round's blocker and two of its should-fix items: the copy-out retry key now masks the two new gauges (runtime.rs:2446-2450), the pin_request doc comment no longer claims the cache counts private pages (cache.rs:548-550), and retire releases the request pin before request.take() (scheduler.rs:3149-3156).

Should fix (2):

Nits (6): three passes over self.slots in SchedulerStats::stats (scheduler.rs:1216-1228) where one fold serves; the retirement block re-reads prefix/error_code that already exist as locals at 3116-3120 (scheduler.rs:3149-3156); cache/tests.rs:335 re-tests the generic unpin guard already at tests.rs:358; docs/api.md:309-312 ends the gauge paragraph with test scaffolding that belongs in the PR description; pin_prefix/unpin_prefix (scheduler.rs:2025-2040) are pass-throughs that cost more lines than the conditionals they replaced; runtime.rs:2441-2450 now carries a masking literal because CopyoutResources embeds all of SchedulerStats.

Withdrawn: the earlier "api.md prose duplicates the metric table" nit — the table is JSON-snapshot fields, and these gauges have no JSON field, so the prose is their only home. The live two-GPU scrape numbers remain unverifiable from here. Full detail is in scratchpad entries 11-17.

#19 [high] Final report inputs at head 9cca87a: all findings with citations

Final report inputs for head 9cca87a ("Keep page gauges out of the copy-out retry key"). Everything below was re-read in the code at that commit.

RULES CITED

SHOULD FIX 1 — helios/src/scheduler/tests.rs:970-1034 request_kv_pages_count_shared_prefix_pages_once reproduces branching_requests_own_distinct_tail_pages_and_terminal_snapshots (1036-1081) instruction for instruction: scheduler(2,8,5); admit spec(64,1); init(1); plan/commit(Fence(2)); complete(records(seed,2,64,1,77,2)); freeze(seed,3); finish(seed); admit spec(65,4) twice; init(4); commit(5); complete(records(first,5,65,1,88,1)); retain_prompt(6); assert prefill lane is second; commit(7); complete(records(second,7,65,1,90,1)). Lines 972-1009 == 1038-1075 verbatim. Only 1010-1033 is new: the five lengths read from the two LiveRequests, the two stats assertions, the two cancels, and the (0,0)/cached_pages>0 checks. Fix: append 1010-1033 to the branching test (its trailing borrows at 1076-1080 can follow the stats assertions), or extract fn shared_prefix_pair(&mut RequestScheduler) -> (RequestHandle, RequestHandle) from 972-1009 and call it from both. Either removes ~38 lines of duplicated setup; merging removes the whole 66-line test. The stats assertions are the only new evidence and they survive unchanged.

SHOULD FIX 2 — helios/src/cache.rs:551-563 and 565-580 pin_request calls self.pin(id)?, which computes self.chain(id)? at 523 and walks it at 530-532, then computes self.chain(id)? again at 554 and walks it again. unpin_request repeats the shape: self.unpin(id)? (chains at 540) then self.chain(id)? at 571. Two chain walks and two Vec<CheckpointId> allocations per request pin and per release, plus a second copy of the ready/u64::MAX guard suite. Call sites: scheduler.rs:1889 (ticket waiters), 2977/2979 and 2997/2998 (boundary publications), 3155 (retirement), and the admission paths via pin_prefix/unpin_prefix at 1645/1656/1678. Fix (code in entry 1): one private fn pin_kind(&mut self, id: CheckpointId, request: bool) -> Result<()> that validates once, walks the chain once, bumps pins always and, when request, also request_pins and request_pinned_pages; pin/pin_request become one-line wrappers, unpin/unpin_request the mirror. Deletes ~30 lines, one traversal per call. request_pins ⊆ pins and the drift assertion at cache.rs:817-837 are preserved, so request_pins_count_each_shared_page_once and every scheduler test keep passing unchanged.

NITS (all still present at 9cca87a)

  1. helios/src/scheduler.rs:1216-1228 — stats() walks self.slots three times for the new pair (active count at 1203, private at 1216-1222, reserved at 1223-1228); one fold seeded with cache.request_pinned_pages yields both. Code in entry 3.
  2. helios/src/scheduler.rs:3149-3156 — the moved retirement block re-reads self.request(handle)?.prefix and error_code although let prefix = request.prefix; already exists at 3120 and error_code is read at 3117; nothing mutates either between. Add let failed = request.error_code.is_some(); at 3120 and use both locals; two fewer slot lookups and no shadowed binding. Code in entry 13.
  3. helios/src/cache/tests.rs:335 — assert!(cache.unpin_request(parent).is_err()) exercises the direct_request_pins == 0 guard, the same shape already covered for the plain API at tests.rs:358, and it uses parent only because that node has no direct request pin. Drop it or move it to a guard test. The real evidence in the test is 331-334 and 336-341. Detail in entry 5.
  4. docs/api.md:309-312 — the gauge paragraph ends "...and the test-only assertion in Cache::stats compares the maintained request-pinned count with a full scan of every checkpoint on each read", documenting #[cfg(test)] scaffolding in the API reference; the PR description already carries that evidence. End the paragraph at "...excludes idle cached prefixes and snapshot backing pages." Entry 14.
  5. helios/src/scheduler.rs:2025-2040 — pin_prefix/unpin_prefix have three call sites, all in admit_planned, and both are if request { .. } else { .. } pass-throughs; they replaced 12 inline lines with 16. Once the cache has one entry point per direction (should-fix 2) they disappear and the three sites call the cache with the existing request_pin local (1643), or the cache takes a PinHolder::{Request, Ticket}. Not a blocker: they do encode the choice once, which the earlier review asked for. Entry 15.
  6. helios/src/server/runtime.rs:2441-2450 — the fix masks request_pages/reserved_pages in a struct literal because CopyoutResources (1053-1059) embeds all 34 fields of SchedulerStats, so every future gauge joins the comparison key by default and needs a second edit here. Correct as written; the smaller long-term version is for CopyoutResources to hold the cache-side values copy-out actually keys on. That changes which movements re-offer deferred copy-outs and needs its own justification — note it, do not demand it. Entry 16.

FIXED BY 9cca87a (do not re-report): copy-out retry-key leak (runtime.rs:2446-2450); pin_request doc comment (cache.rs:548-550 now correct — "the tail pages of the pinned checkpoints … private pages are counted by the scheduler"); retire ordering (pin released at 3151-3156 before request.take() at 3157).

WITHDRAWN: the previous "docs/api.md:298-305 duplicates the metric table" nit. The table at api.md:332-355 maps JSON Snapshot fields to Prometheus names; request_pages/reserved_pages have no JSON field (metrics.rs:1309-1318 only), so the prose paragraph is their only home.

VERIFIED AND KEPT (from entry 7, still true at 9cca87a): direct_request_pins (guard at 566); separate CacheStats::request_pinned_pages field (needed by both the drift assert at 824 and scheduler.rs:1222); the two Prometheus-only atomics reusing the existing gauge array, update table (metrics.rs:517-518) and test tuple array (1835-1836); the plain-pin path for inbound admissions (not live yet, re-pinned through pin_request at 1889); lifecycle_tests.rs:77-78/95 plumbing forced by the new fields. Invariants clean: compaction carries request pins (cache.rs:627 assert plus heir inherits tail pages), eviction still gates on pins/child_count.

UNVERIFIABLE HERE: the live two-GPU DeepSeek-V4.1-Flash scrape numbers (399/402, 3/2, ratios 0.0186/0.0187) — author's measurement of their own instance; settling it needs a scrape with a request held mid-prefill, not a unit test. No GPU kernel code in this PR, so the charter's defects-only kernel rule does not apply.

#3 [medium] nit: SchedulerStats::stats scans slots three times

helios/src/scheduler.rs:1216-1228. stats() is called from the runtime loop whenever anything progressed (server/runtime.rs:1148-1149) and now iterates self.slots twice more (once for private_pages, once for reserved_pages) after the existing active_requests scan.

Smaller version: one pass.

let (private, reserved) = self
    .slots
    .iter()
    .filter_map(|slot| slot.request.as_ref())
    .fold((0, 0), |(private, reserved), request| {
        (private + request.private_pages.len(), reserved + request.reserved_pages.len())
    });

then request_pages: private + cache.request_pinned_pages, reserved_pages: reserved. Three scans of the slot array become one, and the two new fields read as the pair that docs/api.md describes.

Also: LiveRequest::pages() (scheduler.rs:385-387) already exists as the per-request iterator for shared_pages.chain(&private_pages); it is unused by metrics, so no change needed there, but the new code should not invent a second notion of "the pages a request holds".

#5 [medium] nit: two assertions do not prove the behaviour they are named for

Two tests in the diff that do not prove what their names claim:

  1. helios/src/cache/tests.rs:317-341, request_pins_count_each_shared_page_once. After cache.pin(right_id) (line 333) the comment on the next line says the plain pin must leave the count alone (334), which is the one behaviour the extra plain pin exists to show — fine. But line 335 assert!(cache.unpin_request(parent).is_err()) checks only that a checkpoint with direct_request_pins == 0 is rejected; that behaviour is already covered generically by unpin_request's guard and by the pre-existing assert!(cache.unpin(parent).is_err()) pattern at tests.rs:358. It is not evidence about request pins, and it uses parent only because it happens to have no direct request pin. Keep it or drop it, but it is not one of the "3 rather than 4"/"plain pins leave it unchanged" claims and the comment should not present it as such.

  2. helios/src/scheduler/tests.rs:1024-1025. assert_eq!(stats.request_pages, shared + first_private + second_private) recomputes the expectation with shared_pages.len() taken from the same LiveRequest the implementation sums. It does show the shared pages are added once (both requests carry the same shared_pages vector of length shared, and the sum is shared, not 2 * shared), which is the point; that part is real evidence. But first_private/second_private are read from the requests and added directly, so that half of the assertion can only fail if stats() misreads private_pages. Acceptable, worth one sentence in the comment saying which half is the real claim.

The stronger check that the diff does add is the #[cfg(test)] drift assertion at cache.rs:817-837, which recomputes request_pinned_pages from a full scan on every stats() call; it covers every cache and scheduler test. Keep it. Note it is #[cfg(test)] only, so a debug build without cfg(test) does not check the maintained count; that is the same treatment the pre-existing counts get, so no change requested.

#6 [medium] nit: docs/api.md gauge paragraph duplicates the metric table and narrates implementation

docs/api.md:298-305 adds a paragraph defining the two gauges. Two things a simplicity reviewer can trim:

Also note the page keeps a metric table (api.md:325-346) with cached_pages/free_pages rows; the two new gauges are documented in prose but not added to that table, so a reader who scans the table cannot find them. Same content, one home: either add request_pages/reserved_pages rows with Prometheus names flare_request_kv_pages/flare_reserved_kv_pages, or keep the prose. Both is duplication.

#7 [medium] checked and kept: direct_request_pins, separate CacheStats field, metrics atomics

Considered and kept (no finding):

Verified defect-free in this lens: pin_request/unpin_request keep request_pins a subset of pins and restore request_pinned_pages to zero; compaction moves the count through debug_assert_eq!(node.request_pins, child.request_pins) (cache.rs:627) combined with the heir inheriting node.tail_pages at 629-631, so the request_pinned_pages total is unchanged across compaction; retire_leaf/uncount cannot remove a node with request pins because eviction_candidates still gates on pins/child_count (cache.rs:658-663).

#13 [medium] nit: retirement block re-derives values it already holds

Head 9cca87a. helios/src/scheduler.rs:3120 already has let prefix = request.prefix; and 3116-3119 already read request.error_code.is_none() while request is borrowed. The moved retirement block (3149-3156) re-reads both through two extra self.request(handle)? calls and shadows the outer prefix:

if let Some(prefix) = self.request(handle)?.prefix {
    if !publish || self.request(handle)?.error_code.is_some() { self.record_publication(prefix); }
    self.cache.unpin_request(prefix)?;
}

Same values (nothing between 3120 and 3149 mutates request.prefix or error_code; 2716/2779 are the only writers and they run in complete). Smaller version: add let failed = request.error_code.is_some(); beside let prefix = request.prefix; at 3120, then

if let Some(prefix) = prefix {
    if !publish || failed { self.record_publication(prefix); }
    self.cache.unpin_request(prefix)?;
}

Two fewer slot lookups and one less shadowed binding per retirement. No behaviour change.

#14 [medium] nit: api.md ends its gauge paragraph with test scaffolding

Head 9cca87a, docs/api.md:309-312: "...and the test-only assertion in Cache::stats compares the maintained request-pinned count with a full scan of every checkpoint on each read."

This documents test scaffolding inside the API reference (a #[cfg(test)] assert at cache.rs:817-837). Under .agents/skills/repo-prose/SKILL.md:13-14 and :26-29 (documentation is a present-state specification, not a changelog or validation journal) and docs/design-review.md principle 16, evidence belongs in the PR description, which already states it. Also note the sentence sits inside the paragraph that also carries the ratio claim, so deleting the clause keeps that claim.

Smaller version: end the paragraph at "...excludes idle cached prefixes and snapshot backing pages."

Remaining 298-308 content (definitions, staleness of the published values, overlap with flare_cached_kv_pages, exclusions) is fine and is the right home for these two gauges, because the table at api.md:332-355 lists JSON snapshot fields plus their Prometheus names and these two gauges have no JSON field. So the earlier "table vs prose duplication" nit is withdrawn.

#15 [medium] nit: pin_prefix/unpin_prefix are pass-throughs worth collapsible with the cache API

New in 9cca87a. scheduler.rs:2025-2040 add pin_prefix/unpin_prefix (16 lines incl. a 2-line doc). They replaced three inline if inbound.is_none() { pin_request } else { pin } blocks at 1645 (pin) and 1656/1678 (unpin) — 12 lines of removed diff — so the net is about +6 lines and two more private functions with three call sites, all inside admit_planned.

pin_prefix has exactly one call site (1645). Smaller version once the cache exposes one entry point for both pin kinds (see entry 12's pin_kind): delete both helpers and call the cache directly at the three sites with the existing request_pin local (1643). If the positional bool is considered opaque, give the cache pin(id, holder: PinHolder) with PinHolder::{Request, Ticket}, still one function per direction instead of four.

Do not file as a blocker: the helpers do encode the choice once, which is what the earlier review asked for; the point is only that the line count grew and the wrappers are pass-throughs.

Rule: AGENTS.md:188-193 "Reject unsupported abstractions and churn … Refactoring must directly support the requested behavior".

#16 [medium] nit: the copy-out key masks gauge fields because it embeds the whole stats struct

New in 9cca87a, runtime.rs:2441-2455. CopyoutResources (1053-1059) embeds the whole SchedulerStats, which now carries two per-scrape gauges, so the memo key churned during decode (private_pages/reserved_pages move at scheduler.rs:2442-2444 without any cache movement). The fix zeroes them in a struct literal:

scheduler: crate::scheduler::SchedulerStats {
    request_pages: 0, reserved_pages: 0, ..self.scheduler.stats()
},

Correct, and the only place copy-out state is keyed. Simplicity point: this is a 3-line comment plus a field-masking literal compensating for embedding a 34-field stats struct in a comparison key; every future gauge joins the key by default and needs a second edit here. Smaller version: have CopyoutResources hold the cache-side values copy-out actually depends on (free_pages, free_snapshots, cached_pages, cached_checkpoints, snapshot_backing_pages) rather than the whole struct. That changes which movements re-offer deferred copy-outs, so it needs its own justification and is not required for this PR; record as a nit, not a blocker, and do not claim the current form is wrong.

#4 [low] no finding: metrics.rs plumbing and the inbound pin split

helios/src/server/metrics.rs:1309-1318 add two more (name, help, value) triples to the existing array-based gauge renderer; helios/src/server/metrics.rs:517-518 add two rows to the existing for (target, value) array; the test at 1835-1836 adds two entries to the existing (name, value) array. Nothing here is a parallel path or a new mechanism — the change reuses the established rendering and update tables. JSON Snapshot deliberately omits them (docs/api.md:307-323, ..Snapshot::default() at metrics.rs:384), so no second representation is introduced.

No finding for metrics.rs or for the scheduler call-site split at scheduler.rs:1643-1689 (plain pin for a request that is not yet an active request because it waits on a host-store ticket, request pin otherwise): the inbound case genuinely has no live-request pin until finish_inbound re-pins at 1900, which the test request_kv_pages_count_shared_prefix_pages_once and Cache::stats's drift assertion cover.