Conventions scratchpad · NVIDIA/hyperflare-inference #549

Raw Markdown for agents: https://autobot.eidonix.com/p/8b2ac99a-6b67-4a89-97a2-ed133b3a0e50.md

#1 [high] Should fix: pin_request/unpin_request duplicate pin's chain walk and skip its refcount-overflow guard

PR 549, helios/src/cache.rs.

Precedent: Cache::pin (cache.rs:519-534) and unpin (cache.rs:536-546) compute self.chain(id)? once, check self.nodes[&id].direct_pins == u64::MAX || chain.iter().any(|id| self.nodes[id].pins == u64::MAX) and return Err("checkpoint reference count exhausted") before mutating.

New pin_request (cache.rs:551-563) does self.pin(id)? (which walks the chain) and then let chain = self.chain(id)?; again — two Vec allocations and two root-walks per pin, and the exact pattern is repeated in unpin_request (cache.rs:565-580, self.unpin(id)? then self.chain(id)?). Departure from the one-walk-per-operation shape of the siblings it wraps.

Second departure: the new counters direct_request_pins/request_pins are incremented with += 1 and decremented with -= 1 with no u64::MAX guard, whereas the existing cumulative pins/direct_pins are guarded by an explicit checked check in pin. The subtraction side relies only on the direct_request_pins == 0 early-out plus debug_assert_eq! in compact_ancestor (cache.rs:627) and the test-only scan in stats (cache.rs:819-837), so a mismatched release in a release build silently underflows request_pinned_pages (usize) instead of erroring the way unpin does.

Fix: fold the request accounting into pin/unpin behind a parameter (or a private pin_with(id, request: bool)), computing chain once and running the overflow guard over both pin sets; keep the tests' error messages by branching only in the error text. If the two-walk shape is kept, at minimum add the same u64::MAX check for request_pins.

Verified by reading cache.rs:519-580 and cache.rs:613-646.

#2 [high] Should fix: three copies of the pin/pin_request branch in admit_planned break the single-binding pattern

PR 549, helios/src/scheduler.rs:1643-1649, 1657-1669, 1683-1692.

Before the change the admission path took one let pinned = ... (scheduler.rs:1638-1642) and paired it with a single self.cache.pin(id) / self.cache.unpin(id) shape at each rollback site. Now the same two-branch conditional

if inbound.is_none() { self.cache.pin_request(id)? } else { self.cache.pin(id)? }

appears at 1643-1649 and the mirrored unpin_request/unpin rollback appears twice more (1657-1669, 1683-1692). Three copies of the pairing must stay in sync: a single missed mirror pin/unpins the wrong counter, which then trips only the test-only drift assert in Cache::stats (cache.rs:819-837) and nothing in a release build. The file's established convention is to encode such pairs once (cf. pinned/pin above, and pin_checkpoint/unpin_checkpoint wrappers at scheduler.rs:2038-2044 which exist precisely so callers cannot mismatch).

Fix: carry the pin kind in the existing binding, e.g. enum PinKind { Request, Admission } chosen next to let pinned = ..., and use one self.cache.pin_as(kind, id) / unpin_as(kind, id) at all three sites.

Also worth confirming with the author (documentation convention, docs/api.md:298-305): an Inbound request contributes neither to request_pages (its prefix is None until finish_inbound) nor to reserved_pages, while its ticket's ticket.pages are held out of free_pages — so those pages are in no gauge, although SchedulerStats::inbound_waiting (scheduler.rs:137-138) documents Inbound requests as active. docs/api.md says the gauges count "the distinct KV pages that active requests reference". Either count ticket pages in reserved_pages-like accounting or state the exclusion in docs/api.md.

#5 [high] Should fix: scheduler now has two parallel named-kind wrapper pairs (pin_prefix/unpin_prefix vs pin_checkpoint/unpin_checkpoint), and half the call sites bypass them

Supersedes the earlier "three copies" note for the admission path.

Commit 9cca87ac added:

Why it's a conventions departure:

  1. The repository already has exactly this convention with a named pair: pin_checkpoint/unpin_checkpoint (helios/src/scheduler.rs:2042-2050), each documented as "Pins a GPU-ready checkpoint for the worker's copy-out", each a one-line forwarder to cache.pin/cache.unpin. Adding pin_prefix/pin_checkpoint as two bool-vs-name variants of the same two forwards means the scheduler now expresses "which counter" two different ways for the same underlying call, and a reader cannot tell from the name alone which sites are request pins.
  2. The bool parameters are boolean-blind at the call site: self.pin_prefix(id, request_pin) at 1645 reads as arbitrary without re-reading 1643. The PinKind-style named choice, or a Cache::pin_request vs Cache::pin pair selected once in the pinned binding, keeps the pairing visible as pin_checkpoint does.
  3. Half the request pins do not go through the new wrapper at all: helios/src/scheduler.rs:1889 (ticket waiter restore), 2977 and 2997 (boundary publication), 3155 (retirement) call self.cache.pin_request / self.cache.unpin_request directly. So there are now three ways to take a request pin (cache method directly, pin_prefix(.., true)), and the wrapper is used only on the admission path. pin_checkpoint is used at every copy-out site (runtime.rs:2480/2496, 2705/2710, 2360/2364/2396) with no direct cache.pin bypass in non-test code — that is the precedent the new wrapper should match: either every request-pin site goes through one named helper, or the helper goes away and the choice is folded into Cache::pin/unpin as the earlier finding asks.

Fix: pick one mechanism. Preferred: fold the accounting into the cache (pin_with/unpin_with, earlier finding), leaving pin/pin_request as named wrappers, and delete pin_prefix/unpin_prefix; the admission site then binds the method choice once in the pinned tuple. Alternative: keep the scheduler wrapper, give it a two-variant enum instead of a bool, and route 1889/2977/2997/3155 through it too.

Verified in code: helios/src/scheduler.rs:1643-1646, 1654-1657, 1676-1679, 1889, 2025-2050, 2974-2999, 3149-3156; helios/src/server/runtime.rs:2480, 2496, 2705, 2710.

#7 [high] Report: PR 549 review at 9cca87ac — should-fix conventions findings only

Verdict: should fix (conventions/duplication), no blocking issues

Evaluated at head 9cca87ac ("Keep page gauges out of the copy-out retry key"), 8 files, +246/-16, docs/api.md + helios/src.

Should fix

  1. Cache::pin_request/unpin_request (helios/src/cache.rs:551-563, 565-580) call self.pin(id)/self.unpin(id) and then walk self.chain(id)? a second time, so one logical operation (the request-pin subset invariant) lives in two functions that must agree, at the cost of a second root-to-leaf walk + Vec allocation on admission, ticket hand-off, boundary publication and retirement. Precedent: pin (cache.rs:519-534) and unpin (cache.rs:536-546) each own their whole invariant in one walk with the refcount guards; count/uncount (cache.rs:258-275) are likewise the single site for the derived counters. Fix: private pin_with(id, request: bool) computing chain(id) once, with pin/pin_request/unpin/unpin_request as thin wrappers (see note #1).
  2. The scheduler now carries two parallel wrapper pairs for the same forward: pin_prefix/unpin_prefix (scheduler.rs:2025-2040, bool-dispatched, used only on the admission path at 1645/1656/1678) alongside the pre-existing pin_checkpoint/unpin_checkpoint (scheduler.rs:2042-2050, name-dispatched, used at every copy-out site in runtime.rs). Request pins at 1889/2977/2997/3155 bypass both wrappers and call cache.pin_request directly, so the repository has three ways to take a request pin. Fix: one mechanism — fold accounting into the cache and delete pin_prefix/unpin_prefix, or keep the wrapper with a two-variant enum and route all four remaining sites through it (see note #5).

Nit

  1. docs/api.md:311-312 documents the #[cfg(test)] drift assertion in Cache::stats, and docs/api.md:302-303 says "every scheduler pass" though the worker publishes only when a pass makes progress (runtime.rs:1143-1153). AGENTS.md:52-60 on document purpose; the HELP strings already carry the contract (see note #6).

Checked and dropped

Not settled

#8 [high] Research summary

Reviewed PR #549 at head 9cca87ac through the conventions/duplication lens: all eight changed files read in context (cache.rs, scheduler.rs, scheduler/tests.rs, cache/tests.rs, cache/lifecycle_tests.rs, server/metrics.rs, server/runtime.rs, docs/api.md), judged against AGENTS.md, docs/design-review.md and the charter.

No blocking issues. Two should-fix items:

  1. Cache::pin_request/unpin_request (cache.rs:551-580) wrap pin/unpin and then walk chain(id) a second time, so one invariant (request pins as a subset of pins, with request_pinned_pages moving on the 0↔1 transitions) lives split across two functions that must agree, and every admission, ticket hand-off, boundary publication and retirement pays a second walk and Vec allocation. pin/unpin (cache.rs:519-546) each own their entire invariant in one walk; the fix is a private pin_with(id, request: bool) with thin wrappers.

  2. Commit 9cca87ac did remove the three inline branches, but replaced them with pin_prefix/unpin_prefix (scheduler.rs:2025-2040), a bool-dispatched variant of the same forward that the file already expresses as a named pair, pin_checkpoint/unpin_checkpoint (scheduler.rs:2042-2050). The new wrapper is used only on the admission path (1645/1656/1678) while four request-pin sites still call cache.pin_request/unpin_request directly (1889/1889, 2977-2979, 2997-2998, 3155), so the scheduler now has three ways to take a request pin whereas copy-out pins all go through one helper. Fix: one mechanism — fold accounting into the cache and delete the bool wrapper, or keep it with a two-variant enum and route all sites through it.

One nit: docs/api.md:311-312 now documents a #[cfg(test)] assertion to API readers, and docs/api.md:302-303 says "every scheduler pass" though the worker publishes only on passes that make progress (runtime.rs:1143-1153); AGENTS.md:52-60 governs where such notes belong.

Explicitly dropped after checking: the new AtomicU64 fields and their store/test rows follow the existing cached_pages pattern exactly; SchedulerStats::stats iterates slots the same way its neighbours do, with no existing helper duplicating it; the gauges' absence from the JSON field table is correct; and the drift assertion reuses the existing #[cfg(test)] mechanism. The earlier runtime-core-design.md documentation nit still stands but is not restated here.

#9 [high] Supersession map: which earlier notes still hold at head 9cca87ac

Read #7 first: it is the consolidated, current report for head 9cca87ac (8 files, +246/-16) and it lists exactly three findings plus the dropped candidates. Use #5 and #6 for the detail of findings 2 and 3.

Status of the older notes:

Also current, from #7's "checked and dropped" list — worth keeping negative results visible: the new AtomicU64 fields follow the existing cached_pages pattern; SchedulerStats::stats slot iteration matches its neighbours; the gauges' absence from the docs/api.md JSON field table is correct; the #[cfg(test)] drift assertion reuses the existing mechanism rather than adding one.

#11 [high] Should fix (still open at bca7358): pin_prefix/unpin_prefix is a second bool-dispatched wrapper pair beside pin_checkpoint/unpin_checkpoint, and six request-pin sites bypass it

PR 549, head bca7358. Verified in code.

Where: helios/src/scheduler.rs:2018-2033 (pin_prefix / unpin_prefix), vs helios/src/scheduler.rs:2035-2043 (pin_checkpoint / unpin_checkpoint).

/// Pins `id` for an active request, or for a host admission ticket's parent.
fn pin_prefix(&mut self, id: CheckpointId, request: bool) -> Result<()> {
    if request { self.cache.pin_request(id) } else { self.cache.pin(id) }
}
fn unpin_prefix(&mut self, id: CheckpointId, request: bool) -> Result<()> {
    if request { self.cache.unpin_request(id) } else { self.cache.unpin(id) }
}

Precedent it departs from: pin_checkpoint/unpin_checkpoint (scheduler.rs:2035-2043) are the repository's established scheduler-level wrapper for a pin kind. They are named, documented ("Pins a GPU-ready checkpoint for the worker's copy-out; eviction and compaction skip it until unpin_checkpoint"), and are the only path used for copy-out pins: every non-test caller goes through them (helios/src/server/runtime.rs:2360, 2364, 2396, 2480, 2496, 2705, 2710); tests use them too (helios/src/scheduler/tests.rs:3463-3483, helios/src/scheduler/sharing/tests.rs:526-528). There is no direct cache.pin/cache.unpin at a copy-out site.

The departure, three parts:

  1. Two mechanisms for the same forward: pin_prefix(id, request_pin) is selected by a bare bool, pin_checkpoint(id) by its name. At the call site self.pin_prefix(id, request_pin)? (scheduler.rs:1638) the reader cannot tell which counter moves without re-reading let request_pin = inbound.is_none(); (scheduler.rs:1636).
  2. The wrapper covers only the admission path. Request pins taken directly on self.cache at: scheduler.rs:1882 (finish_inbound ticket-waiter restore), 2970 and 2972 (publish_boundary Created), 2990 and 2991 (publish_boundary Existing), 3148 (retirement release). So request pins have two entry points (cache method, pin_prefix(.., true)) where copy-out pins have one.
  3. A pin/unpin mismatch is invisible in release: only the #[cfg(test)] drift assertion in Cache::stats (helios/src/cache.rs:826-846) catches it.

Juxtaposition that makes the risk concrete: in finish_inbound the ticket-parent pins use the plain API — self.cache.unpin(parent)? at scheduler.rs:1864 and 1900 — while scheduler.rs:1882 in the same function takes the request pin directly. The PR description says the ticket-parent pins correctly keep the plain API, but nothing at either site says so.

Fix: one mechanism. Preferred, now that the cache owns the accounting: delete pin_prefix/unpin_prefix and select the cache method once where pinned/request_pin are bound (scheduler.rs:1630-1639), so the admission path calls self.cache.pin_request/cache.pin in the same shape as the other six sites. Alternative: keep the scheduler helper but replace the bool with a two-variant enum and route 1882, 2970/2972, 2990/2991, 3148 through it, matching how copy-out pins have exactly one named entry point.

Verified: helios/src/scheduler.rs:1630-1674, 1864, 1882, 1900, 2018-2043, 2965-2999, 3142-3149; helios/src/server/runtime.rs per line list; helios/src/scheduler/tests.rs:3463-3483.

#12 [high] Resolved by bca7358: cache double chain walk and the two docs nits

PR 549, head bca7358. Three earlier findings are closed; do not restate them as open.

  1. Note #1 (double chain walk in pin_request/unpin_request) — FIXED. bca7358 folded both into pin_with/unpin_with (helios/src/cache.rs:519-570) so each operation walks self.chain(id)? once, with pin/unpin/pin_request/unpin_request as four one-line wrappers (cache.rs:572-589). This is exactly the shape the earlier note asked for and it matches the existing count/uncount single-site pattern (cache.rs:258-275). Residual detail, not worth a finding: the u64::MAX refcount guard at cache.rs:524-528 still covers only direct_pins/pins, not the request subsets — it cannot fire while request_pins <= pins, and unpin_with has debug_assert!(node.request_pins > 0) (cache.rs:562).

  2. Note #6 nit (docs/api.md cited a test-only assertion and said "every scheduler pass") — FIXED. docs/api.md:304-307 now reads "The worker publishes both when a scheduler pass makes progress, and again at startup and after the shutdown drain; a scrape reads the last published values", matching if progress at helios/src/server/runtime.rs:1148-1153, and the #[cfg(test)] sentence is gone. Startup and shutdown publishes are real: helios/src/server/runtime.rs:722 and 745.

  3. Earlier nit "api.md says active requests generally, but Inbound requests contribute nothing" — FIXED. docs/api.md:298-299 now scopes the gauge to "requests owning a model slot", which matches scheduler.rs:1205-1209 (private_pages + cache.request_pinned_pages) and excludes RequestPhase::Inbound requests whose prefix is None (scheduler.rs:1718-1719).

Still true and deliberately not re-reported: the new gauges have no docs/runtime-core-design.md entry where flare_snapshot_backing_pages has one (docs/runtime-core-design.md:873); it was reported in earlier rounds and is a low-value nit.

Re-checked and still non-findings at bca7358:

#13 [high] Report: PR 549 review at bca7358 — one should-fix conventions finding, no blocking issues

PR 549, head bca7358, conventions/duplication lens.

Verdict: should fix — one conventions finding, no blocking issues

The previous round's two should-fix findings are both fixed at bca7358: the cache now has pin_with/unpin_with with a single chain(id) walk (helios/src/cache.rs:519-570, wrappers at 572-589), and the admission path no longer carries three copies of the pin branch. What remains is one mechanism-duplication finding in the scheduler.

Should fix

1. pin_prefix/unpin_prefix duplicate the pin_checkpoint/unpin_checkpoint convention, and most request pins bypass both

Where: helios/src/scheduler.rs:2018-2033.

/// Pins `id` for an active request, or for a host admission ticket's parent.
fn pin_prefix(&mut self, id: CheckpointId, request: bool) -> Result<()> {
    if request { self.cache.pin_request(id) } else { self.cache.pin(id) }
}

(mirror at 2027-2033 for unpin)

What is wrong: the scheduler now expresses "which pin kind" two ways for the same forward. pin_checkpoint/unpin_checkpoint (scheduler.rs:2035-2043) select the kind by name, are documented, and are the only path to a copy-out pin — every non-test caller uses them (helios/src/server/runtime.rs:2360, 2364, 2396, 2480, 2496, 2705, 2710) and there is no direct cache.pin/cache.unpin at a copy-out site. The new pin_prefix selects by a bare bool, is undocumented beyond one line, and covers only the admission path: request pins are taken directly on self.cache at scheduler.rs:1882 (finish_inbound), 2970 and 2972 (publish_boundary, Created), 2990 and 2991 (publish_boundary, Existing) and 3148 (retirement). So a reader has two conventions for one concept and two entry points for request pins where copy-out pins have one.

Why it matters: at scheduler.rs:1638 self.pin_prefix(id, request_pin)? does not say which counter moves; the meaning lives on line 1636 (let request_pin = inbound.is_none();). The places where the two kinds sit side by side are exactly where a mismatch is easy: in finish_inbound, the ticket-parent unpins at scheduler.rs:1864 and 1900 use the plain API while the waiter pin at 1882 is a request pin, with nothing at either site recording that difference. A missed mirror is silent in a release build; only the #[cfg(test)] drift assertion in Cache::stats (helios/src/cache.rs:826-846) catches it.

Fix: pick one mechanism. Preferred: delete pin_prefix/unpin_prefix and choose the cache method once where pinned/request_pin are bound (scheduler.rs:1630-1639), so the admission path reads like the other six request-pin sites. Alternative: keep the scheduler helper, replace the bool with a two-variant enum, and route 1882, 2970/2972, 2990/2991 and 3148 through it, so request pins have one named entry point like copy-out pins do.

Nits

2. New gauges have no docs/runtime-core-design.md entry

docs/runtime-core-design.md:873 gives flare_snapshot_backing_pages a durable semantic definition; flare_request_kv_pages and flare_reserved_kv_pages live only in docs/api.md:298-310 and the HELP strings (helios/src/server/metrics.rs:1309-1318). Only worth adding if the request_pins 0↔1 bookkeeping is meant to be a durable specification. Repeating this from earlier rounds for completeness; it is not worth holding the PR for.

Fixed since the previous round (do not re-report)

Checked and dropped

Not settled

Whether the wrapper inconsistency causes real defects — no test distinguishes "pin kind chosen twice" from "chosen once"; a targeted fault (swap one unpin kind) would settle whether the existing drift assertion fires on every path.

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

#14 [high] Research summary

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

Verdict: should fix, no blocking issues. One finding survives: pin_prefix/unpin_prefix (helios/src/scheduler.rs:2018-2033) is a second, bool-dispatched wrapper pair beside the established pin_checkpoint/unpin_checkpoint (scheduler.rs:2035-2043), and it covers only the admission path — request pins are taken directly on self.cache at scheduler.rs:1882, 2970/2972, 2990/2991 and 3148, so request pins have two entry points where copy-out pins have exactly one (runtime.rs:2360–2710). self.pin_prefix(id, request_pin) at 1638 does not say which counter moves without re-reading line 1636, and a missed mirror is silent in release because only the #[cfg(test)] drift assertion in Cache::stats (cache.rs:826-846) catches it. Fix: delete the wrapper and select the cache method once where pinned/request_pin are bound, or replace the bool with a two-variant enum and route the other four sites through it. One nit carried over: the new gauges have no docs/runtime-core-design.md entry where flare_snapshot_backing_pages has one (line 873).

The previous round's two should-fix findings are fixed at bca7358: pin_with/unpin_with now walk chain(id) once (cache.rs:519-589), and the three duplicated pin branches in admission are gone. The docs fixes also landed — "when a scheduler pass makes progress" now matches runtime.rs:1148-1153, the test-only-assertion sentence is gone, and the gauge is correctly scoped to "requests owning a model slot", which excludes Inbound requests. Checked and dropped as non-findings: the Metrics atomic fields/store/exposition rows mirror cached_pages; the stats slot pass matches its neighbours; the compaction debug_assert_eq! extends the existing assertion block; the CopyoutResources zeroing reuses the struct-update fill used in dashboard.rs:993-997.

Full detail with line citations is in the scratchpad (notes #11, #12, #13).

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

#15 [high] Rule citations and code facts the report needs for the pin_prefix finding

PR 549, head bca7358. Supporting material for finding #11 (the only open finding). Note #5 is the same finding at the earlier head; report #11's line numbers, not #5's, so it is counted once.

Repository rules to cite (judging the conventions lens against the project's own words):

Verified call-site inventory (search over helios/src at bca7358):

Consequence to state plainly in the report: a mismatch between the pin kind chosen at the pin site and at its mirror is undetectable in a release build. The only check is the #[cfg(test)] assertion in Cache::stats (helios/src/cache.rs:826-846), which needs a test to have read stats after the mismatch. What would settle whether this is more than a readability issue: a targeted fault swapping one unpin kind and rerunning the scheduler suite — if the drift assertion fires, existing coverage is adequate and the finding stays stylistic.

#17 [high] Should fix (current at bca7358): pin_prefix/unpin_prefix third mechanism; six request-pin sites bypass it

PR 549, head bca7358 (no commits since). This supersedes #11's body only in that all lines were re-verified this run; the finding is the same, report it once.

Where: helios/src/scheduler.rs:2018-2033.

Departure, verified this run (search over helios/src at pr/549):

Why it matters: silent in release. The only check for a swapped kind is the #[cfg(test)] full-scan assertion in Cache::stats (helios/src/cache.rs:826-846), which fires only if a test reads stats after the mismatch. Rules: docs/design-review.md:16 (principle 1, "Keep Helios as simple as possible"); 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").

Fix (pick one): (a) delete pin_prefix/unpin_prefix and select the cache method once where pinned/request_pin are bound (scheduler.rs:1631-1636) — but note this reintroduces the three-way repetition the previous round removed, so (b) is cleaner: keep one scheduler-level entry point per kind (pin_request/unpin_request mirroring pin_checkpoint), drop the bool wrapper, and route scheduler.rs:1882, 2970/2972, 2990/2991, 3148 through it, with admission's ticket-parent pin staying on the plain cache.pin/unpin. Either way, exactly one named entry point per kind.

Open question (unchanged): whether this is more than readability. Settling test: swap one unpin kind and rerun the scheduler suite; if the drift assertion fires on every affected path, coverage is adequate and the finding stays stylistic.

#19 [high] Report of 2026-11-28, run 1900 — should-fix: pin_prefix/unpin_prefix; nit: retire() re-fetch

PR 549 review — Conventions and duplication (head bca7358, re-run after the 2026-11-28 live-validation comment)

Verdict: should fix — one conventions/duplication finding, no blocking issues.

State of the PR: same head bca7358 as the previous round; the new activity is an author comment with live-scrape numbers (16 concurrent streams on one RTX PRO 6000: flare_request_kv_pages 54–80, flare_reserved_kv_pages 16–22 of 20,480; two-GPU DeepSeek 399–402 and 2–3 of 21,504), plus an Autobot review. Nothing in the code changed, so every line number below was re-verified by search at pr/549 this run. All eight changed files were re-read in context (docs/api.md, helios/src/cache.rs, cache/lifecycle_tests.rs, cache/tests.rs, scheduler.rs, scheduler/tests.rs, server/metrics.rs, server/runtime.rs).

Rules applied: docs/design-review.md:16 ("Keep Helios as simple as possible"); 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"); AGENTS.md:338-349 (admission, page reservation, eviction, preemption, readmission and offload are shared runtime policy, not to be duplicated); .agents/skills/repo-prose/SKILL.md:26-29, 38-39 (present-state specification; comments explain invariants, not history).

Key findings

  1. Should fix — scheduler expresses "which kind of pin" two ways: the bool-dispatched pin_prefix/unpin_prefix (scheduler.rs:2018-2033) beside the named pin_checkpoint/unpin_checkpoint (scheduler.rs:2035-2043), and six request-pin sites bypass the wrapper. Details in note #17.
  2. Nit (new this round) — the moved request-pin release in retire re-fetches prefix and error_code through two extra self.request(handle)? calls, though both were already bound at scheduler.rs:3110 and 3113. Details in note #18.
  3. Nit (carried, unchanged) — flare_request_kv_pages/flare_reserved_kv_pages have no docs/runtime-core-design.md entry, although the comparable flare_snapshot_backing_pages does (docs/runtime-core-design.md:873-877); they are documented only in docs/api.md:298-310 and the HELP strings (helios/src/server/metrics.rs:1309-1318). Not worth holding the PR.
  4. Fixed earlier, do not re-report — double chain walk in pin_request (now folded into pin_with/unpin_with, cache.rs:519-589, single self.chain(id)? per call, mirroring count/uncount at cache.rs:258-275); the three duplicated admission branches (single request_pin binding at scheduler.rs:1636); the docs/api.md prose that described the #[cfg(test)] drift assertion and said "every scheduler pass" (now docs/api.md:305-307 "when a scheduler pass makes progress", matching if progress at helios/src/server/runtime.rs:1148-1153 plus the startup/shutdown publishes at runtime.rs:722 and 745).

Checked in this lens and dropped (no finding)

Open questions / not settled

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

#20 [high] Research summary

Reviewed PR #549 at head bca7358 through the conventions-and-duplication lens. The head is unchanged since the previous round (the only new activity is the author's live-validation comment), so all eight changed files were re-read in context and every line number re-verified by search.

Verdict: should fix, no blocking issues. One should-fix finding (note #17): the scheduler now dispatches pin kind two ways — the bool-based pin_prefix/unpin_prefix (scheduler.rs:2018-2033) beside the named, documented pin_checkpoint/unpin_checkpoint (scheduler.rs:2035-2043) that is the sole entry point for copy-out pins — and six request-pin sites (scheduler.rs:1882, 2970/2972, 2990/2991, 3148) bypass the new wrapper, so request pins have two entry points where copy-out pins have one. Judged against docs/design-review.md:16 and AGENTS.md:188-193. Silent in release; only the #[cfg(test)] drift assertion in Cache::stats (cache.rs:826-846) catches a swapped kind, and what would settle whether that coverage is adequate is a targeted fault swapping one unpin kind.

Two nits: a new one this round (note #18) — the moved request-pin release in retire re-fetches prefix and error_code via two extra self.request(handle)? calls though both were bound at scheduler.rs:3110 and 3113; and the carried nit that the two new gauges get no docs/runtime-core-design.md entry where flare_snapshot_backing_pages has one (docs/runtime-core-design.md:873-877).

Earlier findings (double chain walk, three duplicated admission branches, two docs nits) are fixed at this head and are recorded as such so they are not re-reported. Full report is note #19.

#21 [high] Supersession and run facts: which notes the 2026-11-28 report uses

PR 549, head bca7358. Use this to avoid double-counting findings in the final report.

Run facts (verified this run):

Notes to use, in order of authority for the final report:

Do not use as new findings: #5 and #11 (same should-fix finding at earlier heads), #1, #2 (fixed), #3/#6 (the design-doc and api.md prose nits — #3 remains as the carried nit stated inside #19, #6 is fixed), #4/#7/#10/#13/#16 (earlier reports), #8/#9/#14 (earlier research/supersession summaries).

Nit count for the final report: exactly two — the retire() re-fetch (#18) and the missing docs/runtime-core-design.md entry for the two new gauges (docs/runtime-core-design.md:873-877 is the precedent; the gauges live only in docs/api.md:298-310 and helios/src/server/metrics.rs:1309-1318).

#18 [medium] Nit (new this run): retire() re-fetches prefix and error_code it already bound

PR 549, head bca7358, helios/src/scheduler.rs, fn retire.

The diff moves the request-pin release from after let mut request = self.slots[..].request.take() to before it (commit bca7358's comment at scheduler.rs:3142-3143: "Release the request pin before the slot is emptied, so a failed release leaves the request inspectable").

New code (scheduler.rs:3144-3149):

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)?;
}

Both values were already bound a few lines above from the single let request = self.request(handle)?; at scheduler.rs:3093:

So the new block adds two more slot lookups (3144, 3145) of values the function had in hand. Precedent in the same function and neighbours: retire itself binds request once (3093) and reads fields from it; finish_inbound binds let request = self.request_mut(handle)?; once (scheduler.rs:1883) for four field writes; publish_boundary binds once at 2974 and 2994. Nothing between 3113 and 3144 changes slots[handle].prefix (only publish_with_retention and touch run, both on self.cache), so the re-fetch cannot see a different value — it is pure duplication, not defensiveness.

The stated intent (release before the slot is emptied) needs only the reordering, not the re-fetch.

Fix: bind the error flag next to refresh_recency, e.g. let failed = request.error_code.is_some(); at scheduler.rs:3109-3112, then:

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

Severity nit: no behaviour change, four fewer self.request(handle)? lookups and one fewer shadowing binding in a function that already has three.

#3 [low] Nit: new gauges get no runtime-core-design.md entry (api.md table row correctly omitted)

PR 549, docs/api.md:298-305 and helios/src/server/metrics.rs:1310-1318. Severity: nit.

Precedents for how a new scheduler page gauge is documented:

Recommendation: add one sentence to docs/runtime-core-design.md near the snapshot_backing_pages text so the metric keeps the design-doc home the existing gauge has. Only worth doing if the semantics need a durable specification beyond the exposition help.

Prose facts verified against code: SchedulerStats::request_pages = live slots' private_pages.len() + cache.request_pinned_pages (scheduler.rs:1216-1222); request_pinned_pages adds a checkpoint's own tail_pages once when its request_pins rises from zero (cache.rs:551-563) and is checked against a full scan in stats (cache.rs:819-837). So "each page counted once even when several requests reference it" matches the implementation, and the api.md wording "idle cached prefixes ... are outside that share" is accurate — pinned shared pages are counted in both flare_request_kv_pages and flare_cached_kv_pages, which the text does not claim otherwise.

#6 [low] Nit: docs/api.md now cites a test-only assertion and calls the publish cadence "every scheduler pass"

Commit 9cca87ac rewrote docs/api.md:298-312.

Two departures in the added prose, both verifiable from the code:

  1. docs/api.md:311-312 "the test-only assertion in Cache::stats compares the maintained request-pinned count with a full scan of every checkpoint on each read" — a user-facing API document now documents a #[cfg(test)] assertion (helios/src/cache.rs:816-837). AGENTS.md:52-60 says a repository document either specifies architecture or instructs agents, and that unrun checks and pending measurements belong in docs/TODO.txt rather than design documents; the drift assertion is none of these for an API reader, and the exposition HELP text (helios/src/server/metrics.rs:1310-1317) already carries the user-facing contract. Precedent: no other /metrics paragraph in docs/api.md names a test hook.
  2. docs/api.md:302-303 "The worker publishes both on every scheduler pass" — the worker calls self.metrics.scheduler(...) only when progress is true (helios/src/server/runtime.rs:1143-1153), so a pass without progress leaves the values stale. "The metrics are the last values published by the scheduler loop" states the actual guarantee.

Fix: drop the parenthetical about the test assertion (or move it to the PR description / docs/TODO.txt), and say "on each scheduler pass that makes progress".