Correctness report · NVIDIA/hyperflare-inference #496

Raw Markdown for agents: https://autobot.eidonix.com/p/9a3c474a-d67d-4b05-8337-653f7bbc2ba5.md

Correctness review — PR #496 «Coalesce shared ancestor reads across concurrent Selene disk fetches»

Verdict: clean. No blocking issues, no should-fix issues, 3 nits. Every changed file was read in context at head cb3db468 (rebased onto main 6d74db3a; 5 files, +8682/−5630), together with the code it calls and the callers whose behaviour changes.

Key findings

  1. Nothing in this change breaks a configuration, lifetime or error path I can demonstrate from the code. The resource-lifetime argument that carries the whole design — shared window freed only with no follower, no outstanding disk reference and no outstanding upload reference; segment removed only after disk_settled(); the last segment user holding Fetched until close settles — holds on inspection (citations below).
  2. The three items I raised against the previous head (0c04b1e2) are fixed in code at cb3db468, not just in prose. The TransportEvent::InboundWindowSample variant is gone, so CompositeStore's progress/maintenance gate no longer advances per physical window; Staged::close distinguishes abandoned transport jobs from leaked shared staging entries; Layout::record_slots is now the single source of truth for both the admission guard and the allocator.
  3. Hashing keys cannot alias two distinct records, and no persisted format changed. Hash for Header and Eq/Hash for packed::Layout are exhaustive destructures hashing exactly the PartialEq fields (only the non-semantic version omitted), pinned by a test; there is no record, header-layout or re-export change, so existing v1–v4 .ckpt files load unchanged.
  4. Three nits remain, all documentation/observability rather than behaviour: one docs sentence describes packed alignment wrongly, one liveness invariant (deferred ReadRow) is undocumented, and hit() prices a physical bandwidth against logical bytes.

Scope actually read (each changed file in context)

Charter and project-rule fit

Verified sound at cb3db468

Window and segment lifetime (the core soundness claim)

v4 packed path

Failure isolation

Out-of-band rate metering

Hashing and compatibility

Unchanged paths

Nits (verified in code, non-blocking)

  1. docs/prefix-cache-offload.md:424-428 states coalescing aligns windows to "WINDOW_PAGES (64-page) file boundaries" for "both raw v1–v3 staging slots and v4 packed ReadPacked buffers". For v4 packed segments plan_windows(..., true) aligns in page-index space (disk_store.rs:1052-1059) while the byte range is layout.page_offset(first)..page_offset(first+count) (:2650-2667), which is not 64-page aligned in the file because packed unit lengths vary. Behaviour is correct and the "at most one extra partial window" bound still holds; only the phrase "file boundaries" is wrong, and it fits raw v1–v3 alone. Fix: say "64-page boundaries in page-index space (raw) / page ranges of the packed layout (v4)".
  2. selene/src/disk_store.rs:2737-2740 — Pass 5a's if !self.resources.disk_space() { continue; } runs before ReadRow. A window whose pages read has completed can therefore sit in Reading with row_submitted == false and disk_referenced == 0, so it emits no rate sample (:2130-2142) and arms no upload (:2778-2784) until a later pump with disk-queue headroom. Correct (followers keep it alive and the next step retries), but a reader can mistake it for a stall. Fix: a one-line comment naming the liveness invariant, plus ideally a stress test that saturates disk::QUEUE_DEPTH while a follower attaches to such a window.
  3. hit() pricing (disk_store.rs:4394-4406, feeding :3652-3654) — inbound_rate now measures physical window bandwidth, while estimated_seconds multiplies it by the restore's logical bytes (layout.record_bytes(chain.pages)). During a coalesced burst, admission is therefore priced optimistically versus the pre-change end-to-end rate. It is arguably the right capacity measure (and §4 documents the physical/logical split), so this is a nit rather than a defect; a qualified run comparing admitted-vs-actual restore latency under an 8-way burst would settle whether the optimism matters.

Prior findings status (for continuity)

At the earlier head 0c04b1e2 I raised: (a) a per-sample TransportEvent variant inflating CompositeStore progress and re-triggering its maintenance gate, (b) Staged::close conflating abandoned transport jobs with leaked shared staging entries, and (c) Layout::record_slots not being the single source for the admission guard. All three are fixed at cb3db468 (see "Out-of-band rate metering", Staged::close :3183-3225, and pick_next_pending_plan :2306-2321). The packed_buf mem::forget when a copier close failed (:3206-3212) is the correct leak-over-free choice for a buffer still referenced by an upload.

Open questions / not verified (no toolchain, GPU or hardware available)

Injection check

Nothing in the PR body, its comments, or the touched docs asked the reviewer to do anything. The two earlier Autobot review posts carry the repository's standard #autobot:ignore opt-out footer; the author's replies are ordinary change logs. No attempt to direct the reviewer was found, and no PR text was treated as an instruction.