#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
-
docs/prefix-cache-offload.md:337-342 (+5/-1). New sentence: "Concurrent
fetchjobs 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-ownedread_intoreads 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 signatureswrite_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). -
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. -
Misplaced rustdoc selene/src/disk_store.rs:228-234: the comment for
Resources::allocate("Slots forpagespage records and, whenrow, all row pieces;Noneleaves the pool unchanged...") now sits abovefree_slots, which takes no arguments — published docs are wrong andallocate(the subtle all-or-nothing contract) is undocumented. On main the comment is aboveallocate(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
- Resolve the 61.3K deterministic retrieval result before merge.
- Finding: the PR's own "Live SM121 checks" report Qwen3.8-27B-NVFP4 TP1 at 61.3K scoring 8/9 on main and 7/9 with this change, on a 9-fact numerical retrieval prompt at temperature=0 after a cold-VRAM restart, while DeepSeek TP4 is 9/9 at 23.1K and 47.1K. No conclusion is drawn beyond "recipe-clamped".
- Request: repeat the 61.3K prompt several times on main and at head f9c9191 and report the variance and the differing fact; if the gap holds, fix it before merge; if it is harness or recipe-clamp noise, say so explicitly and move the check under "Not covered" as inconclusive.
- Why: it is the only end-to-end check that exercises the shared-window fan-out on a real model, and it is the one that got worse. A real defect would live in plan_aligned_windows' chunk/offset mapping for a follower whose first page is not 64-aligned (selene/src/disk_store.rs:700-738) or in the trailing partial chunk's row flag (:730). Cheapest guard if it does not reproduce: a test where a follower attaches to a window another restore created, with a non-64-multiple skip_pages and a shared final partial chunk, asserting byte-equal device pages and row against the private path. (AGENTS.md:106-108: explain differences between runs, keep material failures visible.)
SHOULD FIX
- Coalesced reads double-count bytes into the measured inbound rate, which prices future restores.
- Finding: a window accumulates its physical reply bytes once (:1530
win.read_bytes += reply.bytes, init :1979), but every follower adds the whole window to its own record (:1829record.bytes += win.read_bytes). That per-record count is the success payload of TransportEvent::Fetched (:2235), which feedsstats.bytes_in += bytes(:3626) andinbound_rate.observe(*bytes, job.started.elapsed())(:3628). Under a coalesced burst the sample divides ~logical bytes by a ~4x shorter physical elapsed time, so inbound_rate inflates roughly with the fan-out (the PR's own 4.21x/3.97x/4.01x). inbound_rate is not a statistic: DiskStore::hit prices restores atbytes / inbound_rate(:3587) and worth_fetching/worth_transfer gate admission on it (selene/src/store.rs:423-438; consumers helios/src/server/runtime.rs:2772, helios/src/server/metrics.rs:532). A later lone restore that will not be coalesced is then under-priced and may be fetched when prefill was cheaper. Symmetrically, stats.bytes_in shows none of the 4.21x physical-read win, and docs/prefix-cache-offload.md:1501-1502 defines "Inbound latency"/"Copy-out bandwidth" as store-counter measurements. - Request: observe the rate on physical window bytes — one sample per window (or per segment) at its own completion, with the window's own start time — and keep
bytes_inas the logical restored-byte counter, documenting the distinction in §2.4 and §4. Add a test that compares StoreStats.inbound_rate for 1 vs 8 concurrent restores of the same prefix against measured device bytes, and one asserting bytes_in is unchanged by coalescing. - Why: otherwise the performance policy that decides whether to restore at all is measured on a quantity the change makes non-physical, and only a test can pin the size of the error.
- Docs and rustdoc overstate the mechanism and drop the invariant that licenses it.
- Finding (docs/prefix-cache-offload.md:337-342): the new sentence says concurrent fetches "share one open file handle and coalesce aligned 64-page windows…" with (a) neither of the two limits the PR description itself discloses — a window already released before a later arrival attaches is read again, and skip_pages % WINDOW_PAGES != 0 now splits up to one extra partial window; (b) not the invariant that makes sharing safe — published records are immutable and pinned for the life of every restore (it exists only in the PR conversation); (c) "aligned 64-page" without saying aligned to absolute file page boundaries, and "64" instead of WINDOW_PAGES; (d) stale signatures
write_from(key, metadata, buffers)/read_into(key, buffers)where the real ones are write_from(id, header, temporary, path, pages, row, sums) (selene/src/disk_store.rs:1242-1251) and read_into(id, path, expected, first_page, pages, row) (:1268-1276); (e) one 60-word sentence carrying three behaviours where the section's style elsewhere is one behaviour per sentence. Also failure scope (shared open/read error fails every attached restore; private child/upload error fails one) belongs in §2.4 or the §2.12 invariant list (docs:853). - Finding (module doc selene/src/disk_store.rs:14-24): the header now describes sharing but still claims windows are bounded to "at most WINDOWS_IN_FLIGHT windows of one record staged at a time" and "Nothing here waits", while device restores run out-of-order plans over reference-counted windows that stay staged past their own completion and can be complete-but-not-reported while waiting for seg.settled() (:2221-2232).
- Finding (selene/src/disk_store.rs:228-234): the rustdoc for Resources::allocate ("Slots for
pagespage records and, whenrow, all row pieces;Noneleaves the pool unchanged…") now sits above the newly inserted free_slots, which takes no arguments; the published docs describe the wrong function andallocate, whose all-or-nothing contract is the subtle one, is undocumented. On main the comment is above allocate (main selene/src/disk_store.rs:216-218). - Request: state the two disclosed limits and the immutability+pin invariant, name WINDOW_PAGES at the point the alignment rule is introduced, fix the two signatures, split the sentence; rewrite the two module-doc claims (two-window credit, follower sharing, settle-before-Fetched); move the allocate comment back and give free_slots its own one-liner.
- Why: AGENTS.md:194-199 and design-review principle 16 require material limitations and the safety invariant in the specification of record, not only in the PR thread; a misplaced rustdoc ships a wrong contract.
- Tie the benchmark to the code under review, and stop presenting expected costs as results.
- Finding: the table was measured before the linear demand-index and close-count edits now at head; the only notice is a parenthesis in the setup line, and the "Not covered" bullet repeats it in a different emphasis. Those edits change pass-2 demand attach ordering — exactly what produces shared windows. Separately, "Existing users pay per-pump demand indexing when free slots exist and at most one extra window split when skip_pages % 64 != 0" sits at the end of Result with no measurement, and overstates it: build_pending_demand returns an empty table before doing any work when device_inbound.len() <= 1 (:1651-1653), so the cost applies to multi-fetch pumps only.
- Request: re-run one TP1 simultaneous and one staggered trial at head (or state plainly that the numbers are from an earlier commit and that head differs only by demand-index bookkeeping and close accounting), and label the cost sentence as an expected, unmeasured bound with the single-fetch fast path noted.
- Why: AGENTS.md:95-96 and :103-112 — separate expectation from measurement, and connect each claim to the artifact actually tested.
- One window planner, one window identity.
- Finding: plan_aligned_windows (:700-738) is plan_windows (:670-695) with a single added clamp (
chunk_end = end.min(((cursor / WINDOW_PAGES) + 1) * WINDOW_PAGES), :721-722): same signature, same output type, same row-on-last-window and row-only rules, and identical output wheneverfirstis aligned — the divergence is exactly the misaligned skip_pages case the new tests cover. memory.rs:1333-1367 windows() is a third expression of the same policy. Separately the sharing key (path, expected Header, first, count, row) is re-expressed by hand five times — segment lookup in acquire_shared_segment (:1368-1373), field matching in find_reusable_window (:1578-1583), the demand map key plus an inner Vec<(Header, usize)> scan in build_pending_demand (:1647-1679), the same key rebuilt in pick_next_pending_plan (:1705-1718), and twice in the demand decrement blocks (:1890-1899, :1996-2006) — while the PR already names the other two layers (SharedSegmentId :1000, SharedWindowId :1003). Header derives PartialEq/Eq but not Hash (selene/src/shared/record.rs:136-154), which is why there is a linear scan. - Request: fold the aligned split into plan_windows behind an alignment parameter (or use plan_aligned_windows for read_into too; the only test pinning host split points is windows_split_segments_at_the_window_size_and_carry_the_row_last, :6221-6253) and delete the copy; introduce one WindowKey type next to SharedWindowId with a Hash-able header identity, and keep HashMap<WindowKey, SharedWindowId> beside shared_windows plus HashMap<WindowKey, usize> for demand; store the shared segment id or Arc in DeviceSegmentRef instead of PathBuf.
- Why: charter line 9 ("smallest footprint in shared code") and design-review principle 8 — five hand-written copies of the predicate that decides whether two restores may share a window is how a follower ends up attached to the wrong expected header. It is also the enabling change for the next item.
- Remove the per-pump allocation and quadratic scan in the attach path, and the duplicated attach loop.
- Finding: build_pending_demand clones a PathBuf per pending plan (:1668) and a Header per bucket push (:1674); pick_next_pending_plan clones the path per candidate plan (:1710) and so do both decrement blocks (:1890, :1996); find_reusable_window scans every value in shared_windows (:1576-1599) for every pending plan and is called from find_best_existing_window_for (:1602-1624) inside the attach loops — an allocation and an O(windows x plans) scan per pump in ordinary multi-fetch serving, which the PR itself avoids elsewhere with the pending_page_reads index (:1030). Pass 2 (:1845-1861) and Pass 4 (:1874-1903) also run the identical needs_credit predicate (
record.error.is_none() && record.active.len() < WINDOWS_IN_FLIGHT, repeated at :1847-1852, :1876-1881 and inline at :2122-2124) and the identical find_best_existing_window_for + attach_existing_window loop, differing only in Pass 4's demand decrement. - Request: with WindowKey in place, index windows and demand so the lookups are hashes and the clones are refcount bumps; extract
fn has_window_credit(&self, id) -> boolandfn attach_pending(&mut self, id, demand: Option<&mut Demand>) -> booland call them from both passes and the Pass 5b credit check. - Why: the description concedes the per-pump indexing cost; the implementation pays more than the description claims, and a single credit predicate cannot drift the way two copies can (AGENTS.md:188-193 is satisfied by removing this cost, not by adding to it).
- Record the design decision for the new shared inbound lifecycle.
- Finding: the change replaces Staged's single inbound lifecycle — the invariant that made "Nothing here waits" true — with two (host vs device) inside shared cache policy: five new lifecycle types, a five-state file machine, two reference counts per window, out-of-order plan completion and a "close only when settled" rule (:1000-1160, :2205-2255). AGENTS.md:204-206 asks for an explicit maintainer decision before changing an invariant like this, and the PR does not discuss the main alternative.
- Request: get a recorded maintainer sign-off on doing the coalescing inside Staged rather than inside the disk thread (which already owns the file handle), or the author's justification for preferring Staged; keep the rest of the change as is.
- Why: the technical content is sound in review, but a change of this shape to shared cache invariants should rest on a design decision rather than on review-time inference.
NITS
- 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. - 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. - 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.
- 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 aVec<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). - 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
- The 61.3K retrieval result must be settled. The PR reports 8/9 (main) vs 7/9 (this PR) on a temperature=0 retrieval prompt at 61.3K. Repeat it a few times on both revisions and report the variance and the differing fact, fix it if it holds, or mark it inconclusive under "Not covered". It is the only end-to-end signal for the fan-out and the only check that got worse; the likely sites are plan_aligned_windows' chunk mapping for non-64-aligned first pages and the trailing partial-chunk row flag.
Should Fix
- inbound_rate is now measured on logical bytes. Each follower credits the whole window to its record (disk_store.rs:1829), so the rate sample divides coalesced-elapsed time into a ~4x larger byte count and
hit()/worth_fetchingthen under-price lone restores. Observe the rate once per physical window, keepbytes_inlogical and document it, and add a 1-vs-8-restore rate test. - Docs claim more than the mechanism and are wrong in two places. §2.4 needs the two limits the description discloses, the immutable+pinned invariant, WINDOW_PAGES file-boundary alignment, and the real
write_from/read_intosignatures; the module doc still says "at most WINDOWS_IN_FLIGHT windows" and "Nothing here waits"; theallocaterustdoc now sits onfree_slots(:228-234). - Tie the benchmark to head and don't 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 (it only applies to multi-fetch pumps, :1651-1653).
- One planner, one window key. plan_aligned_windows is plan_windows plus one clamp — fold them; and 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.
- 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 putting a second inbound lifecycle (host vs device) inside Staged rather than in the disk thread, which already owns the handle.
Nits
Staged::closecounts shared windows/segments into "N disk transport jobs did not complete" (:2485-2489) — count owned jobs or reword.- The three new counters are ungated
allow(dead_code)fields (:192-200) instead of#[cfg(any(test, feature = "test-support"))]likedisk.rs's Faults; consider surfacing disk_opens/coalesced_windows in StoreStats. GatedCopierreturns a positional four-tuple (:8059) where the crate's fixtures return named pairs; six tests repeat the same fixture construction.- Drop state nothing branches on:
PlanState::Done(:1093, :1833),HostInbound's single-elementVec<Segment>with an always-zero index (:1285),SharedWindow.path/.expectedduplicating its segment (:1073), and id fields duplicating map keys. - Naming mixes axes (HostInbound/DeviceInbound vs HostWindow/SharedWindow); split the new 60-word §2.4 sentence into one behaviour each.
#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
- Settle the 61.3K retrieval result (or say it is inconclusive). The description reports 8/9 on main vs 7/9 with this change on a temperature=0 retrieval prompt, with no conclusion drawn. Re-run that prompt a few times on both revisions and report the variance and the differing fact; fix it if the gap holds, otherwise mark the check inconclusive under "Not covered". It is the only end-to-end signal for the new fan-out, and the plausible defect sites are narrow: plan_aligned_windows' chunk/offset mapping for a non-64-aligned first page and the trailing partial chunk's row flag.
Should Fix
inbound_rateis now measured on logical bytes and does not self-correct. Each follower credits the whole 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 andworth_fetchinggates on it. Fix: one rate sample per physical window,bytes_instays logical and documented, plus a 1-vs-8-restore test.- Docs and rustdoc claim more than the mechanism. §2.4 needs the two limits the description already discloses, the immutable+pinned invariant,
WINDOW_PAGESfile-boundary alignment, and the realwrite_from/read_intosignatures; the module doc still says "at most WINDOWS_IN_FLIGHT windows" and "Nothing here waits"; theallocaterustdoc now sits onfree_slots(:228-234). - 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 only applies to multi-fetch pumps (:1651-1653).
- One planner, one window key. plan_aligned_windows is plan_windows plus one clamp (fold them), and the sharing key (path, header, first, count, row) is hand-written five times (:1368, :1578, :1647, :1710, :1890/:1996) — name it
WindowKeyand index it, which also removes the per-pump PathBuf clones and the O(windows×plans)find_reusable_windowscan. - De-duplicate the attach loop; 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 putting a second inbound lifecycle (host vs device) insideStagedrather than in the disk thread that already owns the handle.
Nits
Staged::closecounts shared windows/segments into "N disk transport jobs did not complete" (:2485-2489) — count owned jobs or reword the message.- Gate the three new counters like
disk.rs'sFaults(#[cfg(any(test, feature = "test-support"))], :192-200) instead ofallow(dead_code), and consider addingdisk_opens/coalesced_windowstoStoreStats. GatedCopierreturns a positional four-tuple (:8059) where the crate's fixtures return named pairs; six tests repeat the same fixture construction.- Drop state nothing branches on:
PlanState::Done(:1093, :1833),HostInbound's single-elementVec<Segment>with an always-zero index (:1285),SharedWindow.path/.expectedduplicating its segment (:1073), id fields duplicating map keys. - Naming mixes axes (
HostInbound/DeviceInboundvsHostWindow/SharedWindow); split the new 60-word §2.4 sentence into one behaviour each.
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
- 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
inbound_rateis 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 andworth_fetchinggates 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_instays logical and documented, plus a 1-vs-8-restore rate test.- Docs and rustdoc claim more than the mechanism. §2.4 needs the two limits the description already discloses, the immutable+pinned invariant,
WINDOW_PAGESfile-boundary alignment and the realwrite_from/read_intosignatures; the module doc still says "at most WINDOWS_IN_FLIGHT windows" and "Nothing here waits"; theallocaterustdoc now sits onfree_slots(:228-234). - 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).
- 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
WindowKeyand index it, which also removes the per-pump PathBuf clones and the O(windows×plans)find_reusable_windowscan. - 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) insideStagedrather than in the disk thread that already owns the handle.
Nits
Staged::closecounts leaked shared windows/segments into "N disk transport jobs did not complete" (:2485-2489) — count owned jobs or reword the message.- Test hygiene: gate the three new counters like
disk.rs'sFaults(:192-200) instead ofallow(dead_code)and consider surfacingdisk_opens/coalesced_windowsinStoreStats;GatedCopierreturns a positional four-tuple (:8059) where this crate's fixtures return named pairs, and six tests repeat the same fixture construction. - Drop state nothing branches on:
PlanState::Done(:1093, :1833),HostInbound's single-elementVec<Segment>with an always-zero index (:1285),SharedWindow.path/.expectedduplicating its segment (:1073), and id fields duplicating their map keys. - Naming mixes axes (
HostInbound/DeviceInboundvsHostWindow/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:
- The new test module past ~line 8420 in selene/src/disk_store.rs (so follower-attachment assertions are taken from the PR description, not read).
- The #497 interaction: both PRs touch
Staged::pump_all(selene/src/disk_store.rs:2268-2289); merge order ("merge this PR first, then rebase #497") is asserted in the description and not checkable from this branch. - helios GPU-offload path, Windows IOCP serving, discrete PCIe GPUs, live
CompositeStore/PooledStoreGPU serving — none run by the author, none reviewed here beyond the host-path code in disk_store.rs. - Whether
Headercan cheaply gain aHash/digest form (selene/src/shared/record.rs:136-154 derives PartialEq/Eq only) determines whether theWindowKeyrequest is small or structural — a maintainer/author call. - Whether coalescing belongs in
Stagedor in the disk thread (which already owns the file handle) is a maintainer design decision; the PR does not discuss the alternative. - The numeric size of the inbound_rate inflation: code shows the direction and the mechanism (see addendum entry 11), only a 1-vs-8-restore test shows the factor.
- Pending-row-read FIFO matching (
pending_row_reads, :1030-1032, :1512) is correct only if every intendedReadRowis submitted on the same disk id; a dropped submission could stalldisk_outstandingand hitCLOSE_TIMEOUT. Not traced to a conclusion — worth mentioning only if asked.
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)
-
HeaderIdentityhand-writes Hash (SHOULD FIX). disk_store.rs:1001-1050;impl Hashat :1014-1050 destructures Header with..(:1030) and hashes 14 fields. The equality contract it must track lives in another module:impl PartialEq for Headerat shared/record.rs:136-152 (exhaustive list),impl Eq:154; Header defined :116-134 with privateversionexcluded (: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.getmisses, 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 onlyself.0.key(PrefixKey derives Hash, unique per record); collisions only cost a bucket, PartialEq still compares the whole header. -
TransportEvent::InboundWindowSamplerides 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::ofmust panic — shard.rs:476-478unreachable!("window rate samples stay local to rank zero"), whereas the enum's own convention for unrepresentable kinds isErr(invalid(..))(shard.rs:462); (b) that panic is upheld only by two hand-written guards —absorb_localshard.rs:722-725 pushes andcontinues,Peer::forwardshard.rs:1148-1150 drops; (c) the existing test helperevents.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::polldoesself.stats.progress += 1for 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::applydeliberately does NOT bump progress for it (:3632-3636), so the two stores' progress counters diverge. Fix: carry the sample out of band (aStageddrain method, a field onFetched, or a counter the store reads — precedentBudget::progress()input.rs:146-152), and exclude it from composite.rs:1376. -
pick_next_pending_planrestatesLayout::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 byResources::allocate(disk_store.rs:245), memory.rs:468, composite.rs:810/:1167. The admission guard predicts whatallocatewill 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 byallocate(:1987). Fix:let needed = lock(&self.resources.transfers).layout().record_slots(plan.count, plan.row);hoisted next tofree. -
§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.
-
NIT —
inbound_ratenow measures pure disk-thread time.disk::Reply.elapsedis set only aroundworker.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 overjob.started.elapsed()fromDiskStore::fetchtoFetched(that field is gone; Fetched now only doesstats.bytes_in += bytes, :3669). Sincehit()divides by the rate (estimated_seconds: bytes / self.inbound_rate.get().max(1.0), :3625) andworth_fetching/worth_transfergate 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.CompositeStoreprices the disk part on its owndisk_inbound_rateobserved fromread_intocompletions overdisk_started.elapsed()(composite.rs:994-1004), so the two stores measure different quantities under the same name. -
NIT —
Staged::closeabandonedno 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_jobsis derived fromowners(:2513-2517) andowners.len()is folded intointernal, so maintenance is double-counted. Previously it wasowners.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. -
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 vsplan_windows(:679-727); two differentsettled()predicates in one file —Segment::settled(:661-664, file-handle terminal state) vsSharedSegment::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-detachretainclosures (:1813-1816, :1900-1904) matching on the(record, plan_index)pair that isWindowFollower's identity (:1119-1123);SharedSegment.id/SharedWindow.idduplicate their HashMap keys (:1083, :1131);disk_read_countedflags exist only to make a test counter count windows not jobs (:743, :1140, six cfg blocks);HostInboundis a one-elementVec<Segment>with an always-zero index plus a redundantSegment::reads_left;GatedCopier::wrapreturns a positional 4-tuple (:8092-8122) vs the crate's named pairs in testing.rs. -
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_intoemits 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, butTransportEventis 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)
- Blocker: 8/9 vs 7/9 at 61.3K. Resolved. Five cold-VRAM repeats against one shared 60,534-token disk checkpoint (seed 1234..1238, top_logprobs=5) produced identical FP32 top-5 logprobs and token IDs on main and at head across all five (6/9, 8/9, 7/9, 9/9, 4/9). Cause identified: 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. The narrow plausible defect site is now pinned by
misaligned_follower_attaching_to_shared_partial_tail_and_row_matches_private_restore(byte-equal SimulatedGpu pages and row vs a private baseline, skip_pages=13, partial <64-page ancestor tail plus a partial leaf chunk carrying the row). Good closure of a hard ask. - inbound_rate on logical bytes. Resolved:
InboundWindowSamplecarries only physical windowread_bytes/read_elapsed(disk_store.rs:1596-1620, pushed :1617-1620),applyfeeds the sampler and returns beforestats.progress += 1(:3632-3635),stats.bytes_instays logical (:3669), the old per-record observe is gone. Testcoalesced_restores_keep_inbound_rate_physical_and_bytes_in_logicalcovers 1 vs 8 simultaneous and staggered. - Benchmark provenance; expected cost stated as a result. Resolved: table keyed to
main c0c4f798vs0c04b1e2; costs labelled "As an expected bound" with thedevice_inbound.len() <= 1fast path noted; un-rerun multi-host RoCE moved to Not covered. - One planner, one window key, one attach helper. Resolved:
plan_windows(segments, align_to_window)(:679-727) replaced the twin splitters;HeaderIdentity/SegmentKey/WindowKey(:1001-1064) with awindow_indexHashMap give O(1)find_reusable_window(:1646-1663) and remove the per-pump PathBuf clones;has_window_credit(:1683-1687) andattach_pending(:1711-1730) replaced the duplicated attach loops. - Earlier nits. Resolved: counters gated under
#[cfg(any(test, feature = "test-support"))](:200-208, accessors :1279-1295);PlanStatereplaced bystarted: Vec<bool>;SharedWindow.path/.expectedremoved;allocate's rustdoc restored (:241-243) andfree_slotsgiven its own line (:236-239); module doc rewritten to describe per-fetch window credits, follower sharing and close-before-Fetched(:7-27). - Design rationale. The Staged-vs-DiskThread argument is now in the PR Why on technical grounds and satisfies design-review in substance; only the maintainer record remains (see Should Fix 5).
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:
shard::Kind::ofnow has to panic on it:unreachable!("window rate samples stay local to rank zero")(shard.rs:476-478). The enum's own convention for an unrepresentable kind is an error, not a panic (Err(invalid("unknown prefix record event kind")), shard.rs:462).- The panic is upheld only by two hand-written
matches!guards that must stay in sync:Sharded::absorb_localpushes the sample straight toself.eventsand continues (shard.rs:722-725), andPeer::forwardskips it (shard.rs:1148-1150). - Anything else that maps
Kind::ofover aSharded's event list panics — including the existing test helperevents.sort_by_key(|event| Kind::of(event).1)(selene/src/shard/tests.rs:339), which survives today only because those tests issue stores and unlinks and no fetch. - Test code also has to filter it by hand (disk_store.rs:6341) and match it out of the stream explicitly (:9145).
- Concrete cost:
CompositeStore::polldoesself.stats.progress += 1for every transport event before dispatch (selene/src/composite.rs:1376). That counter is documented as "Completion and capacity-release events" (selene/src/store.rs:202) and gates the maintenance pass —maintenance_progress != progress→spill_parked(...)+self.disk.maintain()(composite.rs:1418-1424). With this change each physical 64-page window read bumps progress and re-runs both, once per window per restore — the opposite of the hot-path relief the PR is after.DiskStore::applydeliberately does not bump progress for this variant (:3632-3636), so the two stores' progress counters now advance at different rates for the same work.
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
- The "unindex this window, but only if the index still points at it" body appears verbatim three times — :1525-1527, :1543-1545, :1837-1839. The
self.window_index.get(&win.key) == Some(&win_id)guard is the subtle part (it stops a newer window that reused the key from being unindexed) and it is stated three times. Extractfn unindex_window(&mut self, key: &WindowKey, id: SharedWindowId). - The follower-detach
retainclosure appears twice identically (:1813-1816, :1900-1904), matching on the(record, plan_index)pair that isWindowFollower's identity (:1119-1123) and is constructed a third time at :1690-1695. GiveWindowFolloweramatches/removemethod. Worth a one-line comment that only Pass 1 creditsrecord.bytes += win.read_bytes(:1901), because the other path detaches from a record that is being failed. - Two different lifetime predicates share the name
settled()in one file:Segment::settled(:661-664, "has this file handle reached a terminal state") andSharedSegment::settled(:1106-1109, "have this segment's disk jobs drained"). Rename one (file_settled/drained). SharedSegment.id(:1083) andSharedWindow.id(:1131) duplicate the keys they are stored under; iteratefor (&id, seg) in &self.shared_segmentsat the four use sites and delete both fields.- Dead guard:
if demand.is_empty() { 0 } else { ... }inpick_next_pending_plan(:1781-1787) —map_or(0, ..)on an empty map already yields 0. HostInbound.segmentsis aVec<Segment>with an always-zero index (Owner::HostInbound(JobId, usize), :267/:1351), soapply_diskmust tolerate an impossible missing segment (:789-791). A singlesegment: Segmentremoves the index, the tolerance, andSegment::reads_left(:658/:822/:867), which duplicates thedone == plans.len()check at :882.disk_read_countedonHostWindow(:743) andSharedWindow(:1140) exists only so thedisk_window_readscounter counts windows rather than jobs (sixcfgblocks). Either document the unit at the counter ("one per window, not perReadPages/ReadRowjob") and delete the flags, or state the flags' purpose on the fields.
4. memory.rs::windows() is now the last surviving third copy of the splitter, and GatedCopier breaks the fixture convention
memory.rs::windows()(selene/src/memory.rs:1336-1367) re-expresses the sameWINDOW_PAGESpolicyplan_windowsencodes (disk_store.rs:689-700, :719):pages.chunks(WINDOW_PAGES), row attached only to the last chunk, a row-only record getting exactly one window, an empty link getting none. Its output type differs (VecDeque<copier::Job>vsVec<WindowPlan>), so full convergence is a refactor rather than a rename; the minimum is a cross-reference comment on both sides and a test pinning the shared policy (design-review.md:74).GatedCopier::wrap(disk_store.rs:8092-8122) returns a positional four-tuple ofArc<Mutex<…>>handles; every call site destructures positionally and three discard the tail with_(:8406, :8530, :8984). The crate's fixture precedent returns named pairs (StoppedCopier,SimulatedGpu::shared_mapped, selene/src/testing.rs:178/:225). A named struct (hold,held,fail) lets each site say which gate it wants and stops a new gate renumbering every site. Test-only, no production impact.
5. PR description nits
- "Emit one
TransportEvent::InboundWindowSampleper completed physical window read" is scoped wider than the code: the sole emitter is the shared device-fetchstaging path (apply_shared_disk, disk_store.rs:1617-1620, reached viaOwner::SharedSegmentat :2339-2341). Caller-ownedread_intorestores emit none, so for aDiskStorewhose restores run throughread_into(the composite path)inbound_rateis not fed by those reads. Say "per completed shared device-fetchstaging window" and state what feeds the rate for caller-owned reads. - Two Flash-Next "Read Reduction" ratios do not match the MB columns: 7,944.9 → 1,981.1 is 4.010 but the table says 3.99x; 7,958.0 → 2,251.5 is 3.535 but it says 3.52x. The 27B rows (4.22x, 3.76x) and all four TTFT deltas check out. Add a caption sentence saying whether the column is a ratio of the tabulated means or a mean of per-trial ratios, and make the two values consistent.
- "No core re-export or format change is required" is true for re-exports, but
TransportEventis a public enum in a public module and gained a variant (disk_store.rs:97-101) — which is precisely what forces theunreachable!()at shard.rs:476-478. Say the enum gained a rank-0-local variant instead.
CHECKED AND SOUND (no action requested)
- Slot and file lifetimes. A shared window is freed only when
followers.is_empty() && disk_referenced == 0 && upload_referenced == 0(sweep_shared_windows, :1824-1843); attach paths incrementfollowers; every disk submission incrementsdisk_referencedand every uploadupload_referenced; the decrement paths inapply_shared_disk(:1594) andapply_device_transferrun before any release decision, so a reply can never arrive for a freed window. Segment removal needs no users andsettled()(Pass 5e, :2213-2230).allocate(plan.count, plan.row)matchesrecord_slots, and each new test assertspool.free_slots() == pool.slot_count()— the right property rather than a mock. - Failure isolation. A private child or follower GPU-upload error fails only that restore (
record.fail, :1538-1553, :1652-1660). A shared segment open or read error is converted withwith_record_read()and fails every attached restore after in-flight I/O drains (fail_segment_users:1509-1536,fail_window:1620-1638), andDiskStore::applystill routesis_record_read()failures toindex.drop_row(:3676-3682). The "don't swallow the error" rule holds. - Host path unchanged.
read_intokeepsplan_windows(..., false)(:1349), private per-restore opens and unaligned packing;CompositeStore::start_readuses only that path, so live composite serving sees no behavioural change. Keeping caller-owned host reads off the shared path is the right call — those buffers have caller-defined lifetimes (design-review principle 6). - No compatibility break. Records stay immutable and pinned;
Headerand the on-disk layout are untouched; no core re-export change;HeaderIdentity's field list mirrorsHeader'sPartialEqexactly, so the sharing key cannot collide two headers that compare unequal (Nit/Should Fix 2 is about maintainability, not a current collision);WINDOWS_IN_FLIGHTstill derives fromcrate::shared::WINDOW_CREDITS(:60). Files written before this PR load unchanged. - No scope expansion, no architectural violation, no knob. No CPU/non-NVIDIA path, no backend swap, no orchestration, no serving-path change; no CUDA in
selene, no model knowledge, no per-model special case, no env var, no recipe field. Sharing is derived from(path, expected Header)identity (HeaderIdentity/SegmentKey, :1001-1064, acquisition :1425-1462) so it generalises as the charter requires. The only new conditional compilation is the diagnostic counters. - Correctness of the concurrency argument.
build_pending_demandshort-circuits atdevice_inbound.len() <= 1(:1651), so a lone restore behaves exactly as before;has_window_credit/attach_pendingkeep every attach within the two-window budget before a finished slot can release;pump_allruns maintenance, outbound, host-inbound, then device (:2291-2312), consistent with the stated #497 merge-order note;pending_row_readspushes only insidesubmit_disk'sOk(())arm, so the FIFO reply matching cannot be left with an unmatched entry. - Tests exercise the real path. Byte-exact
SimulatedGpupage and row assertions in every coalescing test (e.g. :8368-8379), counters incremented at the realsubmit_disk/submit_transfersites rather than in mocks (AGENTS.md:194-199). The shared fixtureswrite_shared_ancestor_treeandpoll_all_fetchesare used by five of the seven new tests, so they are not scaffolding. - Scale. +3313/−931 in
disk_store.rsis large but not churn under AGENTS.md:188-193: the host path must stay private, the device path genuinely needs per-file and per-window reference state, and the eight passes ofpump_device_inboundeach carry an ordering argument the others depend on (attach before sweep, reads before uploads, close beforeFetched). No different shape is being requested.
OPEN QUESTIONS
- The numeric size of the
estimated_secondsoptimism (Nit 1) needs a run or an instrumented test; the code shows only the direction. - Whether
Headershould gainHash/a digest form at all, versus hashingPrefixKeyonly (Should Fix 2) — a maintainer/author call; either fix removes the drift hazard. - Whether one of the two layering fixes for Should Fix 1 (
Stageddrain method vs counters inStoreStats) is preferred — internal API shape, a maintainer call. Folding the physical counters intoStoreStats(#185-244) would also make coalescing visible to operators, which today it is not outside tests. - The #497 rebase of
pump_all: both PRs touch it; whoever merges second must confirm the merged order still runshost_inboundandpump_device_inboundahead of writes and maintenance. Not checkable from this branch. - Out of scope and unverified here, as the description itself states: multi-host RoCE serving, 2-GPU
split_pools, discrete PCIe GPUs, Windows serving, liveCompositeStore/PooledStoreGPU serving. - This review had no toolchain, GPU or test run available; every finding is established from source at the head commit. No instructions were embedded in the reviewed material.
#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
- Take the rate sample off the cross-rank completion enum.
TransportEvent::InboundWindowSamplecarries noJobIdbut joins the enum documented as "completion the transport reports", which forces anunreachable!()inKind::ofupheld by two hand-written guards, panics any otherKind::ofcaller (including the shard test helper), and makesCompositeStore::pollbumpstats.progress— and so re-runspill_parked+disk.maintain()— once per physical window. Carry it out of band (aStageddrain method or a field onFetched) and keepprogressmeaning "completions". - Move
HeaderIdentity's hand-writtenHashnext to the equality it tracks. It hashes 14 fields through a..pattern, so a newHeaderfield silently drops out of the hash and coalescing stops working with no test failure; it is also the only manualHashinselene/srcwhere the crate derives. GiveHeaderaHashimpl beside itsPartialEq(or hash onlyPrefixKey) and add ana == b ⇒ hash(a) == hash(b)test. - Call
Layout::record_slotsinstead of restating it. The admission guard inpick_next_pending_planrecomputespages + row_slotsby hand whileResources::allocate— the function it is predicting — usesrecord_slots; two formulas for one cost will diverge. One-line change, hoisted besidefree. - Split the §2.4 bullet and stop stating the metrics contract twice. The new 30-line, ~250-word paragraph is accurate but carries twelve behaviours, and the
bytes_in/inbound_ratestatement is repeated at :1528-1531. Keep mechanism prose in §2.4, limits and failure scope as bullets, metrics only in §4. - Get the design decision recorded. The Staged-vs-DiskThread argument now in Why is sound; ask a maintainer to record the choice to put a second inbound lifecycle inside
Stagedrather than in the disk thread that owns the handle (AGENTS.md:204-206). No code change.
Nits
inbound_ratenow measures pure disk-thread time (disk::Reply.elapsedwraps onlyworker.execute), sohit()'sestimated_secondsprices restores optimistically by the staging/upload share — the mirror of the inflation just fixed, and inconsistent withCompositeStore's own disk rate. Document it as device bandwidth or include the per-record wait.Staged::close'sabandonedis amaxover map sizes and job counts, so a lone leaked window reports "1 disk transport jobs did not complete"; count owned jobs or report leaked staging separately. Same paragraph:demand.is_empty()guard is dead, and the twosettled()predicates share a name for different lifetimes.- Three verbatim "unindex if still ours" blocks and two identical follower-detach closures — extract
unindex_windowand giveWindowFolloweramatches/remove; drop theidfields that duplicate their map keys. - Shrink the host-inbound and fixture state: single
Segmentinstead of a one-elementVecwith an always-zero index (also dropsreads_left); documentdisk_read_countedor delete it;GatedCopier::wrapshould return a named struct, not a positional four-tuple. - Description nits: scope the sample to shared device-
fetchwindows (read_intoemits none), reconcile the two Flash-Next read-reduction ratios (4.01x/3.54x from the MB columns, not 3.99x/3.52x) and say whether the column is a ratio of means, and note thatTransportEvent— a public enum — did gain a variant.
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):
Qwen3.8-27B-NVFP4TP1, 60.5K, Simultaneous: physical NVMe read 18,177.5 -> 4,306.7 MB (-76.3%), 4.22x, burst median TTFT 7,974.6 -> 5,662.8 ms (-29.0%).Qwen3.8-27B-NVFP4TP1, 60.5K, +25 ms stagger: 18,194.2 -> 4,843.6 MB (-73.4%), 3.76x, TTFT 6,883.6 -> 5,951.9 ms (-13.5%).Qwen3.8-Flash-NextTP1, 61.0K, Simultaneous: 7,944.9 -> 1,981.1 MB (-75.1%), 3.99x, TTFT 3,327.5 -> 3,225.0 ms (-3.1%).Qwen3.8-Flash-NextTP1, 61.0K, +25 ms stagger: 7,958.0 -> 2,251.5 MB (-71.7%), 3.52x, TTFT 3,137.7 -> 3,049.9 ms (-2.8%).
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):
- Entry #20 = FULL REPORT (final). Structure: verdict; resolved-since-last-round; Blockers (none); Should Fix 1-5; Nits 1-5; checked-and-sound; open questions.
- Entry #21 = SUMMARY REPORT (final, exactly 10 bullets: 5 should-fix + 5 nits, no blocker section, opens "Approve with Should-Fix (no blockers)", includes the case-file link).
- Entry #19 = the five new findings with every file:line citation (threads 1-8).
- Entry #18 = what was resolved at this head (do not re-raise) and the cross-lens verdicts.
- Entry 22/latest = evidence inventory at this head (benchmark table, parity result, suite counts, Not covered).
- Entries #1-#8 describe the OLD head f9c9191; use them only for background, never for verdicts or line numbers.
- Case-file link used in the summary: https://autobot.eidonix.com/api/v1/cases/774e16ea-5f84-4ff8-9166-74ab6876cc37.html
LENS GRADES AT THIS HEAD (from this round's agent reports):
- Architecture/scope B: "No blocking findings." Should fix = the InboundWindowSample layering; nit = inbound_rate now pure disk-thread time; held = maintainer record of the Staged-vs-DiskThread decision. Scope verdict: 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 rejection criterion tripped (no scope expansion :171-175, no architectural violation :176-181, no per-model case/flag/knob, no format or re-export break, failure isolation preserved :182-187).
- Conventions/duplication C: should fix = HeaderIdentity manual Hash; InboundWindowSample in the completion enum; pick_next_pending_plan restating record_slots. Nits = memory.rs::windows third splitter, close() abandoned count + two settled() predicates, repeated unindex blocks/follower-detach closures, GatedCopier 4-tuple, the 250-word §2.4 bullet stating metrics twice. Description nit: "No core re-export or format change" overstates because TransportEvent gained a variant.
- Simplicity D: "Verdict: clean. No blocking, no should-fix findings in this lens." Seven nits, each a small deletion. Explicitly does NOT ask for the 8-pass pump to be reshaped; estimates ~215-230 removable lines (~6% of the change).
- Correctness: "No blocking or should-fix findings." All three prior items verified fixed. Nits: composite.rs:1376 progress tick for samples; a shared window whose ReadRow is deferred under disk-queue saturation can sit un-sampled until a later pump (invariant "phase == Reading ⇒ a pending submission or outstanding reply" is load-bearing and undocumented, disk_store.rs:2113-2116).
- Prose: no blocking or should-fix; three description nits (sample scoped wider than code; two Flash-Next ratios mismatch + caption ambiguity; "no format change" wording). Docs §2.4/§4 verified accurate; commit message fine.
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:
- HashMap soundness needs
a == b ⇒ hash(a) == hash(b). Hashing FEWER fields thaneqcompares keeps that implication TRUE. Omitting a field only makes the hash COARSER → more bucket collisions inwindow_index(disk_store.rs:1229; lookupsfind_reusable_window:1646-1663) → slower, never wrong.eqstill separates the colliding entries. - The genuinely unsound direction is a field IN
hashbut NOT inPartialEq— e.g. ifversionwere hashed. It is excluded from both, correctly. - So the real cost is: (a) collision/slower index on a future coarse hash, (b) a cross-module contract (record.rs equality vs disk_store.rs hash) the compiler cannot check and no test pins, (c) a
..rest pattern that makes the omission invisible in review.
LIVE DRIFT ALREADY EXISTS ON main (verified, ref=main, selene/src/shared/record.rs):
- main :123-142
Headerhas gainedpub packed: Option<Arc<packed::Layout>>at :127 (this branch predates it). - main :144-160
impl PartialEqcomparesself.packed == other.packedFIRST (:146). - Consequence on rebase/merge: equality includes
packed, this branch's hash does not → coarser hash, more collisions in window_index. NOT a correctness bug; a real, already-scheduled maintainability drift. - Conventions lens independently reached this same correction ("fails safe — it costs hash collisions, not correctness").
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):
-
TransportEventenum, 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. -
Kind::of, shard.rs:466-486. Every arm returns(Kind, JobId, Result<u64>).InboundWindowSamplearm :476-478 =unreachable!("window rate samples stay local to rank zero"). Confirms Kind::of is no longer total over its own input domain. -
CompositeStore::poll, composite.rs:1365-1430. Per-eventself.stats.progress += 1at :1376 BEFORE the dispatch match (:1377-1385) — fires for InboundWindowSample too. Maintenance gate:let progress = self.stats().progress;:1418, thenif !self.disk.preserve_committed && (self.maintenance_progress != progress || retry):1420, body callsself.spill_parked(...):1427 andself.disk.maintain():1428. CONFIRMED: each physical window read re-arms spill+maintain. -
DiskStore::apply, disk_store.rs:3630-3638.if let TransportEvent::InboundWindowSample { bytes, elapsed } = event { self.inbound_rate.observe(bytes, elapsed); return; }:3632-3635 thenself.stats.progress += 1:3636, and a secondunreachable!()arm :3638. Confirms the two stores' progress counters diverge for the same work (a 2nd unreachable!() lives in the enum's own consumer). -
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. -
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_slotsvialock(&self.resources.transfers).layout().row_slots():1767-1771, thenlet 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-1787let peer_demand = if demand.is_empty() { 0 } else { demand.get(..).map_or(0, |t| t.saturating_sub(1)) };— map_or(0) already yields 0. -
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. -
DUPLICATE metrics contract confirmed: docs :1528-1531 in §4 = "On
DiskStore,StoreStats.bytes_incounts logical checkpoint bytes restored to GPU destinations across completed fetches, whileStoreStats.inbound_ratemeasures 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. -
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. -
Test boilerplate duplication confirmed at disk_store.rs:8300-8329 (
concurrent_burst_...): identical 2-line pool setup (:8313-8314) + 13-lineDiskStore::new(...)(:8316-8329) repeated across ~10 new tests; the same 4-linerecordsvec at :8306-8309.
LENS AGREEMENT THIS ROUND (no blockers anywhere):
- Architecture: no blockers; 5 should-fix (enum/sample, hash, record_slots, docs, maintainer record) + 1 nit (inbound_rate optimism) + 2 open questions on #497.
- Conventions: no blockers; 3 should-fix (hash — corrected to "fails safe", enum, record_slots) + 6 nits (memory.rs:windows third copy, close() message, two settled(), repeated unindex/detach idioms, GatedCopier 4-tuple, §2.4).
- Simplicity: no blockers; 4 should-fix (docs, record_slots, hash, close abandoned) + 4 nits (HostInbound Vec, duplicate id fields, dead guard, disk_read_counted flags). Judged +3313/−931 NOT churn.
- Correctness: NO blockers, NO should-fix; only 2 nits (composite progress / maintenance amplification; unsampled window when disk queue full, disk_store.rs:2113-2116). Explicitly re-verified the previous three should-fix are fixed.
- Prose: no blockers; 1 should-fix (docs §2.4) + 3 description nits (InboundWindowSample scope broader than code; Flash-Next 3.99x/3.52x vs 4.010/3.535 MB ratios; arrival-order relaxation not disclosed).
- Subtractive: no blockers; ~370-410 removable lines; 5 should-fix (test boilerplate ~90-110, demand scheduler ~65-80, close-drain test dup ~70, ObservedTransport ~60-75, HeaderIdentity ~50) + 5 nits; explicitly found nothing left dead behind the change.
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)
- Blocker — 8/9 vs 7/9 at 61.3K. Closed with five cold-VRAM repeats (seeds 1234..1238, 60,534 tokens, top_logprobs=5) against one shared disk checkpoint: identical FP32 top-5 logprobs and token IDs on main and at head in all five. Cause identified — Flare has no greedy
temperature = 0(helios clamps into the core's positive sampling range) and the first script used distinct per-build prompt nonces. Pinned further bymisaligned_follower_attaching_to_shared_partial_tail_and_row_matches_private_restore(byte-equalSimulatedGpupages and row vs a private baseline,skip_pages = 13, partial <64-page ancestor tail plus a partial leaf chunk carrying the row). inbound_rateon logical bytes. Fixed: the sample carries only physical windowread_bytes/read_elapsed(disk_store.rs:1596-1620),applyfeeds the sampler and returns beforestats.progress += 1(:3632-3635),bytes_instays logical, and the live rank-0 metric confirms it — 6.07 GB/s single vs 7.71 GB/s 8-way simultaneous and 6.02 GB/s staggered onQwen3.8-27B-NVFP4.- Benchmark provenance; expected cost stated as a result. Fixed: table keyed to
main c0c4f798vs0c04b1e2; the single-restore cost is labelled "As an expected bound" with thedevice_inbound.len() <= 1fast path named; un-rerun multi-host RoCE moved to Not covered. - One planner, one window key, one attach helper. Fixed:
plan_windows(segments, align_to_window)(:679-727) replaced the twin splitters;SegmentKey/WindowKey+window_indexgive O(1)find_reusable_window(:1646-1663) and drop the per-pumpPathBufclones;has_window_credit(:1683-1687) andattach_pending(:1711-1730) replaced the duplicated attach loops. - Earlier nits. Fixed: counters gated
#[cfg(any(test, feature = "test-support"))](:200-208, accessors :1279-1295);PlanState→started: Vec<bool>;SharedWindow.path/.expectedremoved;allocate's rustdoc back onallocate(:241-243) withfree_slotson its own line (:236-239); module doc rewritten (:7-27). - Design rationale. The Staged-vs-DiskThread argument is now in the PR Why on technical grounds and discharges the design-review ask in substance. Only the maintainer record remains (Should Fix 5).
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:
Kind::ofis no longer total over its own input domain. Every arm returns(Kind, JobId, Result<u64>); this one cannot, so it panics —unreachable!("window rate samples stay local to rank zero")(shard.rs:476-478). The enum's own convention for an unrepresentable input is an error, not a panic (Err(invalid("unknown prefix record event kind")), shard.rs:462).- A second
unreachable!()exists in the variant's own consumer:DiskStore::applymatches it at :3632 and must then re-armTransportEvent::InboundWindowSample { .. } => unreachable!()at :3638 to keep the match exhaustive. - The panic is upheld only by two distant hand-written guards that must stay in sync:
Sharded::absorb_localre-pushes the sample intoself.events(shard.rs:722-725) andPeer::forwarddrops it (shard.rs:1148-1150). A third consumer added later panics at runtime instead of failing to compile. - The existing test helper would break:
events.sort_by_key(|event| Kind::of(event).1)(selene/src/shard/tests.rs:339) survives only because those tests issuestore_empty/unlink/truncateand never a fetch. - Concrete cost in serving:
CompositeStore::pollincrementsself.stats.progress += 1for every transport event before dispatch (composite.rs:1376), and that counter gates maintenance —if !self.disk.preserve_committed && (self.maintenance_progress != progress || retry)(composite.rs:1420) →spill_parked(...)(:1427) +self.disk.maintain()(:1428). So each physical 64-page window read now re-arms a spill and a maintenance pass, once per window per restore — the opposite of the hot-path relief this PR is after.StoreStats.progressis documented as "Completion and capacity-release events" (store.rs:202); a bandwidth sample is neither, andDiskStore::applydeliberately does not count it, so the two stores' progress counters now advance at different rates for the same work.
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:
HashMapsoundness requiresa == b ⇒ hash(a) == hash(b). Hashing fewer fields thaneqcompares keeps that implication true. The hash merely becomes coarser: colliding entries still land in the same bucket and are still separated byeq. Cost: slowerwindow_indexlookups (disk_store.rs:1229,find_reusable_window:1646-1663), never wrong results.- The genuinely unsound direction is the reverse — a field in
hashbut not inPartialEq. Todayversionis excluded from both, correctly, so there is no present soundness bug. - What survives as real risk: the contract is split across two modules with no derive for the compiler to police and no test to catch a divergence, and the
..rest makes any omission invisible in review.
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
- Description (prose). (a) "Emit one
InboundWindowSampleper completed physical window read" is scoped wider than the code: the sole emitter is the shared device-fetchpath (:1617-1620), so caller-ownedread_intonever feedsDiskStore::inbound_rate; docs :362-366 and :1528-1531 inherit the broad phrasing. (b) Two Flash-Next "Read Reduction" values (3.99x, 3.52x) do not equal the ratio of the tabulated MB means (4.010, 3.535) and the caption does not say which derivation was used; the four TTFT deltas and both 27B ratios do check out. (c) The arrival-order relaxation documented at :350-354 is not mentioned in the description, and no per-request tail latency is reported beside the burst medians. (d) "No core re-export or format change" is true for re-exports, butTransportEventis a public enum that gained a variant. - Tests. ~10 new coalescing tests each rebuild the identical 13-line
DiskStore::new(...)plus 2-line pool setup (e.g. :8313-8329) — roughly 90-110 lines recoverable with astaged_store(...)helper and no coverage lost.staged_close_drains_active_coalesced_fetches_cleanly(:8830-8906) duplicatesconcurrent_burst_...(:8293-8384) apart fromclose()before polling; one test loopingfor close_early in [false, true]covers both.ObservedTransport(:9110-9160) delegates eight methods toStagedonly to recompute a rate the store already reports. - Small:
HostInboundis a one-elementVec<Segment>with an always-zeroOwner::HostInbound(JobId, usize)index (:265-267, :749-750, constructed only at :1351-1360);SharedSegment.id/SharedWindow.idduplicate theirHashMapkeys (:1083, :1131); the dead guardif demand.is_empty() { 0 } else { ... }(:1781-1787) adds nothing overmap_or(0, ..);GatedCopier::wrapreturns a positional 4-tuple (:8092-8122) where this crate's fixtures use named handles (testing.rs:178, :225);disk_read_counted(:743, :1140) exists only to make a test counter count windows rather than jobs.
CHECKED AND SOUND — no action requested
- Scope fits the charter. Fixes a measured performance problem on a served workload (charter line 35, AGENTS.md:165-166), inside the subsystem the charter names (line 24). No rejection criterion is crossed: no CPU/non-NVIDIA path, no interchangeable backend, no training, no routing, no orchestration; no per-model branch (coalescing keys on
SegmentKey/WindowKeyidentity, not model identity — charter line 43); no new flag, env var or recipe knob. - No compatibility break. No
Headeror on-disk format change, no wireKindchange (the sample is never forwarded), no core re-export change;WINDOWS_IN_FLIGHTstill derives fromcrate::shared::WINDOW_CREDITS. Records stay immutable and pinned; files written before this PR load unchanged. - Slot and file lifetimes. A shared window is freed only when
followers.is_empty() && disk_referenced == 0 && upload_referenced == 0(:1755-1771); every disk submit and upload increments before the risk window and decrements before any release decision, so a reply can never arrive for a freed window and no slot is released while aCopierupload is outstanding. Segment close is submitted only after the last user's I/O drained. - Failure isolation. Shared open/read errors fail every attached restore after in-flight I/O drains and route through
with_record_read()so only the lookup row is invalidated (:1509-1536, :1560-1575, :3676-3682); a private child or GPU-upload error fails one restore. - Host path not penalised.
read_intokeepsplan_windows(..., false)(:1349), private opens and unaligned packing, soCompositeStore's caller-owned buffers see no behavioural change and gain no extra job; the "at most one extra partial window per segment" cost applies only to device restores and is disclosed. - Fast path real.
build_pending_demandreturns immediately whendevice_inbound.len() <= 1(:1734-1738), so a lone restore behaves exactly as before. - Scale is not churn. +3313/−931 is load-bearing: the host path must stay private, the device path genuinely needs per-file and per-window reference state to keep uploads independent and failures isolated, and the eight passes of
pump_device_inboundeach carry an ordering argument the others depend on. Nothing is left dead behind the change; the replacedDestination/InPhase/attach_transfercode is deleted in the same diff. - Tests exercise the real path. Byte-exact
SimulatedGpupage and row assertions, physical open/window counts read at the real submit sites, andpool.free_slots() == pool.slot_count()after every test — the property, not a mock (AGENTS.md:194-199). - Description quality. Four-part scheme in order, expectation separated from measurement, limitations and unrun checks disclosed,
Discord: Doonerpresent.
OPEN QUESTIONS
- Size of the
estimated_secondsoptimism (N1) — needs one measured single-restore admission-to-Restoretime vshit().estimated_seconds. - Which shape for S1's out-of-band sample (
Stageddrain, a field onFetched, or counters inStoreStats) — internal API shape, author's call; folding it intoStoreStatswould also make coalescing visible to operators. - Maintainer sign-off on S5 — nothing in the thread records one.
- #497 reconciliation: both PRs touch
Staged::pump_all; whoever merges second must confirm the resolved order still runshost_inboundandpump_device_inboundahead of writes and maintenance, and re-check S1 against the new ordering. - 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 > 0test overwindow_index. - The
Unopenedshared-segment case inStaged::close(N2) — whether it is meant to be covered byinternalor already bystore_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:
- None. All five review lenses agree at this head. Correctness re-verified that the three defects it previously raised are fixed and found nothing new; nothing is left dead behind the change.
Should fix:
- Take the rank-local rate sample off the cross-rank completion enum.
TransportEvent::InboundWindowSample(disk_store.rs:97-101) is the one variant with noJobIdin an enum documented as "Completion the transport reports to the disk store" (:83). It forces twounreachable!()s (shard.rs:476-478, disk_store.rs:3638) upheld by hand-written guards (shard.rs:722-725, :1148-1150), and makesCompositeStore::pollbumpstats.progress— re-runningspill_parked+disk.maintain()— once per physical window (composite.rs:1376, gate :1420-1428). → Carry it out of band (aStageddrain method or a field onFetched) and keep it out of the composite progress count. - Move
HeaderIdentity's hand-writtenHashbeside the equality it tracks. It hashesHeader's fields through a..pattern (disk_store.rs:1014-1050) againstPartialEqdefined in another module (shared/record.rs:136-152), with no test pinning agreement. Severity, stated precisely: a mismatch here fails safe — a coarser hash only costs bucket collisions inwindow_index, never wrong results — butmainhas already added apackedfield toHeader's equality that this branch omits, so the drift is live. → ImplementHashforHeaderin shared/record.rs and letSegmentKey/WindowKeyderive; add ana == b ⇒ hash(a) == hash(b)test. - Call
Layout::record_slotsinstead of restating it. The admission guard recomputespages + row_slotsby hand (disk_store.rs:1777) while the allocator it predicts usesrecord_slots(geometry.rs:180-182, disk_store.rs:245). → One line, hoisted besidefree; a guard must use the allocator's own arithmetic. - Split the §2.4 bullet and state the metrics contract once. docs/prefix-cache-offload.md:337-366 is one ~250-word paragraph carrying ~12 behaviours, burying the two limits a reviewer needs; the
bytes_in/inbound_ratecontract repeats at :1528-1531. → Mechanism in §2.4, limits and failure scope as short bullets, metrics only in §4. - Record the design decision (process, no code change). The Staged-vs-DiskThread argument in Why is sound, but a second inbound lifecycle inside
Stagedis an invariant-level choice that AGENTS.md:201-206 says a maintainer must record explicitly — a PR Why is not that record. → Ask a maintainer to sign off on the PR before merge.
Nits:
inbound_ratenow prices restores optimistically. The sample measures onlyworker.execute(disk.rs:448-450) — no slot wait, copier queue or upload — yet feedsestimated_seconds(disk_store.rs:3625) andworth_fetching/worth_transfer;CompositeStoremeasures a different quantity under the same name (composite.rs:994-1004). → Document it as device read bandwidth, or include the wait in the sample.Staged::closereports a non-job count as a job count.abandonedis a.max()over map sizes includingshared_windows(:2522-2528), reported as "N disk transport jobs did not complete" (:2540-2544). → Report the store-job sum, or word it as "still busy" wherebusy()already answers.- Two
settled(), three repeated unindex blocks, two identical detach closures.Segment::settled(:662-664) andSharedSegment::settled(:1106-1109) mean different things under one name; the subtle "only unindex if it still points at me" guard is written three times (:1525, :1543, :1837). → Rename onesettled, extractunindex_window, and comment why the two detach paths credit bytes differently. memory.rs:1336-1367is now the last copy of theWINDOW_PAGESsplitter this PR just unified intoplan_windows(:682-727); drift would make host-tier and disk-tier window boundaries disagree. → Share one implementation.- Description and test residue. Say the sample comes from shared device-
fetchwindows only (read_intonever feeds it) and thatTransportEvent— a public enum — gained a variant; reconcile the two Flash-Next ratios (3.99x/3.52x vs 4.010/3.535 for the tabulated means); ~10 new tests repeat the same 13-lineDiskStore::newsetup (~90-110 lines recoverable).
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:
- None. All five review lenses agree at this head. Correctness re-verified that the three defects it previously raised are fixed and found nothing new; nothing is left dead behind the change.
Should fix:
- Take the rank-local rate sample off the cross-rank completion enum.
TransportEvent::InboundWindowSample(disk_store.rs:97-101) is the one variant with noJobIdin an enum documented as "Completion the transport reports to the disk store" (:83). It forces twounreachable!()s (shard.rs:476-478, disk_store.rs:3638) upheld by hand-written guards (shard.rs:722-725, :1148-1150), and makesCompositeStore::pollbumpstats.progress— re-runningspill_parked+disk.maintain()— once per physical window (composite.rs:1376, gate :1420-1428). → Carry it out of band (aStageddrain method or a field onFetched) and keep it out of the composite progress count. - Move
HeaderIdentity's hand-writtenHashbeside the equality it tracks. It hashesHeader's fields through a..pattern (disk_store.rs:1014-1050) againstPartialEqdefined in another module (shared/record.rs:136-152), with no test pinning agreement. Severity, stated precisely: a mismatch here fails safe — a coarser hash only costs bucket collisions inwindow_index, never wrong results — butmainhas already added apackedfield toHeader's equality that this branch omits, so the drift is live. → ImplementHashforHeaderin shared/record.rs and letSegmentKey/WindowKeyderive; add ana == b ⇒ hash(a) == hash(b)test. - Call
Layout::record_slotsinstead of restating it. The admission guard recomputespages + row_slotsby hand (disk_store.rs:1777) while the allocator it predicts usesrecord_slots(geometry.rs:180-182, disk_store.rs:245). → One line, hoisted besidefree; a guard must use the allocator's own arithmetic. - Split the §2.4 bullet and state the metrics contract once. docs/prefix-cache-offload.md:337-366 is one ~250-word paragraph carrying ~12 behaviours, burying the two limits a reviewer needs; the
bytes_in/inbound_ratecontract repeats at :1528-1531. → Mechanism in §2.4, limits and failure scope as short bullets, metrics only in §4. - Record the design decision (process, no code change). The Staged-vs-DiskThread argument in Why is sound, but a second inbound lifecycle inside
Stagedis an invariant-level choice that AGENTS.md:201-206 says a maintainer must record explicitly — a PR Why is not that record. → Ask a maintainer to sign off on the PR.
Nits:
inbound_ratenow prices restores optimistically. The sample measures onlyworker.execute(disk.rs:448-450) — no slot wait, copier queue or upload — yet feedsestimated_seconds(disk_store.rs:3625) andworth_fetching/worth_transfer;CompositeStoremeasures a different quantity under the same name (composite.rs:994-1004). → Document it as device read bandwidth, or include the wait in the sample.Staged::closereports a non-job count as a job count.abandonedis a.max()over map sizes includingshared_windows(:2522-2528), reported as "N disk transport jobs did not complete" (:2540-2544). → Report the store-job sum, or word it as "still busy" wherebusy()already answers.- Two
settled(), three repeated unindex blocks, two identical detach closures.Segment::settled(:662-664) andSharedSegment::settled(:1106-1109) mean different things under one name; the subtle "only unindex if it still points at me" guard is written three times (:1525, :1543, :1837). → Rename onesettled, extractunindex_window, and comment why the two detach paths credit bytes differently. memory.rs:1336-1367is now the last copy of theWINDOW_PAGESsplitter this PR just unified intoplan_windows(:682-727); drift would make host-tier and disk-tier window boundaries disagree. → Share one implementation.- Description and test residue. Say the sample comes from shared device-
fetchwindows only (read_intonever feeds it) and thatTransportEvent— a public enum — gained a variant; reconcile the two Flash-Next ratios (3.99x/3.52x against 4.010/3.535 for the tabulated means); ~10 new tests repeat the same 13-lineDiskStore::newsetup (~90-110 lines recoverable).
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:
- FULL REPORT: entry #28.
- SUMMARY / GitHub POST: entry #30.
- Supporting: #26 (the Hash correction + live
packeddrift on main), #27 (line-verified citation inventory at this head), #31 (case-file URL placeholder + verdict-change note), #23 (PR-description evidence numbers: benchmark table, parity repeat, suite counts, Not-covered list).
SUPERSEDED — do not use:
- #20 (full report) and #21 (summary) — earlier drafts at this head, written BEFORE the Hash-direction correction in #26. #20/#21 still describe the hash as "coalescing stops", which #26 corrects.
- #29 — an earlier draft of the summary with the same content as #30 but WITHOUT the "No new commits since the last review" framing that makes the verdict change transparent. #30 replaced it for that reason.
- #9/#10/#12/#13 — from the older head
f9c9191; they carry a 1-blocker verdict (the 8/9-vs-7/9 parity result) that is now resolved, so they must not be reused. - #1–#6, #11 — findings inventory from the older head, several since resolved (#18 lists the resolutions).
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
- Every blocker and should-fix from the previous round is resolved at this head, in code and not only in prose.
TransportEvent::InboundWindowSampleis gone (TransportEventatselene/src/disk_store.rs:84-106is six job completions, each carrying aJobId), so the twounreachable!()s, theKind::oftotality hole andCompositeStore's per-windowstats.progressinflation are all resolved;Hash for Headernow sits besidePartialEq(selene/src/shared/record.rs:165-202, exhaustive destructure,version: _) andHeaderIdentity::hashdelegates (disk_store.rs:1452-1456);pick_next_pending_plancallslayout.record_slots(plan.count, plan.row)with one hoisted transfers lock (:2307-2320); §2.4 is split into mechanism/invariants/limits (docs/prefix-cache-offload.md:424-448) with the metrics contract stated once, in §4 (:1612-1617);Staged::closeseparates abandoned jobs from leaked shared staging (:3192-3225). - The change belongs in the repository and in the layer it chose. It fixes a measured performance problem on a served workload — the charter's merge criterion (charter line 35, "a measured performance/memory issue"; AGENTS.md:165-166) — inside the subsystem the charter names (line 24). No rejection criterion is crossed: no per-model branch (coalescing keys on
SegmentKey/WindowKey,:1458-1470, derived from(path, expected Header)), no new flag/env var/recipe knob, no on-disk or record-format change, noTransportEventvariant, no public re-export change.read_into/read_into_packedstay private onHostInboundand keepplan_windows(..., false)(:1851), soCompositeStore's caller-owned buffers see no behavioural change. - The core soundness argument holds on inspection: a shared window is freed only when
followers.is_empty() && disk_referenced == 0 && upload_referenced == 0(sweep_shared_windows,:2361-2378); a shared segment is removed only whenusers.is_empty() && disk_settled()(:2929-2954,disk_settled:1512-1515), and Pass 5e holdsFetcheduntil every shared segment is settled (:2894-2944), so no disk read outlives the caller's index pin; segment reuse is gated toreusable()(:1504-1510) so aClosing/Closedhandle is never revived. - Evidence meets the bar. A
flare runtable on real hardware with physical-read and TTFT deltas (27B simultaneous 18,177.5 → 4,306.7 MB,4.22x, TTFT 7,974.6 → 5,662.8 ms onQwen3.8-27B-NVFP4TP1; 7,944.9 → 1,981.1 MB,4.01x, onQwen3.8-Flash-Next), a live demonstration of the physical/logical split (6.07 GB/s single vs 7.71 GB/s eight-way), and an explicit "Not covered" list (live SM121--lossless-kv-compression cpu|gpuserving, a post-rebase raw SM121 A/B, multi-host RoCE, 2-GPUsplit_pools, discrete PCIe, Windows serving, live warm-plus-disk/PooledStoreHTTP serving). The residual 27B FP32 parity question was settled by five cold-VRAM repeats. - What remains is small and mostly subtractive: one duplication that must be fixed before a future
packed::Layoutedit can silently corrupt restored pages (§Subtract 1), four removals worth ~290–335 lines, and twelve nits.
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:
selene/src/disk_store.rs:1333-1345— private host path,submit_readsforread_into_packed(overflow error at:1345);selene/src/disk_store.rs:2650-2667— shared device path,Job::ReadPackedfrom the shared segment (overflow handled at:2661-2667);selene/src/pool/pins.rs:338-351— the pre-existing packed put window.
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
- Scope and layer. A measured win on a served workload (charter line 35), inside Selene's disk tier (line 24); no rejection criterion crossed; no per-model branch, flag, env var or recipe knob (charter line 43, AGENTS.md:188-193). This PR adds none; checked.
- Identity is derived, not declared.
SegmentKey(:1458-1462) andWindowKey(:1464-1470) key off(path, expected Header); no caller passes an opt-in and no new configuration switch exists. - Hashing cannot alias two distinct records.
Hash for Header(shared/record.rs:165-202) is an exhaustive destructure skipping only non-semanticversion, matchingPartialEq(:144-160);Eq/Hash for packed::Layout(shared/packed.rs:99-141) destructureLayout,PackedOfferandPackedUnitexhaustively, andoffsets/pagesderive fromofferplus ranks;header_eq_implies_same_hash(record.rs:2229-2306) pins version-insensitivity,createdsensitivity and raw-vs-packed distinction. A missed field would fail safe (coarser hash, slower lookup), and no field is inhashbut notEq. - Admission and allocation use the same arithmetic.
pick_next_pending_planrequireslayout.record_slots(plan.count, plan.row) <= freefor raw windows and zero slots for v4 packed (:2314-2321), the same helperResources::allocateuses (:254, definitionselene/src/geometry.rs:209). - Window/segment lifetime. As in Key Findings; plus
unindex_windowcompares window ids (:2030-2038) so a stale index entry cannot be inherited, andReadRowreplies are matched FIFO throughpending_row_reads(:2748), exact becausedisk::Workerexecutes jobs strictly in order (selene/src/disk.rs:478-485) on both backends. - Failure isolation matches the docs. Shared open/read/packed-content errors route through
with_record_read()(:2096,:2145,:2176) and fail every attached restore after in-flight I/O drains (fail_segment_users:2040-2065,fail_window:2067-2080);DiskStore::applythen drops only that endpoint's lookup row (:4445-4456); a private child or a follower's transient upload failure fails one restore (:2156-2183).packed_bufismem::forget-ed rather than freed when a copier close fails (:3206-3212) — the correct leak-over-free choice for a buffer an upload still references. - Out-of-band metering does not pollute progress.
StoreStats.progresscountsapplyonly (:4409-4410); samples are drained inpoll_transport/poll/closeand observed at:3649-3655; the test assertsprogress == completed restoresandbytes_in == CONCURRENT × single. - Host path unpenalised; single-restore fast path real.
read_intousesplan_windows(..., false)(:1851);build_pending_demandreturns early atdevice_inbound.len() <= 1(:2275-2277). - Compatibility untouched. No record-format, header-layout, wire-protocol,
TransportEvent-variant or public re-export change, so existing v1–v4.ckptfiles load unchanged (charter line 42). - Scale is requirement, not churn. +8470/−5627 is load-bearing: the host path must stay private (
CompositeStorepasses caller-owned registered buffers and stores(Header, Arc<Vec<u8>>)), and the device path needsSharedSegment/SharedWindowto keep uploads independent and failures isolated.pump_device_inboundis long but each pass carries an ordering argument the others depend on. No dead tests: every new test names a behaviour that would otherwise regress, and they assert byte-exactSimulatedGpupages and physical counters at the real submit sites (AGENTS.md:194-199).
Open questions / what could not be established
- Maintainer sign-off (S1). Only a maintainer can answer; nothing in the thread records it as of this head.
- Shape of the
estimated_secondsfix (S2) — rename vs end-to-end span — is the author's call, settled by the one measurement described there. - 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.
#497merge-order reconciliation. The description recommends merging#497first soStaged::pump_allkeepsMAINTENANCE_DEFER_LIMIT = 8and runshost_inbound/pump_device_inboundahead ofoutbound/maintenance.MAINTENANCE_DEFER_LIMITis absent at this head (no hit inselene/src), andpump_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.- N8 pump interleaving — whether the Pass 1 / Pass 5b split is load-bearing or only historical.
- Untested shapes, all declared Not covered and not exercised here: live SM121
--lossless-kv-compression cpu|gpuserving (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-GPUsplit_pools, discrete PCIe, Windows serving, and live warm-plus-disk/PooledStoreHTTP serving. - No toolchain, GPU or hardware was available to this review, and the head carries no CI checks. Every finding is established from source at
cb3db468plus the evidence the PR reports (513selenetests +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. - Prompt-injection check: nothing in the PR body, comments, code or docs attempted to direct the reviewer; the
Discord: Doonerline 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):
- #35 — full report (Key findings, Blockers 0, Should Fix 2, Subtract/Simplify 5, Nits 12, verified-sound, open questions). This is the authoritative full report.
- #36 — counts-only GitHub summary (Recommendation: Ready To Merge; Blockers 0 · Should fix 2 · Subtractive 5 · Nits 12).
SUPERSEDED — do not pull numbers or citations from these:
- #34 (run 790 report, head
0c04b1e2, 0/5/10) — different head; its five should-fix items are all resolved atcb3db468and must not be re-raised. Also its docs line numbers (:337-366,:1528-1531) and disk_store line numbers (e.g.InboundWindowSampleat:97-101,free_slotsat:236-254,hit()rate at:3625) are stale after the rebase. - #28 / #30 / #31 (head
0c04b1e2deliverables, 0/5/5 ), #20/#21/#29 (pre-Hash-correction drafts), #9/#10/#12/#13 (earlier heads/blocker-era), #17 (Changes Requested round). - #1-#8, #11, #15, #16, #18, #19, #23, #24, #26, #27 — audit trail and earlier-round evidence only.
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).
- S1 Record the maintainer decision on the second inbound lifecycle in
Staged— Architecture S1 raises it as process; Conventions/Prose/Simplicity/Correctness all note the same open question. Filed as should-fix, not a blocker, because it cannot make a released build wrong (AGENTS.md:201-206 gate only). - S2
estimated_secondsunit/name split — Architecture S2 ("lower confidence"), Correctness nit 3, Prose "outside this lens", Simplicity "outside this lens". Convergent across three lenses, so promoted from nit to should-fix; fix is a rename or an end-to-end span, not a new code path.
SUBTRACTIVE = 5 (dedicated section, preserves Subtract's line estimates).
- T1 packed-window byte span triplicated — Simplicity S1 (its "would fix before merge") + Conventions "packed-window byte arithmetic restates
pool/pins.rs" (which it judged not a finding) → reconciled into one item kept at high priority because both new copies are the two paths that must agree byte-for-byte. - T2 demand table/picker — Subtractive finding 2 (~65-80 lines), with the staggered-benchmark caveat preserved.
- T3 nine duplicated test fixtures — Subtractive finding 1 (~100-115 lines).
- T4 close-drain test duplicates burst test — Subtractive finding 3 (~70-75 lines).
- T5
ObservedTransportwrapper — Subtractive finding 4 (~55-65) merged with Simplicity N5 (same object, same fix).
NITS = 12.
- N1
memory::windowslast splitter (Conventions N1). - N2
Staged::close.max()count-as-jobs (Conventions N2 + Simplicity N4 + Subtractive 9 → one item, subtractive fixowners.len()). - N3
drain_inbound_samplesdefault no-op (Architecture N1). - N4 one-element
HostInboundvec + always-zero owner index +reads_left(Simplicity N1 + Subtractive 7). - N5
disk_read_counted+ six cfg blocks (Simplicity N2). - N6 unreachable
demand.get_or_insert_withat :2479 (Simplicity N3). - N7
poll_all_fetchesduplicatestesting::poll_until(Subtractive 6). - N8 Pass 1 / Pass 5b double traversal (Subtractive 8, flagged lowest confidence).
- N9
HeaderIdentitynow redundant wrapper (Subtractive 5 — note: distinct from the old hash should-fix, which is fixed). - N10 §2.4 "64-page file boundaries" wrong for v4 (Correctness nit 1).
- N11 Pass 5a deferred
ReadRowinvariant uncommented (Correctness nit 2). - N12 prose combined: description omits arrival-order relaxation + §2.4 restates §4 metrics (Prose N1 + Subtractive 10), deliberately combined so prose items do not crowd out code.
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:
- GatedCopier fixture in disk_store's test module (:8051-8080, GatedCopierParts :8059-8064) returns a positional 4-tuple of Arc<Mutex<..>> handles destructured at each call site (:8364, :8488, :8608) vs the crate convention in selene/src/testing.rs (StoppedCopier :178, SimulatedGpu :225, both returning a 2-element pair). Also six new coalescing tests repeat the same pool/store construction block although write_shared_ancestor_tree (:8136) and poll_all_fetches (:8172) already exist.
- Naming axis mixing: HostInbound (:759) / DeviceInbound (:1117) named by destination but HostWindow (:746) / SharedWindow (:1070) named by sharing discipline (HostInPhase :741, SharedWindowPhase :1052). PrivateWindow/SharedWindow or Host/Device consistently.
- 60-word doc sentence splitting (docs:339-342) — see entry on docs.
#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"):
- "Existing users pay per-pump demand indexing when free slots exist and at most one extra window split when
skip_pages % 64 != 0" sits at the end of Result with no measurement → expectation stated as result (AGENTS.md:95-96). Also overstates: build_pending_demand returns an empty table before any work when device_inbound.len() <= 1 (selene/src/disk_store.rs:1651-1653) and pick_next_pending_plan takes the layout lock once per call (:1691-1695), so the cost applies to multi-fetch pumps only. Fix: label as expected/unmeasured bound and note the single-fetch fast path. - Benchmark provenance is a parenthesis: "measured before the linear demand-index and close-count edits" — table is not the head commit f9c9191 (unit suites were run at c0c4f798). "Not covered" separately says the SM121 runs were not repeated after the demand-index edit, which conflicts in emphasis. Fix: state plainly in the benchmark paragraph that the numbers are from an earlier commit of this branch (those edits change scheduling — pass 2 demand attach ordering — which is exactly what produces shared windows), or re-run at least one TP1 simultaneous and one staggered trial at head. The honest disclosure is why architecture lens rated it a nit, not a blocker (AGENTS.md:194-199).
- Commit message: single commit, imperative, matches neighbouring selene subjects, body reproduces the 4-part argument. Nothing to fix.
- "Not covered" section is genuine (helios FLARE_RUN_CUDA_TESTS=1, discrete PCIe GPUs, Windows serving, live CompositeStore/PooledStore GPU serving). Companion-PR logistics handled correctly per AGENTS.md:126-128 (merge #496 first, then rebase #497; both share the 425ab2d4 baseline). Both PRs touch Staged::pump_all (merging/pump_all order at :2268-2289 runs outbound, host_inbound, then device).
- No prose defect in the new type/state comments: SharedFileState (:1005-1017), SharedSegment/reusable/settled (:1019-1050), SharedWindow (:1065-1091) matches sweep_shared_windows (:1755), plan_aligned_windows (:697-699), pass comments Pass 1..5e, test names state the property. Model example of good documentation.
#8 [medium] Verified sound: lifetimes, failure isolation, host path, tests
What held up (do not ask the author to change):
- Slot lifetime: a shared window is released only when followers.is_empty() && disk_referenced == 0 && upload_referenced == 0 (sweep_shared_windows :1755-1771); segment removal requires active.is_empty() (Pass 5e :2213-2230); detach refuses while an upload is busy (:1737-1741); allocate(plan.count, plan.row) matches record_slots. No double release; Resources::release idempotent via slots.take() (:247-251). Each new test asserts pool.free_slots() == pool.slot_count().
- Host path unchanged: read_into keeps plan_windows (:1283), private per-restore opens, caller-buffer slicing in HostWindow (:914-923), sub-window resubmission (:931-970), unwind drains before reporting (:976-996). CompositeStore sees no change — good call: caller-owned buffers have caller-defined lifetimes (design-review principle 6).
- read_into deliberately NOT coalesced: correct, not a missed opportunity.
- No existing shared-handle/demand mechanism was duplicated (shard::Sharded has only a plain fetch, selene/src/shard.rs:900).
- Failure isolation: private child/upload errors via record.fail (:1563-1565); shared open/read errors via fail_segment_users (:1449-1473) and fail_window (:1475-1487) after in-flight I/O; with_record_read() applied (:1503, :1540); TransportEvent::Fetched keeps routing record_read to index.drop_row (:3634-3640).
- No format/Header/on-disk change, no core re-export change; sharing keys on (path, expected Header) so records written by main read unchanged. WINDOWS_IN_FLIGHT still derives from crate::shared::WINDOW_CREDITS (:60).
- No new flags, env vars, config knobs, cfg-gated production paths, or per-model branches.
- Tests exercise the real path (SimulatedGpu byte-exact page/row assertions :8453-8570), and the counters are incremented at the actual submit_disk sites (:910, :946, :963, :1946, :2082, :2109), not in mocks — satisfies AGENTS.md:194-199.
- The 8-pass pump_device_inbound ordering carries a correctness argument per pass (attach before sweep, release before start, submit reads then uploads) — simplicity lens explicitly did NOT ask for a different shape, only for the duplicated attach loop to go.
- The +2803/-913 size is not churn under AGENTS.md:188-193.
#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.
- A (correctness): no blocking defect in the paths read; A1 logical-vs-physical bytes -> inbound_rate (should fix), A2 the 8/9 -> 7/9 gap (should fix, may collapse to a description fix), A3
Staged::closecount (nit). Confirmed sound: slot lifetime, demand ordering, host path unchanged, failure isolation, Fetched emission, pump_all order. - B (architecture/scope): change belongs (charter "What gets merged" allows a measured performance issue; AGENTS.md:165-166; goal: share prefix-cache checkpoints via Selene). No rejection criterion tripped (no scope expansion 171-175, no architectural violation 176-181, no per-model branch/flag/env, no format or re-export change, weakened-guarantee rule 182-187 respected). Should fix: bytes metering; the new ownership protocol needs a recorded design decision and a corrected module contract; doc overstates. Nits: benchmark provenance, coalescing unobservable outside tests.
- C (conventions/duplication): should fix only — duplicated planner, unnamed
WindowKeyidentity, per-pump allocation/quadratic scan. Nits: GatedCopier tuple/placement, ungated counters, close() count, naming axis, prose. - D (simplicity): explicitly NO blocking or should-fix finding — "do not add frameworks/switches" (AGENTS.md:188-193) is satisfied and the +2803/−913 size is not churn; the eight items are all nits with smaller versions (one planner, one attach helper, single
Segment,startedflag, drop duplicated window fields, gate counters, split the doc sentence, description overstates per-pump cost). - E (prose): nothing blocking, three should-fix — misplaced
allocaterustdoc, unexplained 8/9→7/9, expected costs stated as results — plus nits on benchmark provenance, "aligned" unresolved, and error scope missing from §2.4/§2.12.
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".