Code review summary scratchpad · NVIDIA/hyperflare-inference #496

Raw Markdown for agents: https://autobot.eidonix.com/p/dec2b856-3b4d-4ae3-8be2-92ebfa6432ff.md

#1 [high] PR #496 overview: coalesced Selene disk reads — evidence and architecture

PR #496 "Coalesce shared ancestor reads across concurrent Selene disk fetches" by FujitsuPolycom, head f9c9191, base main, 2 files +2808/-914 (selene/src/disk_store.rs +2803/-913; docs/prefix-cache-offload.md +5/-1). Only comment is the autobot case-file notice; no human review yet.

What: splits Staged's read path — caller-owned host reads (read_into, host_inbound) stay private/unchanged; GPU restores (fetch, pump_device_inbound) share one disk-thread file handle per (path, expected Header) and one staged window per (path, header, first, count, row); segments are sliced on 64-page WINDOW_PAGES file boundaries (plan_aligned_windows) so restores with different skip_pages produce identical suffix windows; windows are ref-counted (disk_referenced/upload_referenced/followers); last user waits for close (settled) before Fetched.

Evidence: benchmark table on GB10 SM121 single-pass flare run vs main 425ab2d4, physical NVMe bytes 18,026->4,286 MB (4.21x), 18,093->4,563 (3.97x), Flash-Next 7,944->1,981 (4.01x), 3.54x, 2-host RoCE 4.04x/3.45x, DeepSeek TP4 1.00x; TTFT medians reported. Unit suites at c0c4f798 (474 tests), 7 coalescing tests also on Windows IOCP. Live SM121 checks include the Qwen3.8-27B TP1 61.3K regression 8/9 -> 7/9. Description discloses: benchmark measured BEFORE the linear demand-index and close-count edits; single-pass SM121 runs not repeated after edits.

Scope verdict (architecture lens): belongs — charter "What gets merged" allows a measured performance issue; AGENTS.md:165-166; goal "Store prefix-cache checkpoints in host memory and share them across Flare instances via Selene". No new flags/env/knobs, no format/Header change, no per-model branch, failure isolation preserved (private errors fail one restore; shared record_read errors fail all attached after drain, TransportEvent::Fetched still routes record_read to index.drop_row).

#2 [high] Finding: logical vs physical bytes conflated -> inbound_rate inflation

selene/src/disk_store.rs: SharedWindow.read_bytes accumulates physical reply bytes once per window (:1530 win.read_bytes += reply.bytes, init :1979); every follower completing an upload adds the WHOLE window to its own record (:1829 record.bytes += win.read_bytes). Per-record bytes become the Ok payload of TransportEvent::Fetched (:2235 None => Ok(record.bytes)), consumed in DiskStore::apply as self.stats.bytes_in += bytes (:3626) and self.inbound_rate.observe(*bytes, job.started.elapsed()) (:3628).

Why it matters: inbound_rate is an input to admission, not just a stat. DiskStore::hit uses bytes as f64 / self.inbound_rate.get().max(1.0) for estimated_seconds (:3587); selene/src/store.rs:423-438 worth_fetching/worth_transfer compares it to prefill cost; consumers helios/src/server/runtime.rs:2772 and helios/src/server/metrics.rs:532. Under a coalesced burst the rate sample divides ~logical bytes by ~4x shorter physical elapsed time, inflating inbound_rate by roughly the fan-out (PR's own table: 4.21x, 3.97x, 4.01x). A later lone restore that will NOT be coalesced is then under-priced and may be fetched when prefill was cheaper. Also stats.bytes_in shows no reduction at all, so the headline physical-read win is invisible in operator counters; docs/prefix-cache-offload.md:1501-1502 defines "Inbound latency" and "Copy-out bandwidth" as coming from store counters.

Fix direction: observe the rate from physical window bytes (count a window once at window/segment completion), keep bytes_in as logical restored bytes and document the distinction; add a test comparing StoreStats.inbound_rate for 1 vs 8 concurrent restores of the same prefix against measured device bytes.

#3 [high] Finding: unexplained accuracy regression 8/9 -> 7/9 at 61.3K

PR #496 description "Live SM121 checks": Qwen3.8-27B-NVFP4 TP1, 9-fact numerical retrieval, temperature=0, cold-VRAM restart: main 9/9 at 30.1K, and at 61.3K main 8/9 (or 8/9->7/9 on the retrieval prompt) vs THIS PR 7/9. Everything else claimed byte-exact (DeepSeek TP4 9/9 at 23.1K/47.1K). No conclusion offered ("recipe-clamped").

Why it matters: it is the only end-to-end check exercising the shared-window fan-out on a real model, and it is the one that got worse. Deterministic temperature=0 means it is a real answer change unless the harness is noisy. AGENTS.md:106-108 requires explaining differences between runs and keeping material failures visible.

Possible defect sites if real: plan_aligned_windows offset/count mapping for a follower whose first page is not 64-aligned (selene/src/disk_store.rs:700-738), and the trailing partial chunk / row flag (row && chunk_end == end, :730). Suggested test: follower attaches to an already-created shared window with non-64-multiple skip_pages plus a shared final partial chunk, asserting byte-exact device pages/row vs the private path.

Fix requested: re-run the 61.3K prompt N times on both revisions and report variance/name the differing fact and the conclusion, or move the check under "Not covered" as inconclusive. Severity: should fix (may collapse to a description fix).

#4 [high] Findings: docs §2.4 overstates mechanism, stale signatures, misplaced rustdoc

  1. docs/prefix-cache-offload.md:337-342 (+5/-1). New sentence: "Concurrent fetch jobs reading the same record file share one open file handle and coalesce aligned 64-page windows while staged so one disk read fans out to each attached fetch's GPU upload before its staging slots are released; caller-owned read_into reads run independently." Missing: (a) the two material limits the PR description itself discloses — a window already released before a later arrival attaches is read again, and skip_pages % WINDOW_PAGES != 0 splits up to one extra partial window (AGENTS.md:194-199 material limitations); (b) the invariant that licenses sharing (records immutable + pinned in DiskStore for the life of every restore) — design-review principle 16 "no hidden context"; it exists only in the PR conversation. (c) "aligned 64-page" doesn't say aligned to what: absolute file page boundaries (they're WINDOW_PAGES, defined at docs:85 / referenced at docs:398 "windows of at most 64 pages plus the multi-slot row"). (d) Same paragraph keeps stale signatures write_from(key, metadata, buffers) / read_into(key, buffers); actual signatures are write_from(id, header, temporary, path, pages, row, sums) at selene/src/disk_store.rs:1242-1251 and read_into(id, path, expected, first_page, pages, row) at :1268-1276 (pre-existing, but the sentence is being edited). (e) One 60-word sentence carries three behaviours; repo doc style elsewhere is one behaviour per sentence (compare docs:328-336). Also failure-scope (shared open/read error fails all attached; private child/upload error fails one) is in the PR body but not in §2.4 or the §2.12 invariants list (docs:853).

  2. Module doc selene/src/disk_store.rs:14-24: says "at most [WINDOWS_IN_FLIGHT] windows of one record staged at a time" and "Nothing here waits", but device restores now hold shared windows past their own completion until followers finish and can be complete-but-not-reported while waiting for seg.settled() (:2221-2232). Header should state the two-window credit, follower sharing, and settle-before-Fetched.

  3. Misplaced rustdoc selene/src/disk_store.rs:228-234: the comment for Resources::allocate ("Slots for pages page records and, when row, all row pieces; None leaves the pool unchanged...") now sits above free_slots, which takes no arguments — published docs are wrong and allocate (the subtle all-or-nothing contract) is undocumented. On main the comment is above allocate (main selene/src/disk_store.rs:216-218). Fix: move it back; give free_slots a one-liner.

#5 [high] Findings: duplication, unnamed window key, per-pump cost, redundant state, counters

A) plan_aligned_windows (selene/src/disk_store.rs:700-738) duplicates plan_windows (:670-695): same signature impl IntoIterator<Item=(u32,usize,bool)> -> Vec<WindowPlan>, same WindowPlan fields, same row-on-last-window and pages==0/row-only rules; only difference is chunk end clamped to ((cursor / WINDOW_PAGES) + 1) * WINDOW_PAGES (:721-722). Identical output when first is aligned — i.e. the divergence is exactly the misaligned-skip_pages case the new tests cover. selene/src/memory.rs:1333-1367 windows() is a third expression of the same splitter policy. Charter line: "look for the smallest footprint in shared code". Fix: give plan_windows an alignment parameter and delete the copy (or use plan_aligned_windows for read_into too — the only test asserting host split points is windows_split_segments_at_the_window_size_and_carry_the_row_last at :6221-6253).

B) Shared-window identity re-expressed five times, never named: acquire_shared_segment lookup (:1368-1373), find_reusable_window field compare (:1578-1583), demand map key (PathBuf,u32,usize,bool) + inner Vec<(Header,usize)> linear scan in build_pending_demand (:1647-1679), same key rebuilt in pick_next_pending_plan (:1705-1718), and twice in the decrement blocks (:1890-1899, :1996-2006). Header derives PartialEq/Eq only, no Hash (selene/src/shared/record.rs:136-154). Fix: one WindowKey { path: Arc<Path>, expected/digest, first, count, row } next to SharedWindowId/SharedSegmentId (:1000-1003).

C) Per-pump alloc + quadratic scan in the attach path: PathBuf clone per pending plan (:1668), per candidate in pick_next_pending_plan (:1710), again in both decrement blocks; find_reusable_window scans every shared_windows value per pending plan (:1576-1599) and is called from find_best_existing_window_for (:1602-1624) inside the attach loops. The PR itself adds the indexed precedent (pending_page_reads, :1030). Fix: HashMap<WindowKey, SharedWindowId> beside shared_windows, and store shared segment id / Arc in DeviceSegmentRef (:1108-1113) instead of PathBuf.

D) attach loop written twice + credit check three times: Pass 2 (:1845-1861) and Pass 4 (:1874-1903) duplicate the same needs_credit closure (record.error.is_none() && record.active.len() < WINDOWS_IN_FLIGHT, :1847-1852 and :1876-1881, again inline at :2122-2124) and the find_best_existing_window_for+attach_existing_window loop; Pass 4 only adds the demand decrement. Fix: fn has_window_credit(&self, id) -> bool and fn attach_pending(&mut self, id, demand: Option<&mut Demand>) -> bool.

E) Smaller-than-needed state: host inbound modelled as Vec with always-zero index (Owner::HostInbound(id, usize) :258, read_into inserts Owner::HostInbound(id,0) :1285, single-element vec :1293-1294, apply_disk tolerates missing segment :799-801, pump loops :875/892/978) → single Segment + Owner::HostInbound(JobId) removes Segment::reads_left (:649, decremented :832, compared :877 where self.done == self.plans.len() at :892 already covers it). PlanState::Done (:1093-1098) is never branched on — every read is != Pending (:1606, :1660, :1698) or == Pending (:1796); Done is only assigned (:1833) — a started: Vec would do. SharedWindow duplicates segment identity: path/expected (:1073-1074) repeat SharedSegment.path/expected (:1024-1025) and are compared at :1582-1583 plus cloned per window at :1966-1967; comparing win.segment == seg_id would drop both fields. Also SharedWindow.id/SharedSegment.id duplicate their HashMap keys (:1071 vs :1961).

F) Test-only counters: disk_opens/disk_window_reads/coalesced_windows fields on always-compiled Resources with #[cfg_attr(not(any(test, feature="test-support")), allow(dead_code))] (:192-200; the only three uses of that attribute in selene/src — verified by search). Crate convention is to compile the whole member out: selene/src/disk.rs:104-116 Faults under #[cfg(any(test, feature="test-support"))]. Accessors already gated (:1213-1236). They also exist outside StoreStats (selene/src/store.rs:185-244), the crate's declared home for counters; StoreStats has disk_records/disk_bytes/inbound_rate/outbound_rate but no physical-open or coalesced-window counters, and docs:1501-1502 gates qualification on store counters. Fix: gate the fields; consider a follow-up adding disk_opens/coalesced_windows to StoreStats.

#9 [high] DELIVERABLE: full report for PR #496

========================================================= FULL REPORT — PR #496 (head f9c9191, base main, +2808/-914)

BLOCKERS

  1. Resolve the 61.3K deterministic retrieval result before merge.

SHOULD FIX

  1. Coalesced reads double-count bytes into the measured inbound rate, which prices future restores.
  1. Docs and rustdoc overstate the mechanism and drop the invariant that licenses it.
  1. Tie the benchmark to the code under review, and stop presenting expected costs as results.
  1. One window planner, one window identity.
  1. Remove the per-pump allocation and quadratic scan in the attach path, and the duplicated attach loop.
  1. Record the design decision for the new shared inbound lifecycle.

NITS

  1. Staged::close under-reports abandoned work (selene/src/disk_store.rs:2485-2489 vs busy() :2344-2351). It sums the four job pipelines then takes .max(usize::from(self.busy())), and busy() is also true for a non-empty shared_segments, shared_windows or owners — a leaked window or segment alone reports "1 disk transport jobs did not complete". The old code counted owners.len() (main selene/src/disk_store.rs:1419). Count owned disk jobs, or reword the message to what is counted.
  2. The three new counters are compiled into release behind #[cfg_attr(not(any(test, feature = "test-support")), allow(dead_code))] on the fields (:192-200) while their accessors are already cfg-gated (:1213-1236); the only three uses of that attribute in selene/src. The crate's convention is to compile the member out (selene/src/disk.rs:104-116 Faults). Gate the fields and increments the same way. Related: disk_opens / disk_window_reads / coalesced_windows live outside StoreStats (selene/src/store.rs:185-244), the declared home for counters that docs:1501-1502 gates qualification on — worth a follow-up adding disk_opens and coalesced_windows there.
  3. GatedCopier returns a positional four-tuple of Arc<Mutex<..>> handles that every call site destructures (:8059-8064, :8364, :8488, :8608), where the crate's fixtures in selene/src/testing.rs (StoppedCopier :178, SimulatedGpu :225) return named two-element pairs; six coalescing tests also repeat the same pool/store construction although write_shared_ancestor_tree (:8136) and poll_all_fetches (:8172) already exist. Use a named struct and one store_for_fixture helper.
  4. Redundant state to drop: PlanState::Done is never branched on — every read is != Pending (:1606, :1660, :1698) or == Pending (:1796) and Done is only assigned (:1833), so a started flag suffices. HostInbound is a Vec<Segment> of length one with an always-zero index (Owner::HostInbound(JobId, usize) :258, :1285, :1293-1294, tolerant lookup :799-801) — a single Segment and Owner::HostInbound(JobId) removes the index and Segment::reads_left (:649, :832, :877). SharedWindow.path/.expected (:1073-1074) duplicate SharedSegment's (:1024-1025) and are cloned per window (:1966-1967); comparing win.segment would drop both. The id fields on SharedWindow/SharedSegment duplicate their map keys (:1071 vs :1961, :1022).
  5. Naming axis mixing and long-sentence prose: records are named by destination (HostInbound :759, DeviceInbound :1117) but windows by sharing discipline (HostWindow :746, SharedWindow :1070), so a reader must check both axes to pair them (PrivateWindow/SharedWindow or Host/Device); and the new §2.4 sentence carries three behaviours where the surrounding section uses one sentence each.

WHAT WAS CHECKED AND FOUND SOUND (no action)

Slot lifetime and release (single release point sweep_shared_windows :1755-1771; segment removal only when no users and settled :2213-2230; per-test assertions pool.free_slots() == pool.slot_count()); failure isolation (record.fail :1563-1565, fail_segment_users :1449-1473, fail_window :1475-1487, with_record_read :1503/:1540, Fetched still routes record_read to index.drop_row :3634-3640); the host path is behaviourally unchanged (plan_windows :1283, HostWindow slicing :914-923, unwind :976-996); keeping read_into off the shared path is the right call for caller-owned buffers; no existing shared-handle/demand mechanism was duplicated; no record-format, Header, on-disk or re-export change, so existing checkpoint files load unchanged; no flags, env vars, config knobs, cfg-gated production paths or per-model branches, so the AGENTS.md rejection criteria (171-187) are not tripped; the tests exercise real paths (SimulatedGpu byte-exact, counters incremented at the real submit sites) per AGENTS.md:194-199; the 8-pass ordering argument is justified per pass; the size is not churn.

#10 [high] DELIVERABLE: summary report / GitHub post for PR #496

========================================================= SUMMARY REPORT — PR #496 (GitHub post, ≤10 bullets)

Reviewed head f9c9191 against main (+2808/−914, selene/src/disk_store.rs + docs/prefix-cache-offload.md). The approach belongs in the repository (measured, served-workload speedup; no flags, no format change, failure isolation preserved) and the lifetime work is sound. One blocker, then mostly accounting, docs and duplication.

Blockers

Should Fix

Nits

#12 [high] DELIVERABLE (final): summary report / GitHub post for PR #496

========================================================= SUMMARY REPORT — PR #496 (GitHub post, 10 bullets max) Case file: https://autobot.eidonix.com/api/v1/cases/774e16ea-5f84-4ff8-9166-74ab6876cc37.html Head f9c9191 vs main, +2808/−914 (selene/src/disk_store.rs, docs/prefix-cache-offload.md).

Opener (1-2 sentences): The approach belongs in the repo — a measured, served-workload speedup with no new flags, no format change, and failure isolation preserved — and the shared-window lifetime work holds up under review. One thing must be resolved before merge; the rest is accounting, docs and duplication.

Blockers

Should Fix

Nits

Closing line: Everything else checked out — slot lifetime and release, failure isolation, the unchanged host path, no format or re-export change, real-path tests. Full detail is in the case file.

#13 [high] DELIVERABLE (final, 10 bullets): summary report / GitHub post for PR #496

========================================================= SUMMARY REPORT — PR #496 (GitHub post; hard cap: 10 bullets = 1 blocker + 5 should-fix + 4 nits) Case file: https://autobot.eidonix.com/api/v1/cases/774e16ea-5f84-4ff8-9166-74ab6876cc37.html Head f9c9191 vs main, +2808/−914 (selene/src/disk_store.rs, docs/prefix-cache-offload.md).

Opener: The approach belongs in the repo — a measured, served-workload speedup with no new flags, no format change and failure isolation preserved — and the shared-window lifetime work holds up under review. One thing must be resolved before merge; the rest is accounting, docs and duplication.

Blockers

  1. Settle the 61.3K retrieval result, or declare it inconclusive. The description reports 8/9 on main vs 7/9 with this change on a temperature=0 retrieval prompt, and draws no conclusion. Re-run it a few times on both revisions and report the variance and the differing fact; fix it if the gap holds, otherwise move the check under "Not covered" as inconclusive (and add a follower-attaches-to-a-partial-aligned-window byte-exactness test, which is the narrow plausible site).

Should Fix

  1. inbound_rate is now measured on logical bytes, and the error does not self-correct. Each follower credits the whole shared window to its own record (:1829), so the rate sample divides coalesced elapsed time into a ~4x byte count; hit() prices restores off that rate and worth_fetching gates on it, and because the median stays above its seed until three more samples arrive it mis-prices subsequent restores. Fix: one rate sample per physical window, bytes_in stays logical and documented, plus a 1-vs-8-restore rate test.
  2. Docs and rustdoc claim more than the mechanism. §2.4 needs the two limits the description already discloses, the immutable+pinned invariant, WINDOW_PAGES file-boundary alignment and the real write_from/read_into signatures; the module doc still says "at most WINDOWS_IN_FLIGHT windows" and "Nothing here waits"; the allocate rustdoc now sits on free_slots (:228-234).
  3. Tie the benchmark to head; do not state expectations as results. The table predates the demand-index/close-count edits — re-run one simultaneous and one staggered TP1 trial at head, or label the table's commit — and mark "existing users pay per-pump demand indexing…" as an expected bound that applies only to multi-fetch pumps (:1651-1653).
  4. One planner, one window key. plan_aligned_windows is plan_windows plus one clamp (fold them); the sharing key (path, header, first, count, row) is hand-written five times (:1368, :1578, :1647, :1710, :1890/:1996) — name it WindowKey and index it, which also removes the per-pump PathBuf clones and the O(windows×plans) find_reusable_window scan.
  5. De-duplicate the attach loop and record the design call. Pass 2 and Pass 4 repeat the same credit predicate and attach loop (:1845-1861, :1874-1903) — extract has_window_credit/attach_pending; and get a recorded maintainer decision for placing a second inbound lifecycle (host vs device) inside Staged rather than in the disk thread that already owns the handle.

Nits

  1. Staged::close counts leaked shared windows/segments into "N disk transport jobs did not complete" (:2485-2489) — count owned jobs or reword the message.
  2. Test hygiene: gate the three new counters like disk.rs's Faults (:192-200) instead of allow(dead_code) and consider surfacing disk_opens/coalesced_windows in StoreStats; GatedCopier returns a positional four-tuple (:8059) where this crate's fixtures return named pairs, and six tests repeat the same fixture construction.
  3. Drop state nothing branches on: PlanState::Done (:1093, :1833), HostInbound's single-element Vec<Segment> with an always-zero index (:1285), SharedWindow.path/.expected duplicating its segment (:1073), and id fields duplicating their map keys.
  4. Naming mixes axes (HostInbound/DeviceInbound vs HostWindow/SharedWindow); split the new 60-word §2.4 sentence into one behaviour per sentence.

Closing: Everything else checked out — slot lifetime and release, failure isolation, the unchanged caller-owned host path, no format or re-export change, and tests that exercise the real path. Full detail and evidence are in the case file.

#14 [high] Research summary

Both deliverables are written to the scratchpad.

Full report (entry 9, with addendum entry 11): Blockers (1) — the PR's own evidence reports 8/9 on main vs 7/9 with this change on a temperature=0 retrieval prompt at 61.3K, undiagnosed; ask for a repeat run and either a fix or an explicit "inconclusive" under Not covered. Should Fix (6) — coalesced logical bytes inflate inbound_rate, which is the divisor DiskStore::hit prices restores with and worth_fetching gates on (Rate keeps the median and only decays below its seed, so the error persists); docs §2.4 and the module doc overstate the mechanism, omit the two limits the description discloses and the immutable+pinned invariant, and keep two non-existent signatures, plus a misplaced allocate rustdoc now on free_slots; the benchmark table predates head and an unmeasured expected cost is stated as a result; plan_aligned_windows duplicates plan_windows and the sharing key is hand-written five times; per-pump PathBuf clones and an O(windows×plans) scan plus a doubled attach loop; and a request for a recorded maintainer decision on placing a second inbound lifecycle inside Staged. Nits (5) — close() under-reports abandoned jobs, test-only counters ungated and outside StoreStats, GatedCopier's positional 4-tuple, dead state (PlanState::Done, single-element Vec<Segment>, duplicated window fields/ids), naming-axis mixing and a 60-word sentence. A "checked and sound" list is included so the author is not asked to change what holds up.

Summary report (entry 13): exactly 10 bullets — 1 blocker, 5 should-fix, 4 nits — each one line of finding plus a tldr request, with a case-file link, an opener acknowledging the change belongs in the repo, and a closing pointer to the case file for evidence. Verdict: not mergeable as is, but close — the design and lifetimes are sound and the remaining work is one unresolved measurement, one accounting fix, docs, and de-duplication.

#15 [high] Limits of this review / open questions the author must answer

Honest scope of the review behind entries 1-13. No compiler, GPU or test run was available: every finding is established from source, not from executing anything. cargo build/test was not run, so the claim that the three allow(dead_code) attributes are unnecessary (nit 2 of the full report) rests on the crate's convention (selene/src/disk.rs:104-116) rather than on a warning-free build; the author can confirm with cargo build --release --manifest-path selene/Cargo.toml.

Not reviewed / not verified:

Three responses the author may give that would close findings cleanly: (a) re-runs showing the 61.3K gap is noise; (b) a maintainer sign-off on the Staged-side lifecycle; (c) confirmation that plan_windows was kept segment-relative for host reads deliberately (a one-line comment would then settle the duplication request).

#18 [high] At head 0c04b1e2: last round's blocker and 5 of 6 should-fixes are resolved

Verified at head 0c04b1e2 (base c0c4f798), 3 files +3358/−933.

RESOLVED — blocker B1 (8/9 vs 7/9 at 61.3K): author re-ran 5 cold-VRAM repeats (seed 1234..1238, 60,534 tokens, top_logprobs=5) against one shared disk checkpoint; main and head produced identical FP32 top-5 logprobs and token IDs on all 5 (6/9, 8/9, 7/9, 9/9, 4/9). Explained: Flare has no greedy temperature=0 (helios clamps into the core's positive sampling range) and the earlier single-pass script used distinct per-build prompt nonces. Added misaligned_follower_attaching_to_shared_partial_tail_and_row_matches_private_restore (byte-equal SimulatedGpu pages/row vs private baseline, skip_pages=13, partial <64 tail + partial leaf chunk with row). PR discussion 2026-11-25 02:41.

RESOLVED — S1 inbound_rate: InboundWindowSample { bytes, elapsed } carries only physical window read_bytes/read_elapsed (disk_store.rs:1596-1620, sample pushed :1617-1620); DiskStore::apply early-returns into self.inbound_rate.observe (:3632-3635) before stats.progress += 1; stats.bytes_in stays logical (:3669); the old per-record observe in the Fetched arm is gone. Test coalesced_restores_keep_inbound_rate_physical_and_bytes_in_logical (1 vs 8, simultaneous + staggered). Docs state the split (docs:362-366, :1528-1531).

RESOLVED — S3 benchmark provenance: table now keyed main c0c4f798 vs 0c04b1e2; costs labelled "As an expected bound" with the device_inbound.len() <= 1 fast path noted; un-rerun multi-host RoCE moved to Not covered.

RESOLVED — S4/S5: plan_windows(segments, align_to_window) (:679-727) replaced the twin splitters; HeaderIdentity/SegmentKey/WindowKey (:1001-1064) + window_index HashMap give O(1) find_reusable_window (:1646-1663); has_window_credit (:1683-1687) and attach_pending (:1711-1730) replaced the duplicated attach loops.

RESOLVED — nits: counters now #[cfg(any(test, feature = "test-support"))] (:200-208, accessors :1279-1295); PlanState::Done → started: Vec<bool>; SharedWindow.path/.expected removed (holds segment+key); allocate rustdoc back on allocate (:241-243) and free_slots has its own line (:236-239); module doc rewritten (:7-27) with per-fetch window credits, follower sharing, close-before-Fetched.

RESOLVED — S6 (partly): the Staged-vs-DiskThread rationale is now argued in the PR Why ("DiskThread sees only file offsets and raw host addresses and finishes once direct I/O and xxh3 complete, whereas shared staging slots must stay pinned until every follower's async Copier upload completes"). Remaining ask is only a maintainer record of the decision (AGENTS.md:204-206), not a code change.

Cross-lens verdict: architecture, simplicity and correctness lenses all report NO blocking findings at this head.

#19 [high] New findings created by this revision (head 0c04b1e2)

  1. HeaderIdentity hand-writes Hash (SHOULD FIX). disk_store.rs:1001-1050; impl Hash at :1014-1050 destructures Header with .. (:1030) and hashes 14 fields. The equality contract it must track lives in another module: impl PartialEq for Header at shared/record.rs:136-152 (exhaustive list), impl Eq :154; Header defined :116-134 with private version excluded (:118-119) — correctly excluded here. Adding a Header field → compile error in record.rs but NOT here; the field silently drops out of the hash, two equal headers hash differently, window_index.get misses, coalescing silently stops — perf regression, no test failure, nothing pins hash/eq agreement. Also the ONLY hand-written Hash in selene/src (crate precedent is derive: PrefixKey vocab.rs:30; RankSizes record.rs:89; DiskRecord disk_store.rs:72; SegmentKey/WindowKey :1052/:1058). Simplicity lens: could hash only self.0.key (PrefixKey derives Hash, unique per record); collisions only cost a bucket, PartialEq still compares the whole header.

  2. TransportEvent::InboundWindowSample rides the cross-rank completion enum (SHOULD FIX). Enum doc says "Completion the transport reports to the disk store" (:83); every other variant carries a JobId. Consequences: (a) Kind::of must panic — shard.rs:476-478 unreachable!("window rate samples stay local to rank zero"), whereas the enum's own convention for unrepresentable kinds is Err(invalid(..)) (shard.rs:462); (b) that panic is upheld only by two hand-written guards — absorb_local shard.rs:722-725 pushes and continues, Peer::forward shard.rs:1148-1150 drops; (c) the existing test helper events.sort_by_key(|event| Kind::of(event).1) at shard/tests.rs:339 would panic if a fetch ran in those tests (survives only because they issue stores/unlinks); (d) test helpers must filter it by hand (disk_store.rs:6341) and tests match it out explicitly (:9145). CONCRETE COST: CompositeStore::poll does self.stats.progress += 1 for EVERY transport event before dispatch (composite.rs:1376), and that counter is documented as "Completion and capacity-release events" (store.rs:202) and gates the maintenance pass — maintenance_progress != progress → spill_parked(...) + self.disk.maintain() (composite.rs:1418-1424). Each physical window read now bumps progress and re-runs both, once per window per restore. DiskStore::apply deliberately does NOT bump progress for it (:3632-3636), so the two stores' progress counters diverge. Fix: carry the sample out of band (a Staged drain method, a field on Fetched, or a counter the store reads — precedent Budget::progress() input.rs:146-152), and exclude it from composite.rs:1376.

  3. pick_next_pending_plan restates Layout::record_slots (SHOULD FIX). disk_store.rs:1766-1777: let layout_row_slots = ...layout().row_slots(); let needed = plan.count + if plan.row { layout_row_slots } else { 0 };. record_slots(pages, row) = pages + usize::from(row) * row_slots() exists at geometry.rs:180-182 and is used by Resources::allocate (disk_store.rs:245), memory.rs:468, composite.rs:810/:1167. The admission guard predicts what allocate will do with a different formula, so they can diverge. Secondary: lock(&self.resources.transfers) taken once per candidate record per pump iteration and again right after by allocate (:1987). Fix: let needed = lock(&self.resources.transfers).layout().record_slots(plan.count, plan.row); hoisted next to free.

  4. §2.4 docs (SHOULD FIX, down from wider doc ask). docs/prefix-cache-offload.md:337-366 is now ONE ~30-line/250-word bullet carrying ~12 facts (signatures, shared handle, WINDOW_PAGES alignment, per-follower upload, slot lifetime, read_into isolation, immutability+pin invariant, close-before-Fetched, demand scheduling, live-window limit, extra-partial-window bound, error scope, two metrics). Content is now accurate and complete — the earlier asks are all met (see note on resolutions). What remains: repo-prose (.agents/skills/repo-prose/SKILL.md:71,:84) wants ordinary readable sentences; AGENTS.md:52-60 gives a document one purpose. And the bytes_in/inbound_rate contract is stated TWICE — docs:362-366 and again at :1528-1531 in §4. Keep the behavioural half in §2.4, the measurement statement only in §4, with a pointer.

  5. NIT — inbound_rate now measures pure disk-thread time. disk::Reply.elapsed is set only around worker.execute(job) (disk.rs:448-450) — one O_DIRECT read + xxh3, no wait for a free slot, no copier queue time, no GPU upload. Previously the rate was record bytes over job.started.elapsed() from DiskStore::fetch to Fetched (that field is gone; Fetched now only does stats.bytes_in += bytes, :3669). Since hit() divides by the rate (estimated_seconds: bytes / self.inbound_rate.get().max(1.0), :3625) and worth_fetching/worth_transfer gate on it (store.rs:422-438), restore estimates are now optimistic by the staging/upload share even for a single restore — the opposite direction from the inflation this revision fixed. CompositeStore prices the disk part on its own disk_inbound_rate observed from read_into completions over disk_started.elapsed() (composite.rs:994-1004), so the two stores measure different quantities under the same name.

  6. NIT — Staged::close abandoned no longer matches its message (disk_store.rs:2513-2544). internal = max over owners.len(), maintenance.len(), shared_segments.len(), shared_windows.len() (:2522-2527); abandoned = store_jobs.max(internal) (:2528) reported as "{abandoned} disk transport jobs did not complete" (:2541-2543). Map sizes are not jobs; maintenance_jobs is derived from owners (:2513-2517) and owners.len() is folded into internal, so maintenance is double-counted. Previously it was owners.len(), one entry per owned disk job — what the message says. Correctness lens still rates this resolved (no under-report); simplicity/conventions lens rate it a message-vs-count nit.

  7. Other nits: dead guard if demand.is_empty() { 0 } else { ... } at :1781-1787 (map_or(0) already yields 0); memory.rs::windows() (:1333-1367) is now the last surviving third copy of the WINDOW_PAGES splitter vs plan_windows (:679-727); two different settled() predicates in one file — Segment::settled (:661-664, file-handle terminal state) vs SharedSegment::settled (:1106-1109, disk jobs drained); three verbatim "unindex iff the index still points at it" blocks (:1525-1527, :1543-1545, :1837-1839); two identical follower-detach retain closures (:1813-1816, :1900-1904) matching on the (record, plan_index) pair that is WindowFollower's identity (:1119-1123); SharedSegment.id/SharedWindow.id duplicate their HashMap keys (:1083, :1131); disk_read_counted flags exist only to make a test counter count windows not jobs (:743, :1140, six cfg blocks); HostInbound is a one-element Vec<Segment> with an always-zero index plus a redundant Segment::reads_left; GatedCopier::wrap returns a positional 4-tuple (:8092-8122) vs the crate's named pairs in testing.rs.

  8. Description nits (prose lens): (a) "Emit one InboundWindowSample per completed physical window read" — the sole emitter is the shared device-fetch path; caller-owned read_into emits none, so scope the sentence; (b) Flash-Next Read Reduction values 3.99x/3.52x do not match the MB columns (ratio of tabulated means is 4.010/3.535) and the caption does not say whether the column is a ratio of means or a mean of per-trial ratios; (c) "No core re-export or format change is required" is true for re-exports, but TransportEvent is a public enum in a public module and gained a variant — say so. All four TTFT percentage deltas check out; the 27B rows' 4.22x/3.76x check out.

#20 [high] DELIVERABLE (final): full report for PR #496 at 0c04b1e2

========================================================= FULL REPORT — PR #496 "Coalesce shared ancestor reads across concurrent Selene disk fetches" Head 0c04b1e2, base main c0c4f798 · 3 files, +3358/−933 (selene/src/disk_store.rs, selene/src/shard.rs, docs/prefix-cache-offload.md) Case file: https://autobot.eidonix.com/api/v1/cases/774e16ea-5f84-4ff8-9166-74ab6876cc37.html

VERDICT

No blockers. The change belongs in the repository, is in the right layer, and its evidence is the kind the charter demands. Every blocker and should-fix from the previous round is either fixed at this head or has been narrowed to a small follow-up. What remains are four code/doc improvements worth making before merge (or in a fast follow) and six nits.

RESOLVED SINCE THE PREVIOUS ROUND (do not re-raise)

BLOCKERS

None.

SHOULD FIX

1. A rank-local rate sample was added to the cross-rank completion enum, and it amplifies the composite's maintenance cadence

Finding. TransportEvent::InboundWindowSample { bytes, elapsed } (disk_store.rs:97-101) was added to the enum whose own doc reads "Completion the transport reports to the disk store" (:83), where every other variant is a job completion carrying a JobId. This one carries no id — it is a per-window bandwidth sample for Staged's own rate. Consequences:

Request. Carry the sample out of band instead of as a completion variant: a Staged drain method for a pair of window byte/elapsed accumulators (the store already reads Staged state directly for in_flight() and pool()), a field on the existing Fetched event for the coalesced case, or the crate's existing precedent for a rate signal that is not an event (Budget::progress(), selene/src/input.rs:146-152). Whichever shape, exclude it from CompositeStore's stats.progress so that counter means "completions". A test asserting Kind::of is total over every TransportEvent (or a property test over the enum) would settle the panic path permanently; today only reading the two guards shows it.

Why. This is "solve the right problem in the right place" and "reject unsupported abstractions" (charter line 9; AGENTS.md:188-193). A variant with no job id is not a transport completion, and adding it makes the cross-rank protocol mapper responsible for a rank-local statistic: Kind::of goes from total to partially defined over its own input domain, with its totality depending on two guards far away from it. The fix needs no new machinery. Note the mechanism is correct and is not in question — physical-rate observation, the vanished per-record observe, and the two rank guards are all right; this is about where the signal is carried. It is also what the description's "No core re-export or format change is required" overlooks: TransportEvent is a public enum in a public module and gained a variant.

2. HeaderIdentity hand-writes Hash, duplicating an equality contract defined in another module

Finding. HeaderIdentity(Arc<Header>) implements PartialEq by delegation with an Arc::ptr_eq fast path (disk_store.rs:1006-1010), then writes Hash by hand: it destructures Header, hashes fourteen fields one at a time, and the destructure ends in .. (:1014-1050, .. at :1030). The contract it must mirror is exhaustive and lives 1,200 lines away in a different module — impl PartialEq for Header (selene/src/shared/record.rs:136-152), Header defined :116-134, impl Eq :154, private version excluded at :118-119 (correctly excluded here too). Adding a field to Header therefore produces a compile error in record.rs but not here: the new field silently drops out of the hash, two headers that compare equal hash differently, window_index.get(&key) misses, and coalescing silently stops working — a performance regression with no test failure, since nothing in the suite pins hash/eq agreement.

It is also a convention departure: a repository-wide search for impl (std::hash::)?Hash for in selene/src returns exactly this one hit. The crate derives instead: PrefixKey derives PartialEq, Eq, Hash, PartialOrd, Ord (selene/src/vocab.rs:30), RankSizes derives (shared/record.rs:89), DiskRecord derives (disk_store.rs:72), and this PR's own SegmentKey/WindowKey derive (disk_store.rs:1052, :1058). The manual impl exists only because Header does not derive Hash. Separately, HeaderIdentity restates Header identity where the PR already has a per-record unique key: Header.key is a PrefixKey, which derives Hash, and the path is derived from it.

Request. Move the hashing next to the equality it must track: impl Hash for Header in shared/record.rs (same field list, version still excluded), and let SegmentKey/WindowKey derive. Then HeaderIdentity disappears and the two contracts cannot drift. Minimum acceptable alternative if the author prefers the wrapper: impl Hash for HeaderIdentity { fn hash<H: Hasher>(&self, state: &mut H) { self.0.key.hash(state) } } — Hash need only be consistent with Eq, not complete; collisions only cost a bucket because PartialEq still compares the whole header — plus a comment saying why the full field list was chosen. Either way, add the missing a == b ⇒ hash(a) == hash(b) property test.

Why. A Hash that must be hand-kept in step with an equality defined elsewhere, using a non-exhaustive pattern so the compiler cannot help, is exactly the "duplicate representation" docs/design-review.md:74 asks a change to account for — and the failure mode is silent and performance-only, which is the class of bug this PR's own benchmark is designed to catch.

3. pick_next_pending_plan restates Layout::record_slots instead of calling it

Finding. disk_store.rs:1766-1777 computes the slot cost of a candidate window by hand:

let free = self.resources.free_slots();
let layout_row_slots = self.resources.pool.as_ref()
    .map(|_| lock(&self.resources.transfers).layout().row_slots())?;
...
let needed = plan.count + if plan.row { layout_row_slots } else { 0 };

Layout::record_slots(pages, row) already encodes exactly this — pages + usize::from(row) * self.row_slots() (selene/src/geometry.rs:180-182, row_slots :173-178) — and it is the crate's single definition of what a record costs in staging slots: Resources::allocate uses it (disk_store.rs:245), as do memory.rs:468 and composite.rs:810/:1167. This admission guard exists to predict whether allocate will succeed (:1778); expressing the prediction with a different formula means the guard can disagree with the allocator, and it will the moment record_slots learns to account for anything beyond pages + row. Secondary: lock(&self.resources.transfers) is taken once per candidate record per pump iteration here and then immediately again by allocate (:245).

Request. let needed = lock(&self.resources.transfers).layout().record_slots(plan.count, plan.row);, hoisted next to free outside the plan loop; drop if demand.is_empty() { 0 } else { ... } at :1781-1787 (see Nit 3).

Why. A guard that predicts the allocator must use the allocator's own arithmetic; two formulas for one cost is a latent mismatch, and the crate already has the helper.

4. The new §2.4 bullet is one 250-word paragraph and states the metrics contract twice

Finding. docs/prefix-cache-offload.md:337-366 is a single 30-line bullet carrying roughly twelve facts: the write_from/read_into signatures, the shared open handle, WINDOW_PAGES file-boundary alignment, per-follower GPU upload, slot lifetime, read_into independence, the immutability+pin invariant, close-before-Fetched, sibling-demand scheduling, the live-window limit, the extra-partial-window bound, error scope, and the two metrics. Its content is now accurate and complete — every earlier doc ask is met. What remains is shape and duplication: .agents/skills/repo-prose/SKILL.md:71/:84 ask for ordinary readable sentences and no "you had to be there" density, and AGENTS.md:52-60 gives a document one purpose at a time, whereas this mixes mechanism, correctness invariant, scheduling heuristic and metrics. The bytes_in/inbound_rate contract is also stated twice — docs:362-366 and again nearly verbatim at :1528-1531 in §4 — and one contract in two homes is what drifts.

Request. Keep one paragraph of mechanism in §2.4 (shared handle; aligned WINDOW_PAGES fan-out to every attached upload; independent read_into), move failure scope and the two limits to a short bullet list in the style of :333-336, keep the metrics statement only in §4 (:1528-1531) and leave a pointer from §2.4.

Why. This is the paragraph a future reader will trust to learn the transport's contract; a run-on makes three distinct behaviours look like one mechanism, and duplicated prose drifts (AGENTS.md:43-49 prose review; design-review principle 16: write without hidden context).

5. Record the design decision for the new shared inbound lifecycle (process, not code)

Finding. The change replaces Staged's single inbound lifecycle — the invariant behind "Nothing here waits" — with two (host vs device) inside shared cache machinery: a five-state shared-file machine, reference-counted shared windows with separate disk and upload counts, out-of-order plan completion, and a close-only-when-settled rule (disk_store.rs:1066-1160, :1824-2278). The PR Why now argues the choice on technical grounds — DiskThread sees only file offsets and raw host addresses and finishes once direct I/O and xxh3 complete, whereas SlabPool slots must stay pinned until every follower's asynchronous Copier upload completes — which discharges the design-review ask in substance. What remains is that an invariant this central not be settled implicitly by merge (AGENTS.md:204-206).

Request. Get a recorded maintainer sign-off on doing the coalescing inside Staged rather than inside the disk thread that already owns the file handle. No code change is requested.

Why. The technical content held up under review, but a change of this shape to shared cache invariants should rest on a recorded decision rather than on review-time inference.

NITS

1. inbound_rate now measures pure disk-thread time, so estimated_seconds prices restores optimistically

disk::Reply.elapsed is set only around worker.execute(job) (selene/src/disk.rs:448-450) — one O_DIRECT read plus xxh3, with no wait for a free slot, no copier queue time and no GPU upload. Before this revision the rate was observed as record bytes over job.started.elapsed() from DiskStore::fetch to Fetched, spanning queueing and the upload; that field is gone and the Fetched arm now only does stats.bytes_in += bytes (disk_store.rs:3669). Since hit() divides by the rate (estimated_seconds: bytes as f64 / self.inbound_rate.get().max(1.0), :3625) and worth_fetching/worth_transfer gate on it (store.rs:422-438), restore estimates are now optimistic by the staging/upload share even for a single restore — the opposite direction from the inflation this revision fixed. CompositeStore prices its disk part on its own disk_inbound_rate observed from read_into completions over disk_started.elapsed() (composite.rs:994-1004), so the two stores measure different quantities under one name. Request: either document inbound_rate explicitly as device read bandwidth and keep a separate end-to-end restore estimate for estimated_seconds, or include the per-record wait in the sample. A test comparing estimated_seconds against a measured single-restore wall time would settle it.

2. Staged::close's abandoned count no longer matches its message

disk_store.rs:2522-2544: internal is a .max() over owners.len(), maintenance.len(), shared_segments.len() and shared_windows.len(), and abandoned = store_jobs.max(internal) is reported as "{abandoned} disk transport jobs did not complete". shared_segments/shared_windows are map sizes, not jobs — one leaked shared window in an otherwise idle store yields abandoned == 1 and a claim that a disk transport job did not complete — while four abandoned outbound jobs plus six leaked windows reports six. maintenance_jobs is also counted twice: it is derived from owners (:2513-2517) and owners.len() is folded into internal. Previously the number was owners.len(), one entry per owned disk job, which is what the message says. Request: keep the message counting owners.len(), and if leaked staging state is worth catching, report it separately ("{n} shared windows/segments leaked").

3. Repeated blocks, duplicate fields and state nothing branches on

4. memory.rs::windows() is now the last surviving third copy of the splitter, and GatedCopier breaks the fixture convention

5. PR description nits

CHECKED AND SOUND (no action requested)

OPEN QUESTIONS

#21 [high] DELIVERABLE (final): summary report / GitHub post for PR #496 at 0c04b1e2

========================================================= SUMMARY REPORT — PR #496 (GitHub post; 10 bullets = 5 should-fix + 5 nits, no blockers) Head 0c04b1e2 vs main c0c4f798 · 3 files, +3358/−933 Case file: https://autobot.eidonix.com/api/v1/cases/774e16ea-5f84-4ff8-9166-74ab6876cc37.html

Recommendation: Approve with Should-Fix (no blockers)

The last round's blocker and five of six should-fixes are resolved at 0c04b1e2, and the 61.3K parity gap closed cleanly: five cold-VRAM repeats against one shared 60,534-token checkpoint gave identical FP32 top-5 logprobs and token IDs on main and at head, the sampling-mode cause is named, and a byte-exact misaligned-follower test now pins the only plausible defect site. The change belongs in the repo, adds no flags, changes no format, and keeps failure isolation. What is left is small: one layering fix, one maintainability fix, one arithmetic restatement, docs, and a recorded design sign-off.

Should Fix

Nits

Closing: everything else checked out — slot and file lifetimes, failure isolation, the unchanged caller-owned host path, no format or re-export change, and tests that assert byte-exact GPU pages at the real submit sites. Evidence and per-angle detail are in the case file.

#22 [high] Research summary

I reviewed the new head 0c04b1e2 against last round's report and wrote both deliverables to the scratchpad: entry #20 (full report) and entry #21 (summary report / GitHub post), with supporting notes in #18 (resolutions) and #19 (new findings).

Verdict changed from "Changes Requested" to "no blockers". Last round's single blocker — the 8/9 → 7/9 retrieval result at 61.3K — is genuinely closed: five cold-VRAM repeats against one shared 60,534-token checkpoint produced identical FP32 top-5 logprobs and token IDs on main and at head (6/9, 8/9, 7/9, 9/9, 4/9), the sampling-mode cause is named (Flare has no greedy temperature=0; distinct per-build prompt nonces), and the narrow plausible defect site is now pinned by a byte-exact misaligned-follower test. Five of six should-fixes are also fixed in code, which I verified line by line: InboundWindowSample carries only physical window bytes and bytes_in stays logical; plan_windows(.., align_to_window) replaced the twin splitters; WindowKey/window_index and has_window_credit/attach_pending removed the duplication; the benchmark is keyed to the head commit; the counters are cfg-gated; the module doc, allocate rustdoc and module contract are corrected.

Four should-fix findings are new at this head, created by those fixes: (1) InboundWindowSample was added to the cross-rank completion enum, forcing an unreachable!() in Kind::of upheld by two hand-written guards and making CompositeStore::poll bump stats.progress — and so re-run spill_parked + disk.maintain() — once per physical window; (2) HeaderIdentity's 37-line hand-written Hash restates Header's PartialEq from another module through a .. pattern, so a new field silently breaks coalescing with no test failure, and it is the only manual Hash in selene/src; (3) pick_next_pending_plan recomputes pages + row_slots by hand instead of calling Layout::record_slots, which the allocator it predicts does call; (4) the new §2.4 bullet is one 250-word paragraph stating the metrics contract twice. A fifth should-fix is process-only: a maintainer should record the Staged-vs-DiskThread decision (no code change requested). Five nits follow, led by inbound_rate now measuring pure disk-thread time, which makes estimated_seconds optimistic in the opposite direction from the inflation just fixed.

The summary report is 10 bullets — no blocker section, 5 should-fix, 5 nits — with one-line findings plus tldr requests and a case-file link, and it opens by acknowledging the closure of the previous round so the author knows what not to redo.

#23 [high] Evidence inventory at head 0c04b1e2 (PR description numbers the report must cite)

Supersedes the evidence in entry #1, which describes the older head f9c9191. All numbers below are from the PR description at head 0c04b1e2, base main c0c4f798.

BENCHMARK SETUP (as stated): flare run on NVIDIA GB10 (SM121), --prefix-cache-memory 0 --prefix-cache-disk /tmp/selene-disk; --max-concurrency 16 --prefix-cache-disk-limit 40G on Qwen3.8-27B-NVFP4, --max-concurrency 8 --prefix-cache-disk-limit 24G on Qwen3.8-Flash-Next. Each trial warms one ~61K-token shared prefix plus 8 child branches (~256 unique tail tokens each) to disk, restarts flare run so GPU memory starts empty, then sends 8 concurrent /v1/chat/completions follow-ups. Metric is ingress-to-first-token TTFT; 27B rows are means over 2 interleaved repeats.

TABLE (Before main -> After 0c04b1e2):

ARITHMETIC CHECK (done): all four TTFT percentages and the two 27B ratios check out. The two Flash-Next ratios do not match the MB columns — 7,944.9/1,981.1 = 4.010 and 7,958.0/2,251.5 = 3.535 — which is the description nit in entry #19 item 8(b).

RATE/LEDGER EVIDENCE: rank-0 flare_host_cache_inbound_bytes_per_second stays physical across coalesced restores — 6.07 GB/s single vs 7.71 GB/s 8-way simultaneous and 6.02 GB/s 8-way staggered on Qwen3.8-27B-NVFP4; 7.17-9.01 GB/s single on Qwen3.8-Flash-Next. flare_host_cache_bytes_in_total tracks logical restored bytes (8x single). This is the author's live confirmation that the S1 fix behaves as intended and should be acknowledged in the report as resolved.

PARITY EVIDENCE (closes the previous blocker): 5 cold-VRAM restart repeats, seed 1234..1238, 60,534 prompt tokens, top_logprobs=5, one shared disk checkpoint, main (c0c4f798) vs 0c04b1e2 on Qwen3.8-27B-NVFP4 TP1 — identical FP32 top-5 logprobs and token IDs on all 5 repeats (6/9, 8/9, 7/9, 9/9, 4/9 on a 9-fact retrieval prompt); first-token top-5 logprobs match in-VRAM GPU hits ("9" -0.756374 vs "3" -1.256374). Cross-seed score variation attributed to positive-temperature sampling because helios clamps request temperature into the core's positive sampling range and Flare does not support greedy temperature = 0. Also: four concurrent unique-prefix decode streams spilling checkpoints over 30 s on Qwen3.8-Flash-Next TP1 had 0 errors, 100.0 -> 100.6 tok/s.

SUITE COUNTS AT THIS HEAD: 476 selene tests on x86_64 and ARM64 Linux (O_DIRECT + io_uring, 0 warnings without test-support); 13 coalescing tests on Windows IOCP (full Windows selene still gated on /dev/urandom per docs/TODO.txt); 21 single-GPU SM121 helios offload:: tests (FLARE_RUN_CUDA_TESTS=1 --include-ignored; split_pools needs 2 local GPUs); pytest tests/preparation/test_core_boundary.py.

NOT COVERED (author-declared): multi-host RoCE serving, 2-GPU split_pools, discrete PCIe GPUs, Windows serving, live CompositeStore/PooledStore GPU serving.

COMPANION PR: #497, both base directly on main, merge in either order; whoever merges second reconciles Staged::pump_all so host_inbound and pump_device_inbound run ahead of writes and maintenance. Discord: Dooner present.

#24 [high] Report blueprint: structure, verdict and lens grades at 0c04b1e2

POINTERS (write the final report from these):

LENS GRADES AT THIS HEAD (from this round's agent reports):

HOW THE OLD FINDINGS MAP (so the post does not repeat itself): old blocker B1 -> resolved; old S1 bytes/rate -> resolved, replaced by the layering finding; old S2 docs -> narrowed to the paragraph-shape/duplication finding only (all content asks met); old S3 benchmark -> resolved; old S4/S5 -> resolved; old S6 -> narrowed to the maintainer-record ask; old nits 1-5 -> nit 1 is fixed in substance but re-graded to a message-vs-count nit, nit 2 and 4 largely fixed (counters gated, PlanState gone, SharedWindow fields gone), nit 3 GatedCopier remains, nit 5 naming-axis partly remains (two settled() predicates).

HONEST LIMITS to keep in the report: no toolchain, GPU or test run was available to this review — every finding is established from source at the head commit (do not claim a warning-free build was verified). Not reviewed: the ~5,300-line test module past the fixtures that were read, the #497 rebase interaction, and the five author-declared not-covered configurations. No instructions were embedded in the reviewed material.

#26 [high] CORRECTION: HeaderIdentity hash fails SAFE (collisions), not "coalescing stops" — plus live packed drift on main

VERIFIED at head 0c04b1e2 and against main.

This branch (0c04b1e2) — selene/src/shared/record.rs:116-134: Header has NO packed field. Fields: private version (:118-119, doc "not semantic identity"), identity, fingerprint, flags, key, parent, bucket, page_tokens, tail_pages, ranks, page_segment, row_segment, row_checksum, created = 13 public fields. impl PartialEq for Header (record.rs:136-152) compares exactly those 13, excludes version. impl Eq :154.

HeaderIdentity (disk_store.rs:1001-1050): PartialEq delegates Arc::ptr_eq || *self.0 == *other.0 (:1008); impl Hash (:1014-1050) destructures Header and hashes ALL 13 compared fields (identity..created), with .. at :1030 swallowing only version. So TODAY the hash covers exactly the compared field set. Correctness lens agrees: "every equality-relevant field is hashed... so a == b ⇒ hash(a) == hash(b) holds".

MY EARLIER CLAIM WAS DIRECTIONALLY WRONG. I previously wrote "a new Header field silently drops out of the hash and coalescing stops with no test failure". Wrong direction:

LIVE DRIFT ALREADY EXISTS ON main (verified, ref=main, selene/src/shared/record.rs):

Fix ask stands but reframed: implement Hash next to Header's PartialEq in shared/record.rs (so the compiler forces a decision when a field is added), let SegmentKey/WindowKey (:1052, :1058) derive, and add an a == b ⇒ hash(a) == hash(b) property test. Cheap alternative if the wrapper stays: hash only self.0.key (PrefixKey derives Hash, vocab.rs:30) — Hash need only be consistent with Eq, and collisions cost a bucket.

#27 [high] Re-verified citations at 0c04b1e2 for the final report (enum, composite gate, docs x2, geometry, close, hit)

Head confirmed unchanged: search_history shows 0c04b1e2 (FujitsuPolycom, 2026-11-23) as newest, then base c0c4f798. No new commits since the last round; PR comments show author's 2026-11-25 02:41 update to 0c04b1e2 and my 04:33/05:23 bot posts.

EVIDENCE VERIFIED THIS ROUND (all from source at 0c04b1e2):

  1. TransportEvent enum, disk_store.rs:83-110. Doc line :83 = "Completion the transport reports to the disk store." Variants Stored :86-90 (id), StoreInvalidated :92 (id), Fetched :93-96 (id), InboundWindowSample :97-101 (bytes: u64, elapsed: Duration — NO id), Truncated :102-105, Unlinked :106-109. So exactly one variant of six lacks a JobId.

  2. Kind::of, shard.rs:466-486. Every arm returns (Kind, JobId, Result<u64>). InboundWindowSample arm :476-478 = unreachable!("window rate samples stay local to rank zero"). Confirms Kind::of is no longer total over its own input domain.

  3. CompositeStore::poll, composite.rs:1365-1430. Per-event self.stats.progress += 1 at :1376 BEFORE the dispatch match (:1377-1385) — fires for InboundWindowSample too. Maintenance gate: let progress = self.stats().progress; :1418, then if !self.disk.preserve_committed && (self.maintenance_progress != progress || retry) :1420, body calls self.spill_parked(...) :1427 and self.disk.maintain() :1428. CONFIRMED: each physical window read re-arms spill+maintain.

  4. DiskStore::apply, disk_store.rs:3630-3638. if let TransportEvent::InboundWindowSample { bytes, elapsed } = event { self.inbound_rate.observe(bytes, elapsed); return; } :3632-3635 then self.stats.progress += 1 :3636, and a second unreachable!() arm :3638. Confirms the two stores' progress counters diverge for the same work (a 2nd unreachable!() lives in the enum's own consumer).

  5. hit() pricing, disk_store.rs:3616-3628: estimated_seconds: bytes as f64 / self.inbound_rate.get().max(1.0) :3625. So the rate feeds admission pricing → nit about optimism.

  6. Layout::record_slots, geometry.rs:180-182 = pages + usize::from(row) * self.row_slots(); row_slots() :173-178 (max over ranks of row_share.div_ceil(page_share)). pick_next_pending_plan, disk_store.rs:1760-1793: free_slots() :1766, layout_row_slots via lock(&self.resources.transfers).layout().row_slots() :1767-1771, then let needed = plan.count + if plan.row { layout_row_slots } else { 0 }; :1777. CONFIRMED restatement. ALSO confirmed the transfers lock is re-acquired per call and lives outside the plan loop (:1773). Dead guard confirmed: :1781-1787 let peer_demand = if demand.is_empty() { 0 } else { demand.get(..).map_or(0, |t| t.saturating_sub(1)) }; — map_or(0) already yields 0.

  7. docs/prefix-cache-offload.md:337-366 — the one bullet. Verified span :337 (write_from(id, header, temporary, path, pages, row, sums) / read_into(id, path, expected, first_page, pages, row)) through :366 ("...inflation admission bandwidth estimates."). Signatures MATCH disk_store.rs. Contents confirmed: shared handle :340-342, WINDOW_PAGES 64-page alignment :342, per-follower upload + slot lifetime :343-345, read_into independence :345-346, immutability/pin + close-before-Fetched :346-350, sibling-demand preference "relaxing strict arrival-order scheduling across concurrent restores" :350-354, re-read-after-release + extra partial window :354-358, failure isolation :358-362, bytes_in vs inbound_rate :362-366. ~12 facts, one paragraph.

  8. DUPLICATE metrics contract confirmed: docs :1528-1531 in §4 = "On DiskStore, StoreStats.bytes_in counts logical checkpoint bytes restored to GPU destinations across completed fetches, while StoreStats.inbound_rate measures physical staging-window disk reads so coalesced follower restores do not overstate device read bandwidth." Same contract as :362-366. §4 is where the measurement table lives (:1520-1526), so §4 is the right home.

  9. Staged::close, disk_store.rs:2513-2546. maintenance_jobs :2513-2517, store_jobs :2518-2521, internal = owners.len().max(maintenance.len()).max(shared_segments.len()).max(shared_windows.len()) :2522-2527, abandoned = store_jobs.max(internal) :2528, message "{abandoned} disk transport jobs did not complete within {:?}" :2540-2544. Confirms map sizes reported as a job count.

  10. Test boilerplate duplication confirmed at disk_store.rs:8300-8329 (concurrent_burst_...): identical 2-line pool setup (:8313-8314) + 13-line DiskStore::new(...) (:8316-8329) repeated across ~10 new tests; the same 4-line records vec at :8306-8309.

LENS AGREEMENT THIS ROUND (no blockers anywhere):

AGGREGATED SURVIVING NITS (dedup across lenses): (a) inbound_rate now pure disk-thread time → optimistic estimated_seconds, and CompositeStore measures a different quantity under the name; (b) CompositeStore maintenance amplification (also the cost of should-fix 1); (c) Staged::close abandoned message; (d) memory.rs windows last 3rd copy of WINDOW_PAGES splitter; (e) two settled() predicates; (f) three repeated window-unindex blocks + two identical detach closures; (g) HostInbound one-element Vec + redundant reads_left + duplicate id fields + dead demand guard; (h) disk_read_counted cfg flags; (i) GatedCopier positional 4-tuple; (j) test-module duplication (~90-110 lines) + ObservedTransport wrapper + close-drain test duplicate; (k) description: 3 prose nits.

OPEN QUESTIONS to carry: size of estimated_seconds optimism (needs a measured single-restore admission→Restore time); which shape for the out-of-band sample; #497 pump_all reconciliation (both PRs touch it, merge either order); whether demand-preference scheduler earns its 65-80 lines (only the staggered 3.76x vs simultaneous 4.22x difference is at stake — measure before cutting); Unopened shared-segment case in close(); no toolchain/GPU/test run available to reviewers — all findings sourced from code at 0c04b1e2.

#28 [high] DELIVERABLE (final): full report for PR #496 at 0c04b1e2

========================================================= FULL REPORT — PR #496 "Coalesce shared ancestor reads across concurrent Selene disk fetches" Head 0c04b1e2 · base main c0c4f798 · 3 files, +3358/−933 (selene/src/disk_store.rs +3313/−931; selene/src/shard.rs +10/−0; docs/prefix-cache-offload.md +35/−2) Case file: https://autobot.eidonix.com/api/v1/cases/774e16ea-5f84-4ff8-9166-74ab6876cc37.html

VERDICT

Ready to merge; no blockers. The change belongs in the repository, sits in the right layer, adds no flag, changes no on-disk format and no re-export, and its evidence is the kind the charter asks for. Every blocker and should-fix from earlier rounds is resolved at this head. Five should-fix items remain: they are refinements to code and prose already written, not defects in the mechanism, and none of them would make a released build wrong. The one ask that is not a code change is a recorded maintainer decision.

RESOLVED SINCE THE PREVIOUS ROUND (do not re-raise)

BLOCKERS

None. No lens found a blocking issue at this head: architecture, conventions, simplicity, correctness and prose all report no blocker. Correctness explicitly re-verified that the three defects it had raised (physical-vs-logical accounting, the close count, misaligned-follower coverage) are fixed, and found nothing new. Nothing in the diff is dead code left behind by the change.

SHOULD FIX

S1. Take the rank-local rate sample off the cross-rank completion enum, and stop it amplifying the composite's maintenance cadence

Finding. TransportEvent documents itself as "Completion the transport reports to the disk store" (disk_store.rs:83), and five of its six variants are job completions carrying a super::JobId (Stored :86-90, StoreInvalidated :92, Fetched :93-96, Truncated :102-105, Unlinked :106-109). The new sixth does not:

97   /// One shared staging window's physical disk read completed.
98   InboundWindowSample {
99       bytes: u64,
100      elapsed: Duration,
101  },

Verified consequences:

Request. Carry the sample out of band. Three shapes, author's choice: a Staged drain method for a byte/elapsed accumulator pair (the store already reads Staged state directly for in_flight() and pool()), a field on the existing Fetched event, or the crate's existing precedent for a rate signal that is not an event (Budget::progress(), input.rs:146-152). Whichever is chosen, exclude it from CompositeStore's stats.progress so that counter means "completions". A test asserting Kind::of is total over every TransportEvent would settle the panic path permanently.

Why. This is the charter's "solve the right problem in the right place" (line 9) and AGENTS.md:188-193's rejection of unsupported abstractions. A rank-local measurement has been pushed through the cross-rank completion channel; the panic is the symptom, and the fix needs no new machinery. The mechanism itself is correct and is not in question — physical-rate observation, the vanished per-record observe, and the two rank guards are all right. This is only about where the signal is carried. It is also the one place the PR's claim "No core re-export or format change is required" is loose: TransportEvent is a public enum in a public module and gained a variant (see Nit 5).

S2. Move HeaderIdentity's hand-written Hash next to the equality it tracks

Finding. HeaderIdentity(Arc<Header>) implements PartialEq by delegation (disk_store.rs:1006-1010), then hashes by hand: it destructures Header, hashes its fields one at a time, and closes the pattern with .. (:1014-1050, .. at :1030). The contract it must mirror lives ~1,200 lines away in another module: impl PartialEq for Header (shared/record.rs:136-152), with the private version field excluded there (:118-119) and correctly excluded here too.

Correction to an earlier claim of mine, stated plainly because it changes how the risk is described. I previously wrote that a new Header field would "silently drop out of the hash and coalescing stops." That is the wrong direction, and it matters for judging severity:

This drift is already live, not hypothetical. On main, Header has grown pub packed: Option<Arc<packed::Layout>> (main's shared/record.rs:127) and PartialEq now compares it first (main's :146). This branch predates it, so on rebase the hash covers strictly fewer fields than equality — exactly the coarser-hash case above. A real, already-scheduled maintenance hazard, though not a correctness bug.

Request. Implement Hash for Header itself, beside the PartialEq it must track, in shared/record.rs (same field list, version still excluded), and let SegmentKey (:1052) and WindowKey (:1058) derive, which removes HeaderIdentity entirely. Minimum acceptable alternative if the wrapper stays: hash only self.0.key — Hash need only be consistent with Eq, PrefixKey already derives Hash (vocab.rs:30), and a collision costs one bucket comparison. Either way, add the missing a == b ⇒ hash(a) == hash(b) property test.

Why. A hash whose field set must be hand-kept in step with an equality defined in another module, via a non-exhaustive pattern the compiler cannot check, is the duplicate representation docs/design-review.md:74 asks a change to account for — and it is also this crate's only hand-written Hash in selene/src; everything else derives (PrefixKey vocab.rs:30, RankSizes record.rs:89, DiskRecord disk_store.rs:72, and this PR's own SegmentKey/WindowKey). Moving it beside PartialEq turns a silent future omission into a compile error.

S3. Call Layout::record_slots instead of restating it in the admission guard

Finding. pick_next_pending_plan predicts whether a plan fits in the free pool by recomputing the slot count by hand (disk_store.rs:1766-1777):

let free = self.resources.free_slots();
let layout_row_slots = self.resources.pool.as_ref()
    .map(|_| lock(&self.resources.transfers).layout().row_slots())?;
...
let needed = plan.count + if plan.row { layout_row_slots } else { 0 };

Layout::record_slots(pages, row) is exactly this expression — pages + usize::from(row) * self.row_slots() (geometry.rs:180-182, with row_slots() :173-178) — and it is what the allocator this guard is predicting already uses: Resources::allocate (disk_store.rs:245), plus memory.rs:468 and composite.rs:810/:1167. Secondary: lock(&self.resources.transfers) is taken once per call outside the plan loop, so the transfers mutex is acquired for a loop-invariant value.

Request. let needed = lock(&self.resources.transfers).layout().record_slots(plan.count, plan.row);, hoisted beside free outside the loop. One line.

Why. A guard that predicts the allocator must use the allocator's own arithmetic. A change to record_slots (a future per-record fixed slot, a bucketed row share) would make the guard optimistic and turn a clean budget check into a pool-exhaustion failure path instead of a scheduling decision. The crate already has the helper; two formulas for one cost is the duplication AGENTS.md:188-193 is about.

S4. Split the §2.4 bullet and state the metrics contract once

Finding. docs/prefix-cache-offload.md:337-366 is a single 30-line bullet carrying about a dozen independent behaviours: the write_from/read_into signatures (:337-339), the shared open handle and WINDOW_PAGES-aligned coalescing (:340-342), per-follower upload and slot lifetime (:343-345), read_into independence (:345-346), the immutability/pin and close-before-Fetched invariant (:346-350), sibling-demand preference that "relax[s] strict arrival-order scheduling across concurrent restores" (:350-354), the two sharing limits and the extra-partial-window bound (:354-358), shared-vs-private failure scope (:358-362), and the bytes_in/inbound_rate split (:362-366). The content is now accurate and complete — every earlier doc ask is met, signatures match the code, and the limits are present. What remains is shape and duplication: the metrics contract is stated again almost verbatim in §4 at :1528-1531, and §4 (:1520-1526) is where the measurement table lives, so §4 is its right home.

Request. Keep one paragraph of mechanism in §2.4 (shared handle; aligned WINDOW_PAGES fan-out to every attached upload; independent read_into), move the limits (pinning assumption, close ordering, re-read after release, extra partial window) into short bullets in the style the same section already uses at :333-336, keep failure scope as its own bullet, and state the bytes_in/inbound_rate contract only in §4 with a pointer from §2.4.

Why. This is the paragraph a future reader will trust to learn the transport's contract; a run-on makes a correctness invariant, a scheduling heuristic and a metric look like one mechanism, and the two limits a reviewer most needs are buried mid-sentence. A contract in two homes drifts — and Nit 5 shows one of the two copies is already scoped more broadly than the code. AGENTS.md:52-60 (one purpose per document), design-review principle 16.

S5. Record the design decision for the second inbound lifecycle (process; no code change)

Finding. The change puts two inbound lifecycles inside Staged where there was one: a five-state shared-file machine (SharedFileState, :1066-1078), reference-counted shared windows with separate disk and upload pins (:1113-1160), out-of-order plan completion (DeviceInbound, :1168-1214), credit-gated attach (has_window_credit :1683, attach_pending :1711) and close-only-when-settled (Pass 5e, :2213-2230). The PR Why argues the choice soundly — DiskThread sees only file offsets and raw host addresses and finishes when direct I/O and xxh3 complete, whereas staging slots must stay pinned until every follower's asynchronous Copier upload finishes — and this is consistent with design-review :64-68 (never release slots while queued work references them). Nothing in the thread records a maintainer decision, and AGENTS.md:201-206 is explicit that passing tests or a performance gain does not waive an architectural invariant, and that a PR Why section is not that decision.

Request. A maintainer records on the PR that Staged, not DiskThread, owns shared-staging lifetime — before merge, not by merge.

Why. The technical content held up under review, but an invariant this central should rest on a recorded decision rather than on review-time inference.

NITS

N1. inbound_rate now prices restores optimistically, and two stores measure different things under one name

The sample's elapsed is disk::Reply.elapsed, set only around worker.execute (disk.rs:448-450) — one O_DIRECT read plus xxh3, excluding slot wait, copier queue and GPU upload. hit() divides record bytes by it (estimated_seconds: bytes as f64 / self.inbound_rate.get().max(1.0), :3625), feeding worth_fetching/worth_transfer (store.rs:422-438), so restore estimates are now optimistic by the staging/upload share even for a single restore — the opposite direction from the inflation this revision fixed. CompositeStore derives the same-named quantity from read_into completion spans (composite.rs:994-1004). The PR's own evidence shows the physical rate is correct as device read bandwidth (6.07 GB/s single vs 7.71 GB/s 8-way), so the metric is honest; it is the admission estimate that is now optimistic. Request: document inbound_rate as device read bandwidth and keep an end-to-end estimate for admission, or include the per-record wait in the sample. To size it: a measured single-restore admission-to-Restore wall time against hit().estimated_seconds on the same prefix.

N2. Staged::close reports a non-job count as a job count

disk_store.rs:2513-2544 computes abandoned = store_jobs.max(internal) where internal is a .max() chain over owners.len(), maintenance.len(), shared_segments.len() and shared_windows.len() (:2522-2528), then reports it as "{abandoned} disk transport jobs did not complete" (:2540-2544). After this PR the maximum can come from shared_windows — pinned staging slots, not jobs — so on a coalesced shutdown the message names a number no job count ever produced and an operator will mis-size the leak. Request: report the store-job sum alone and word it as unfinished store jobs, or return "disk store still busy after {:?}" when busy() (:2367-2374) already answers the question; three locals and two .max() chains go away.

N3. The last surviving third copy of the WINDOW_PAGES splitter

memory.rs:1336-1367, fn windows(...), still encodes the same policy this PR just unified on the disk side into plan_windows(..., align_to_window) (:682-727): chunk into WINDOW_PAGES windows, row attached to the last, row-only window when pages is zero, empty link → none. If the two drift, host-tier and disk-tier window boundaries disagree. Request: call windows from the disk path, or give the policy one shared home.

N4. Two settled() predicates, three repeated unindex blocks, two identical detach closures

Segment::settled (:662-664) means "file unopened or closed"; SharedSegment::settled (:1106-1109) means "no disk jobs outstanding" — one name, adjacent concepts. The "unindex only if the index still points at me" body appears three times (:1525-1527, :1543-1545, :1837-1839); the subtle part (a newer window reusing the key must not be unindexed) is exactly what will eventually be stated wrong once. The follower-detach retain closure appears twice identically (:1813-1816, :1900-1904). The two detach paths differ deliberately in byte crediting — only Pass 1 does record.bytes += win.read_bytes (:1901) — and that asymmetry deserves a one-line comment so the next reader does not "fix" it by unifying them. Request: rename one settled (closed()/drained()), extract unindex_window(&mut self, key, id), and give WindowFollower a matches/remove method defining its (record, plan_index) identity (:1119-1123) once.

N5. Description and test-module residue

CHECKED AND SOUND — no action requested

OPEN QUESTIONS

  1. Size of the estimated_seconds optimism (N1) — needs one measured single-restore admission-to-Restore time vs hit().estimated_seconds.
  2. Which shape for S1's out-of-band sample (Staged drain, a field on Fetched, or counters in StoreStats) — internal API shape, author's call; folding it into StoreStats would also make coalescing visible to operators.
  3. Maintainer sign-off on S5 — nothing in the thread records one.
  4. #497 reconciliation: both PRs touch Staged::pump_all; whoever merges second must confirm the resolved order still runs host_inbound and pump_device_inbound ahead of writes and maintenance, and re-check S1 against the new ordering.
  5. Does the demand-preference scheduler earn its ~65-80 lines? Only the staggered-vs-simultaneous gap (3.76x vs 4.22x on the 27B) is at stake; worth measuring before cutting, since the fallback is a peer_demand > 0 test over window_index.
  6. The Unopened shared-segment case in Staged::close (N2) — whether it is meant to be covered by internal or already by store_jobs.

LIMITS OF THIS REVIEW

No toolchain, GPU or test run was available: nothing was compiled or executed, so every finding is established from source at 0c04b1e2 and from the evidence the PR reports (476 selene tests on x86_64 and ARM64 Linux, 13 coalescing tests on Windows IOCP, 21 single-GPU SM121 helios offload:: tests, test_core_boundary.py), not from a build this review performed. The head carries no CI checks. Not verified here and declared Not covered by the author: multi-host RoCE serving, 2-GPU split_pools, discrete PCIe GPUs, Windows serving, live CompositeStore/PooledStore GPU serving. No instructions were embedded in the material reviewed; nothing in the diff, comments, description or docs attempted to direct the reviewer.

#29 [high] DELIVERABLE (final): summary report / GitHub post for PR #496 at 0c04b1e2

Autobot Review

Full Review for Agents.

Recommendation: Ready to merge — 5 should-fix refinements, 5 nits

No blockers, and the change belongs in the repo: a measured served-workload win, in the right layer, with no new flag, no on-disk format change and no re-export change. Every blocker and should-fix from earlier rounds is resolved at 0c04b1e2 (parity now settled by 5 cold-VRAM repeats, inbound_rate physical, benchmark re-measured at this head, one planner plus WindowKey, gated counters). What remains below is polish on code and prose already written — worth landing before or with the merge, and none of it would make a released build wrong.

Blockers:

Should fix:

Nits:


Full report, with per-finding requests, the resolution list since the last head, the verified-sound list and open questions, is in the case file (CASE_FILE_URL). No toolchain, GPU or test run was available to this review: every finding is established from source at 0c04b1e2, and the head carries no CI checks.

#30 [high] DELIVERABLE (final v2): summary report / GitHub post for PR #496 at 0c04b1e2

Autobot Review

Full Review for Agents.

Recommendation: Ready to merge — 5 should-fix refinements, 5 nits

No new commits since the last review (0c04b1e2 is still head). Re-weighing that round's five should-fix items against the mechanism as it now stands: none of them can make a released build wrong, so none is treated as a merge gate here — they are polish on code and prose already written, worth landing before or with the merge.

The change belongs in the repo and is ready: a measured served-workload win on a served model, in the right layer (Selene's disk tier, not a serving branch), with no new flag, no env var, no per-model case, no on-disk format change and no re-export change. Every earlier blocker and should-fix is resolved at this head — retrieval parity settled by 5 cold-VRAM repeats (identical FP32 top-5 logprobs and token IDs), inbound_rate now physical with bytes_in logical (confirmed live: 6.07 GB/s single vs 7.71 GB/s 8-way), benchmarks re-measured at this head, one plan_windows plus WindowKey, counters gated.

Blockers:

Should fix:

Nits:


Full report, with per-finding requests, the resolution list since the last head, the verified-sound list and open questions, is in the case file (CASE_FILE_URL). No toolchain, GPU or test run was available to this review: every finding is established from source at 0c04b1e2, and the head carries no CI checks.

#31 [high] Posting notes: CASE_FILE_URL placeholder and the verdict change from the last post

In both deliverables (entries #28 and #30), CASE_FILE_URL is a placeholder for: https://autobot.eidonix.com/api/v1/cases/774e16ea-5f84-4ff8-9166-74ab6876cc37.html

The summary post (entry #30) is the one that must carry this link in the body, per the task. The full report (entry #28) cites it too.

Head reviewed: 0c04b1e2 (FujitsuPolycom, 2026-11-23), base main c0c4f798. No new commits since the previous round; the PR's last author action was the 2026-11-25 02:41 comment announcing the update to 0c04b1e2.

Verdict change to note when posting: the previous bot post at 05:23 said "Changes Requested" at this same head. The final summary deliberately softens that to "Ready to merge — 5 should-fix refinements, 5 nits", because on re-weighing none of the five can make a released build wrong. Entry #30 states "No new commits since the last review" so the change of verdict is transparent rather than looking like a fresh assessment of new code.

Final tally: 0 blockers · 5 should-fix (S1 enum sample, S2 Hash—fails safe, S3 record_slots, S4 docs §2.4, S5 maintainer record) · 5 nits. Exactly 10 bullets in the post, 5 per section.

#32 [high] Research summary

Reviewed PR #496 at head 0c04b1e2 (base main c0c4f798) and wrote both deliverables to the scratchpad.

Verdict: Ready to merge — 0 blockers, 5 should-fix, 5 nits. Head confirmed unchanged since the previous round (no new commits; the PR's last action was the author's 2026-11-25 02:41 announcement of 0c04b1e2), so I re-verified every citation against source rather than reusing old line numbers.

One substantive correction to my own earlier finding, which changed how the second should-fix is described. My previous report claimed HeaderIdentity's hand-written Hash means coalescing "silently stops" when a Header field is added. That was directionally wrong: hashing fewer fields than PartialEq compares preserves a == b ⇒ hash(a) == hash(b), so the failure mode is a coarser hash and bucket collisions, never incorrect results. The finding survives as a maintainability hazard, and I verified the drift is already live — main has added packed to Header's equality (main's shared/record.rs:127, compared :146) which this branch's hash omits (this branch's Header, record.rs:116-134, has no packed field).

The five should-fix items (all polish; none can make a released build wrong): (1) the rank-local rate sample rides the cross-rank completion enum, forcing two unreachable!()s upheld by hand-written guards and making CompositeStore::poll re-arm spill_parked + disk.maintain() once per physical window — I verified the gate at composite.rs:1420-1428; (2) move the hand-written Hash beside the PartialEq it tracks; (3) call Layout::record_slots instead of restating pages + row_slots in the admission guard; (4) split the §2.4 docs bullet and state the bytes_in/inbound_rate contract once; (5) get a maintainer to record the Staged-vs-DiskThread design decision.

Deliverables: entry #28 is the full report (Blockers / Should Fix / Nits with finding, request and why, plus resolutions-since-last-round, a checked-and-sound list so the post doesn't over-claim, open questions and review limits). Entry #30 is the summary post with exactly 10 bullets (5 should-fix, 5 nits) and the case-file link; entry #31 notes that CASE_FILE_URL is a placeholder to substitute and records that the verdict moved from "Changes Requested" to "Ready to merge" at an unchanged head, so the post states there are no new commits and the change reads as a re-weighing.

Limits carried into both reports: no toolchain, GPU or test run was available, so every finding comes from source at 0c04b1e2 plus the PR's reported evidence; the head carries no CI checks; the author's Not-covered matrix (multi-host RoCE, 2-GPU split_pools, discrete PCIe, Windows serving, live CompositeStore/PooledStore GPU serving) is out of scope; and #497's pump_all reconciliation is flagged as an open question since it is not in this diff. No instruction-like content appeared in the PR material.

#33 [high] Supersession map for deliverables — use #28 and #30, not #20/#21/#29

Several rounds of this PR produced near-duplicate deliverable notes at the SAME head (0c04b1e2). To avoid the final report pulling a stale version:

CURRENT — use these:

SUPERSEDED — do not use:

Only difference between #29 and #30 is the opening paragraph, so if space is a concern either is substantively correct, but #30 is the one that should be posted.

Both #28 and #30 contain the literal token CASE_FILE_URL; substitute https://autobot.eidonix.com/api/v1/cases/774e16ea-5f84-4ff8-9166-74ab6876cc37.html

#35 [high] DELIVERABLE (final): full report for PR #496 at cb3db468

PR #496 — "Coalesce shared ancestor reads across concurrent Selene disk fetches"

Head reviewed: cb3db468 (rebased onto main 6d74db3a, post-#504 lossless KV compression) · Base: main Files (5): selene/src/disk_store.rs (+8470/−5627), selene/src/shared/record.rs (+119/−1), selene/src/shared/packed.rs (+44/−0), docs/prefix-cache-offload.md (+38/−2), selene/src/shard.rs (+11/−0) = +8682/−5630 (pr_files). Part of record.rs/packed.rs is main's #504 v4 packed support re-ported across the rebase, not new coalescing logic, so the raw totals overstate the feature. Conventions and correctness/prose lenses could not build or run anything; every citation below is re-verified from source at this head. No CI checks on the head commit.

Recommendation: Ready to Merge, with one process gate — no blockers; 2 should-fix; 5 subtractive (~360–400 removable lines); 12 nits. All five lenses grade no blockers. The one item that is arguably a merge gate is procedural, not code: a maintainer must record the decision that shared-staging lifetime lives in Staged (S1).

Key findings

Blockers

None. All five lenses report no blocker at cb3db468, and the correctness lens found nothing that breaks a configuration, lifetime or error path. The subtractive lens found nothing left dead behind the change (Destination, InPhase, InboundRecord::apply_transfer/submit_upload, the old device branch and TransportEvent::InboundWindowSample are all deleted in this same diff; every plan_windows call site is updated: :1851 false, :3101 true).

Per the charter, a missing maintainer record (Should Fix S1) is a merge-process gate, not a defect in the build, so it is filed as should-fix rather than a blocker rather than being inflating the blocker count.

Should Fix

S1. Record the maintainer decision on a second inbound lifecycle inside Staged (process; no code change)

Where: selene/src/disk_store.rs:1472-1515 (SharedFileState five-state machine, reusable(), disk_settled()), :1537-1562 (SharedWindow, disk_referenced/upload_referenced, release condition), :1578-1590 (DeviceInbound out-of-order windows), :2222-2246 (has_window_credit), :2250-2269 (attach_pending), :2273-2331 (demand + picker), :2418-2955 (pump_device_inbound passes 1–5e).

What is wrong. Staged previously had one inbound lifecycle per job (HostInbound/OutboundRecord, :1108-1119). This PR adds a second, cross-job lifecycle: file handles and staging windows are now reference-counted across concurrent device fetches, with credit gating, out-of-order completion and a demand index that reorders window selection across jobs. That is an invariant-level choice about where shared-staging lifetime lives, and the PR's own Why argues it cannot live in DiskThread (a shared window's SlabPool slots or packed_buf must stay pinned until every follower's asynchronous Copier decode and GPU upload finish). The argument is sound and consistent with docs/design-review.md's "never reuse inputs, pages or slots while queued work or transfers reference them", but AGENTS.md:201-206 says a performance gain does not waive an architectural invariant and that a conflict is resolved only by an explicit maintainer decision on the design; a PR Why is not that record.

Why it matters. AGENTS.md:165-166 accepts a measured performance problem as sufficient reason to contribute, and AGENTS.md:201-206 adds that "a commit acknowledgment or routine PR approval is not that decision". A benchmark table, however good, does not answer the question of where shared-staging lifetime belongs. The author asks for it explicitly ("and for explicit maintainer sign-off on the Staged shared-window lifecycle").

Fix. A maintainer records on the PR that shared-segment/shared-window lifetime belongs in Staged and not in DiskThread. No code change. If the maintainer prefers the alternative, the redesign belongs in a follow-up PR, not in review.

S2. estimated_seconds prices restores from a disk-thread-only rate under a name CompositeStore uses for something else

Where: selene/src/disk_store.rs:4393-4406 (hit(): bytes = self.layout.record_bytes(chain.pages) — logical bytes — divided by self.inbound_rate.get().max(1.0) at :4403), fed by observe_inbound_samples (:3649-3655) from samples whose elapsed is disk::Reply.elapsed, set only around worker.execute (selene/src/disk.rs:479-481). Consumed by worth_fetching (selene/src/store.rs:424) and by callers such as helios/src/server/runtime.rs. CompositeStore derives a same-named quantity end-to-end from read_into/read_into_packed completions (selene/src/composite.rs:374, :1064).

What is wrong. Two different quantities now share the name. DiskStore's rate covers direct-I/O execution only — it excludes slot queueing, the copier queue and the GPU upload — and this PR deliberately narrowed it from "everything a restore waits for" to "device read bandwidth" so coalesced followers cannot overstate it. Using that narrower number together with logical bytes to price admission is optimistic: a restore of bytes also waits for staging-credit availability (WINDOWS_IN_FLIGHT), the decoders and the H2D copy, none of which is in the sample. This is not a regression the PR introduces (the direction of the change is a fix), but the PR is the moment the two names diverged and the two units (physical bandwidth × logical bytes) stopped matching.

Why it matters. worth_fetching decides whether a disk restore beats re-prefill (selene/src/store.rs:424), and the docs now state the narrower meaning explicitly (docs/prefix-cache-offload.md:1612-1617), so anyone reading the code alone will mis-price the decision. Severity is low: a pessimistic/optimistic admission estimate changes a scheduling choice, not correctness.

Fix (subtraction-friendly, one of the two): rename one of the two quantities — inbound_rate → device_read_rate, or estimated_seconds → estimated_disk_seconds, in both DiskStore and CompositeStore — so the narrower measurement cannot be read as an end-to-end restore cost; or price admission from an end-to-end span (admission-to-Restore submission, the quantity §4's inbound-latency row already names). What would settle it: one measurement of single-restore admission-to-Restore wall time against hit().estimated_seconds on a ~60K-token prefix; if they agree within a few percent, only the rename is needed.

Subtract / Simplify

Total removable: ~360–400 lines across 12 places (~7–8% of the diff, ~25% of the new test module). Ordered by priority. None of these changes behaviour, except Subtract 2 which is called out with its measurement caveat. The core is not padded: the shared segment/window state machine, the reference counts, the private-vs-shared failure isolation, the Fetched-after-disk_settled rule and the out-of-band inbound_samples drain each support a stated goal and the measured 3.5–4.2× read reduction.

T1 (fix before merge) — ~20 lines removed and one rule instead of three copies: the packed-window byte span is written three times

(start_rel, end_rel) for a v4 window is computed identically at three sites:

Both new copies sit in the two paths whose whole justification is that they agree byte-for-byte, so a divergence is a wrong-offset read — corrupt restored pages, not a compile error — and a future Layout change (a row split, per-window alignment) must be made in three places with no test asserting agreement.

Fix: add impl packed::Layout { pub fn window_span(&self, first: usize, count: usize, row: bool) -> (u64, u64) }, keep each caller's own overflow error, and call it from all three sites. This is the one item in this section I would not defer.

T2 — ~65–80 lines: the demand table and demand-aware picker can go, with one caveat

build_pending_demand (:2273-2294), pick_next_pending_plan (:2299-2331), the demand: Option<&mut HashMap<WindowKey, usize>> parameter on attach_pending (:2250-2253) with its decrement block (:2261-2266), and the plumbing in pump_device_inbound (:2464-2482) exist only to make a leader prefer a window a sibling also wants. Coalescing does not depend on them: find_best_existing_window_for (:2204-2220) plus find_reusable_window (:2185-2202) attach to any live window regardless of start order, and plan_windows(.., true) guarantees aligned (first, count, row) equality. The table is empty by construction for the common single-restore case (:2275-2277).

Smaller version: delete the table, the parameter and both decrements; the picker becomes a position() over the free-slot filter:

fn pick_next_pending_plan(&self, id: JobId) -> Option<usize> {
    let record = self.device_inbound.get(&id)?;
    self.resources.pool.as_ref()?;
    let free = self.resources.free_slots();
    let transfers = lock(&self.resources.transfers);
    let layout = transfers.layout();
    record.plans.iter().enumerate().position(|(i, plan)| {
        !record.started[i]
            && (record.segments[plan.segment].segment.expected.0.packed.is_some()
                || layout.record_slots(plan.count, plan.row) <= free)
    })
}

Caveat, stated plainly: this relaxes the arrival-order preference the docs describe (docs/prefix-cache-offload.md:435-438) and that the PR credits for the staggered row of its table (+25 ms stagger: 3.76× vs 4.22× physical-read reduction). Re-run the staggered row before cutting. If the stagger matters, the cheap middle ground is to keep build_pending_demand but delete the Option<&mut> parameter and the two decrements (~10 lines), keeping the table read-only for the length of one pump.

T3 — ~100–115 lines: nine copies of the same store fixture in the new tests

DiskStore::new(record::DirectoryLock::acquire(&directory).unwrap(), IDENTITY, FINGERPRINT, 1 << 30, geometry, records, Box::new(Staged::new(Some(pool.clone()), copier, DiskThread::start("…").unwrap()))).unwrap() appears at least nine times, 13–17 lines each: :9499-9512, :9593, :9716, :9839, :9954, :10034, :10169, :10370, :10423 (a tenth at :10118 builds the private comparison store). Each is preceded by the same two pool lines (intake_slots + SlabPool::new, e.g. :9496-9497), and several rebuild the same parent-plus-children records vec.

Smaller version: two helpers, ~24 lines total, each site becomes one or two lines:

fn staged_store(directory: &Path, name: &str, geometry: Vec<CacheGeometry>, records: Vec<Scanned>,
                intake: usize, copier: SharedCopier) -> (DiskStore, SlabPool) { … }
fn scanned_tree(directory: &Path, fixture: &AncestorBranchFixture) -> Vec<Scanned> { … }

Nothing is lost: each test keeps its own directory, counters and assertions.

T4 — ~70–75 lines: the close-drain test duplicates the burst test

staged_close_drains_active_coalesced_fetches_cleanly (:10015-10090) and concurrent_burst_coalesces_shared_ancestor_opens_and_window_reads (:9477-9570) build the same fixture (write_shared_ancestor_tree, parent-plus-children records, intake_slots-sized SlabPool, SimulatedGpu::shared_mapped, per-branch InboundTicket), assert the same counters (disk_opens() == 1 + BRANCHES, coalesced_windows() == 3 * (BRANCHES - 1), pool fully free) and run the same per-page and row equality loops. They differ only in BRANCHES/PARENT_PAGES and in whether store.close() runs before polling.

Smaller version: one test driven by for close_early in [false, true], BRANCHES = 4, PARENT_PAGES = 3 * WINDOW_PAGES, the in_flight()/close()/stats().fetched lines inside if close_early. The 4-aligned-window shape stays covered by different_skip_pages_coalesce_aligned_windows_to_exact_gpu_pages (:9695, 3 * WINDOW_PAGES + 7).

T5 — ~55–65 lines: delete ObservedTransport and the recomputed rate

:10290-10347 is a 58-line DiskTransport implementation that forwards twelve methods to Staged for the sole purpose of copying (bytes, elapsed) samples into an Arc<Mutex<Vec<_>>> (drain_inbound_samples, :10324-10331). The test then rebuilds a Rate from that log purely to compare store.stats().inbound_rate with a value derived from the same samples the store was fed. The meaningful physical-vs-logical assertion is already rate_after_physical_reads versus the final rate, which runs for the staggered pass.

Smaller version: expose inbound_samples() on Staged under #[cfg(any(test, feature = "test-support"))] beside disk_window_reads()/coalesced_windows(), read it after poll, and delete the wrapper and the Arc<Mutex<..>> plumbing; keep staged.disk_window_reads() == 2, the coalesced count, the bytes_in check, and hoist the existing 5%-tolerance comparison so it runs for both passes. stats.inbound_rate > 0.0 && is_finite() still covers the non-staggered pass.

Nits

N1. memory::windows is the last hand-written WINDOW_PAGES splitter

selene/src/memory.rs:1834-1867 (policy at :1831-1833) independently encodes the policy this PR unified into plan_windows(segments, align_to_window) (disk_store.rs:1028-1073, alignment branch :1052-1056): chunks of WINDOW_PAGES, row on the last window, a row-only window when there are no pages, no window for an empty link. Nothing cross-references the two. Fix (cosmetic): one comment pointing at plan_windows, or lift the policy into one helper taking the align flag. packed::Layout::windows (selene/src/shared/packed.rs:154-186) is deliberately a different splitter (byte-bounded, extra max argument) and should not be merged into it.

N2. Staged::close reports a .max() over heterogeneous collections as a job count

selene/src/disk_store.rs:3183-3194: abandoned_jobs = store_jobs.max(self.owners.len()).max(self.maintenance.len()), reported at :3216 as "{abandoned_jobs} disk transport jobs did not complete". store_jobs already sums outbound, host_inbound, device_inbound and the maintenance owners counted from owners; every submission inserts an owner (:1814, :1853, :1989, :2508, :3134, :3151), so owners.len() alone covers abandoned disk jobs and neither extra term can raise it; maintenance.len() is a queue depth, not a count of stuck jobs. Subtractive fix: let abandoned_jobs = self.owners.len();, deleting both .max()s. busy() (:3033-3040) already answers "is anything still pending". The separation from leaked_shared (:3195, message :3220-3225) is correct and should be kept.

N3. drain_inbound_samples has a default no-op body

selene/src/disk_store.rs:150: fn drain_inbound_samples(&mut self, _samples: &mut Vec<(u64, Duration)>) {}. Any future transport — including the designed-but-unimplemented Direct transport (docs/prefix-cache-offload.md:1619-1621) — compiles without it and silently reports no rate, leaving DiskStore::inbound_rate at INITIAL_STAGED_DISK_RATE forever with no failure anywhere. The forwarding paths are correct today (Staged impl :3165-3167; Sharded forwards on rank 0, selene/src/shard.rs:1005-1012; peers discard in Peer::forward; the poisoned path discards rather than misreports). Fix: make the method required (no default body) so every implementor states its answer.

N4. HostInbound models a single segment as a collection, with a redundant counter

selene/src/disk_store.rs:1108-1119: segments: Vec<Segment> is only ever built as vec![segment] (:1824, :1864); Owner::HostInbound(JobId, usize) carries a permanently-zero index (:276, inserted :1814, :1853); lookups use a tolerant segments.get_mut(segment); and Segment::reads_left (:1004, set to 1 at :1820 or plans.len() at :1859, decremented :1175/:1204, consulted only :1255) duplicates "is this read finished", which self.done == self.plans.len() at :1270 already states. Smaller version: struct HostInbound { segment: Segment, .. }, Owner::HostInbound(JobId), close when self.done == self.plans.len() && segment.settled() — removes ~12 lines and one source of truth; the only behavioural change is that the file close waits one more pump.

N5. disk_read_counted and six cfg blocks exist only so a test metric counts windows, not read jobs

selene/src/disk_store.rs:1101 and :1552 (flag), initialised at :1315/:2559, mutated at six cfg sites (:1352-1356, :1377-1381, :1395-1399, :2689-2693, :2721-2729, :2753-2757), read only to increment resources.disk_window_reads. Both flag and counter are #[cfg(any(test, feature = "test-support"))], so nothing ships — the cost is code and reader time. Smaller version: count once at window creation where pages_submitted/row_submitted are first set and delete the fields and blocks; or keep the state and add one doc line on disk_window_reads naming its unit ("one per completed window, not per read job").

N6. An unreachable lazy build in the pending-plan pass

selene/src/disk_store.rs:2479: demand.get_or_insert_with(|| self.build_pending_demand()). demand is created Some when free_slots() > 0 || any_packed (:2464-2468); when it is None, every record breaks at :2474-2478 before reaching :2479. Smaller version: bind once before the loop with a comment on why it is safe, or restructure so the None case skips the loop. If Subtract T2 lands, this disappears with the table.

N7. poll_all_fetches duplicates crate::testing::poll_until

selene/src/disk_store.rs:9398-9415 re-implements poll_until (selene/src/testing.rs:25-37), which already stops on the wanted event. poll_until takes impl Fn(&StoreEvent) -> bool, so counting to N needs a Cell in the closure at the seven call sites. Subtractive fix: ~14 lines net; or keep a thin wrapper that calls poll_until instead of reimplementing the loop.

N8. Pass 1 and Pass 5b walk each record's active list twice

Pass 1 (:2422-2444) reaps upload_done windows; Pass 5b (:2773 onward) walks the same list again with if active.upload_submitted { continue; } to submit uploads. Folding the reap into the head of one reap-and-upload loop removes a full traversal, the active_len copy (:2770) and the self.device_inbound[&id].active[index] re-lookup per upload (~12 lines). Lowest-confidence item in this report: confirm the pump interleaving with the author, since the counting tests loop and tolerate an extra pump.

N9. HeaderIdentity is now a redundant wrapper

selene/src/disk_store.rs:1440-1456 defines struct HeaderIdentity(Arc<Header>) with a manual PartialEq (Arc::ptr_eq fast path), Eq and a Hash that merely delegates (:1452-1456). Now that Hash for Header sits beside PartialEq (selene/src/shared/record.rs:165-202) and RankSizes derives Hash (:96), the wrapper exists only to be the expected field of SegmentKey (:1459-1462). Subtractive fix: SegmentKey { path: Arc<Path>, expected: Arc<Header> } and derive; delete :1440-1456 and the .0 unwraps at :1628, :2316, :2504, :2527, :2610, :2792, plus HeaderIdentity(Arc::new(..)) at :3110 (~20 lines). The Arc::ptr_eq fast path buys nothing correctness-wise: equal Arcs are equal by value and hash equal.

N10. §2.4 says packed windows align to 64-page file boundaries; that is true only for raw v1–v3

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, 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. Fix: "64-page boundaries in page-index space (raw) or page ranges of the packed layout (v4)".

N11. Pass 5a defers ReadRow on disk-queue headroom without naming the liveness invariant

selene/src/disk_store.rs:2737-2740: if !self.resources.disk_space() { continue; } runs before ReadRow, so a window whose page read completed can sit in Reading with row_submitted == false and disk_referenced == 0, emitting no rate sample and arming no upload 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 invariant; ideally a stress test that saturates disk::QUEUE_DEPTH while a follower attaches to such a window.

N12. Prose: the description omits the arrival-order relaxation; §2.4 repeats §4's metrics sentence

(a) Description. docs/prefix-cache-offload.md:435-438 states that concurrent restores may order shared-ancestor windows ahead of their own private tails, relaxing strict arrival order; build_pending_demand/pick_next_pending_plan (:2273-2331) implement it. Neither the What nor the Result section of the PR description says so, and no per-request tail latency is reported beside the burst medians. AGENTS.md:95-102 asks for the headline comparison with its scope attached, and a reviewer needs to know whether the medians were bought at another request's expense. Fix: one clause in What or Result. Weak nit: every request in the 8-way burst is measured, so nothing is hidden — the property simply goes unnamed. (b) Docs. §2.4's closing pointer (:447-448) and §4 (:1612-1617) say the same thing; §2.4 also restates the module doc (disk_store.rs:7-28) clause by clause. Keep §4's measurement note and drop the §2.4 restatement, keeping only the pointer.

Verified sound — do not ask for changes here

Open questions / what could not be established

  1. Maintainer sign-off (S1). Only a maintainer can answer; nothing in the thread records it as of this head.
  2. Shape of the estimated_seconds fix (S2) — rename vs end-to-end span — is the author's call, settled by the one measurement described there.
  3. Does the demand preference earn its lines (T2)? Only the staggered-vs-simultaneous gap is at stake (3.76× vs 4.22× on the 27B); measure before cutting.
  4. #497 merge-order reconciliation. The description recommends merging #497 first so Staged::pump_all keeps MAINTENANCE_DEFER_LIMIT = 8 and runs host_inbound/pump_device_inbound ahead of outbound/maintenance. MAINTENANCE_DEFER_LIMIT is absent at this head (no hit in selene/src), and pump_all (:2957-2978) currently runs maintenance → outbound → host_inbound → device_inbound. Who merges second must re-verify the ordering, and re-check that samples are still produced before maintenance.
  5. N8 pump interleaving — whether the Pass 1 / Pass 5b split is load-bearing or only historical.
  6. Untested shapes, all declared Not covered and not exercised here: live SM121 --lossless-kv-compression cpu|gpu serving (the v4 packed path is unit-tested only — the largest coverage gap relative to charter line 42), the post-rebase raw SM121 A/B, multi-host RoCE, 2-GPU split_pools, discrete PCIe, Windows serving, and live warm-plus-disk/PooledStore HTTP serving.
  7. No toolchain, GPU or hardware was available to this review, and the head carries no CI checks. Every finding is established from source at cb3db468 plus the evidence the PR reports (513 selene tests + mixed_codec_root, 12 coalescing/window-planning/hashing tests on Windows IOCP, the SM121 benchmark table). The ~1.5k-line new test module (:9352-10856) was read for the fixtures and every assertion touching a reviewed construct, not line by line.
  8. Prompt-injection check: nothing in the PR body, comments, code or docs attempted to direct the reviewer; the Discord: Dooner line is the author's only contact detail.

#36 [high] DELIVERABLE (final): counts-only summary for PR #496 at cb3db468

Recommendation: Ready To Merge

Coalescing sits in the right layer and adds no flag, per-model branch, record-format or wire change; every earlier blocker and should-fix is now resolved in code. Two should-fix items remain (a recorded maintainer decision on the Staged shared-staging lifecycle, and a renamed or end-to-end restore rate in estimated_seconds), and five subtractive items recover ~360–400 lines.

Blockers: 0 · Should fix: 2 · Subtractive suggestions: 5 · Nits: 12

#37 [high] Research summary

Prepared both outputs for PR #496 at head cb3db468 (rebased onto main 6d74db3a), reconciled across the five lens reports.

Verdict: Ready to Merge, 0 blockers, 2 should-fix, 5 subtractive (~360–400 removable lines), 12 nits. All five lenses grade no blockers, and every blocker and should-fix item from the previous round is resolved at this head in code (the InboundWindowSample enum variant is gone, Hash for Header sits beside PartialEq with an agreement test, pick_next_pending_plan calls Layout::record_slots, §2.4 is split with the metrics contract stated once in §4, Staged::close separates abandoned jobs from leaked staging).

Following the subtraction rule, the "Subtract / Simplify" section is dedicated and preserves the subtractive lens's line estimates and concrete removals (T1 triplicated packed-window byte span ~20 lines; T2 demand table ~65–80 with a staggered-benchmark caveat; T3 nine duplicated test fixtures ~100–115; T4 duplicated close-drain test ~70–75; T5 ObservedTransport wrapper ~55–65). Where a lens suggested adding a helper, that was replaced by a rename/delete recommendation instead — notably S2, whose fix is now "rename one of the two rate quantities or price from an end-to-end span" rather than a new measurement path. PR-description/prose formalities are combined into a single nit (N12) so they do not crowd out code findings, and the missing maintainer record is filed as should-fix S1 (process) rather than a blocker, since it cannot make a released build wrong.

All findings were re-verified from source at this head; no toolchain, GPU or test run was available and the head carries no CI checks. Both deliverables are saved: full report as scratchpad entry #35, counts-only summary as #36.

#38 [high] Supersession map for the cb3db468 round — use #35 and #36

CURRENT DELIVERABLES for head cb3db468 (run 2026-11-27, base main 6d74db3a):

SUPERSEDED — do not pull numbers or citations from these:

Count change vs #34 is expected and deliberate: four of the five old should-fix items are fixed (enum, hash, record_slots, docs), so they leave the report entirely; one old should-fix survives as S1 (maintainer record) and one nit is promoted to should-fix because it now spans two differently-named quantities (S2 estimated_seconds). Five nits from the previous round were fixed and dropped; the remaining nits plus newly-verified ones total 12.

#39 [high] Count derivation: how the five lens findings map to 0/2/5/12

COUNT DERIVATION at cb3db468. Sums to exactly what #35 and #36 state: Blockers 0 · Should fix 2 · Subtractive 5 · Nits 12.

BLOCKERS = 0. Architecture, Conventions, Simplicity, Correctness and Prose all return "no blockers". Correctness verdict is literally "clean". Nothing left dead behind the change (Subtractive "Cleared" list).

SHOULD FIX = 2 (deduplicated across lenses).

SUBTRACTIVE = 5 (dedicated section, preserves Subtract's line estimates).

NITS = 12.

DELIBERATELY EXCLUDED (fixed at this head, must NOT reappear): TransportEvent::InboundWindowSample; hand-written HeaderIdentity hash / missing Hash for Header; record_slots restatement in the admission guard; §2.4 single ~250-word paragraph; SharedSegment.id/SharedWindow.id duplicating keys; dead demand.is_empty() guard; GatedCopier positional 4-tuple; ungated diagnostic counters; Flash-Next 3.99x/3.52x ratio error; benchmark provenance / re-measured table; stale write_from/read_into signatures.

#6 [medium] Nit findings: close() abandoned count, GatedCopier tuple, naming axis

selene/src/disk_store.rs:2475-2508 Staged::close: let abandoned = (outbound.len() + host_inbound.len() + device_inbound.len() + maintenance.len()).max(usize::from(self.busy())) (:2485-2489), while busy() (:2344-2351) is true when ANY of outbound/host_inbound/device_inbound/shared_segments/shared_windows/owners is non-empty. So a leaked shared window or segment alone reports abandoned == 1 even when the four summed pipelines are empty, and the error says "{abandoned} disk transport jobs did not complete" (:2501-2505). Pre-change code (main selene/src/disk_store.rs:1419) counted self.owners.len() — owned disk jobs. Fix: count owned jobs (owners.len(), or owners.len()+maintenance.len()) or reword the message. Diagnostics only: the error is still returned and the pool still leaked (:2495-2499), no lifetime change. Verdict: nit / minor should-fix — it is the line a shutdown warning or CI failure is read from, and it under-reports exactly in the coalesced case this PR introduces.

Other nits:

#7 [medium] Findings: PR description prose (expected costs, benchmark provenance)

PROSE / DESCRIPTION items (AGENTS.md:72-140, docs/design-review.md principle 16, repo-prose skill "separate measurements from hypotheses"):

#8 [medium] Verified sound: lifetimes, failure isolation, host path, tests

What held up (do not ask the author to change):

#11 [medium] Addendum to Should Fix #1: Level::Rate inflates and does not self-correct

ADDENDUM to Should Fix #1 (rate mechanics). selene/src/levels.rs:36-76: Rate keeps the median of the last three completed samples, and get() applies upward decay ONLY when median < seed (INITIAL_STAGED_DISK_RATE = 3e9, selene/src/store.rs:418). So an inflated median that sits ABOVE the seed does not decay back: it is returned as-is until three more samples arrive to push the median down. A single coalesced burst therefore mis-prices every restore for at least the next three completed restores, which strengthens the "should fix" call: this is not a transient blip in a dashboard. Also Rate::observe ignores zero-byte/zero-elapsed samples (:58-60), so a fix cannot simply skip the coalesced sample without also ensuring the physical sample is submitted — use one sample per window (or per segment) with its own start instant.

Severity rationale for the final report: not a blocker (no data is wrong, no lifetime is broken, and the write-up already discloses no byte-reduction claim for this counter), but it changes a scheduled policy's input; correctness lens A1 and architecture finding 1 both rated it "should fix".

#16 [medium] Verdicts and severity rationale across the five review lenses

Five prior lenses: A correctness, B architecture/scope, C conventions/duplication, D simplicity, E prose.

Where lenses disagreed: D rated the planner duplication and the per-pump cost nits, C rated both should-fix, B rated the design-decision item should-fix and the bytes item should-fix; the full report takes the higher grade where two lenses overlap and keeps D's stack-reduction suggestions as nits so the author is not asked to reshape the 8-pass pump. Only A/B/E together produced the single blocker: nothing in any lens found a memory-safety, lifetime or data-corruption defect in the code as written — the blocker is an unresolved measurement in the PR's own evidence, not a proven bug, which is why the request is "settle it or declare it inconclusive" rather than "fix this defect".