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 (not opened) (+119/−1), selene/src/shared/packed.rs (+44/−0), docs/prefix-cache-offload.md (+38/−2), selene/src/shard.rs (+11/−0) = +8682/−5630. Part of record.rs (not opened)/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.
No CI checks on the head commit. No toolchain, GPU or hardware was available to this review: every finding below is established from source at cb3db468 plus the evidence the PR reports.
Recommendation: Ready to Merge, with one process gate — 0 blockers; 2 should-fix; 5 subtractive items (~360–400 removable lines); 12 nits. All five review 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(not opened), exhaustive destructure,version: _) andHeaderIdentity::hashdelegates (disk_store.rs:1452-1456);pick_next_pending_plancallslayout.record_slots(plan.count, plan.row)under 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 (not opened)) — 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. - 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); 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 with identical top-5 logprobs and token IDs. - What remains is small and mostly subtractive: one duplication to fix before a future
packed::Layoutedit can silently corrupt restored pages (T1), four removals worth ~290–335 lines (T2–T5), and twelve nits.
Blockers
None. All five lenses report no blocker at cb3db468, and the correctness lens's verdict is literally "clean": nothing 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).
The missing maintainer record (S1 below) is a merge-process gate, not a defect in the build, so it is filed under Should Fix rather than 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 Unopened/Opening/Opened/Closing/Closed, reusable(), disk_settled()), :1537-1562 (SharedWindow with disk_referenced/upload_referenced and the documented release condition followers.is_empty() && disk_referenced == 0 && upload_referenced == 0), :1578-1590 (DeviceInbound with out-of-order started/active 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 (two windows in flight), 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 matches docs/design-review.md (not opened)'s "never reuse inputs, pages or slots while queued work or transfers reference them", but AGENTS.md:201-206 (not opened) 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 commit acknowledgment or routine PR approval is not that decision". A PR Why plus a benchmark table is not that record.
Why it matters. AGENTS.md:165-166 (not opened) accepts "a measured performance or memory problem" as sufficient reason to contribute, which this satisfies; AGENTS.md:201-206 (not opened) adds the separate sign-off requirement. The author asks for it explicitly ("Ready for another look at cb3db468 (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() computes bytes = self.layout.record_bytes(chain.pages) (logical bytes) and divides 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 (not opened)) and by callers such as helios/src/server/runtime.rs (not opened). CompositeStore derives a same-named quantity end-to-end from read_into/read_into_packed completions (selene/src/composite.rs:374 (not opened), :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 change's direction is a fix), but this PR is the moment the two names 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 (not opened)), and the docs now state the narrower meaning explicitly (docs/prefix-cache-offload.md:1612-1617: "samples rank-0 physical disk-thread window reads (excluding slot queueing and GPU upload)"), so a reader of the code alone will mis-price the decision. Severity is low: an optimistic admission estimate changes a scheduling choice, not correctness.
Fix (prefer the cheaper, subtractive one): 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 these 5 items and the nit-level deletions below (~7–8% of the diff, ~25% of the new test module). Ordered by priority. Nothing here changes behaviour except T2, which carries an explicit measurement caveat. The core is not padded: the shared segment/window state machine, the reference counts that keep SlabPool slots and v4 ReadPacked payloads pinned until every follower's upload finishes, 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, 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 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, after which each site is 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, with 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
selene/src/disk_store.rs:10290-10347 is a 58-line DiskTransport implementation that forwards twelve methods to Staged (store, fetch, truncate, unlink, poll, close, staged, staged_mut, codec_receive_profiles, decode_counters, …) for the sole purpose of copying (bytes, elapsed) window samples into an Arc<Mutex<Vec<_>>> (drain_inbound_samples, :10324-10331). The test then rebuilds a Rate from that log (:10499-10514) purely to compare store.stats().inbound_rate with a value derived from the same samples the store was fed (:10531-10535). The meaningful physical-vs-logical assertion is already rate_after_physical_reads (:10466) against the final rate (:10523-10530).
Smaller version: expose inbound_samples() on Staged under #[cfg(any(test, feature = "test-support"))] beside disk_window_reads()/coalesced_windows() (:1714-1724), read it after poll, and delete the wrapper, the Arc<Mutex<..>> plumbing, single_samples/recorded_samples and the expected_bps assertion. Keep staged.disk_window_reads() == 2, the coalesced count, and the bytes_in check; hoist the existing 5%-tolerance before_followers comparison so it runs for both passes.
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 attached to the last window, a row-only window when there are no pages, no window for an empty link. The rule now lives in two unrelated functions with no cross-reference. Fix (cosmetic): a one-line comment in memory::windows pointing at plan_windows, or lift the policy into one helper taking the align flag. packed::Layout::windows (selene/src/shared/packed.rs) is deliberately a different splitter (byte-bounded, extra max argument) and must not be merged.
N2. Staged::close reports a .max() over heterogeneous collections as a job count
selene/src/disk_store.rs:3183-3194: maintenance_jobs (a filter over owners), store_jobs (sum of the three store maps plus that count), then abandoned_jobs = store_jobs.max(self.owners.len()).max(self.maintenance.len()), reported at :3214-3218 as "{abandoned_jobs} disk transport jobs did not complete within {:?}". Every maintenance and store job inserts an owner, so self.owners.len() alone already counts abandoned disk jobs and neither extra term can raise it; maintenance.len() is a queue depth, not a stuck-job count. The separation from leaked_shared (:3195, :3220-3225) is correct and fixed the more confusing half. Fix: let abandoned_jobs = self.owners.len();, or gate on busy() (:3033-3040).
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 (:3386) forever with no failure anywhere. Forwarding is correct today (Sharded forwards on rank 0, selene/src/shard.rs:1005-1012; peers discard, :1210-1220). Fix: make the method required (no default body), or assert the staged transport is in use when metering matters. Today's only non-Staged implementors are tests, hence nit.
N4. HostInbound models a single segment as a collection, with a redundant counter
segments: Vec<Segment> (:1109) is only ever built as vec![segment] (:1824, :1863-1867); Owner::HostInbound(JobId, usize) carries a permanently-zero index (:276, inserted at :1814, :1853); lookups are tolerant segments.get_mut(segment); and Segment::reads_left (:1004) is set to 1 (:1820) or plans.len() (:1859), decremented at :1175/:1204, and consulted only at :1255 — where self.done == self.plans.len() (:1270) already answers. Smaller version: struct HostInbound { segment: Segment, .. }, Owner::HostInbound(JobId), close on self.done == self.plans.len() && segment.settled() (~12 lines). One behaviour change: the file close waits one more pump. The device-side Vec<DeviceSegmentRef> is genuinely multi and must stay.
N5. disk_read_counted and six cfg blocks exist only so a test metric counts windows, not read jobs
disk_read_counted is set on HostWindow (:1101, initialised :1315, three cfg sites :1352-1356, :1377-1381, :1395-1399) and on SharedWindow (:1552, initialised :2559, three cfg sites :2689-2693, :2725-2729, :2753-2757), read only to increment resources.disk_window_reads. Both flag and counter are behind #[cfg(any(test, feature = "test-support"))], so nothing ships. Smaller version: count once at window creation and delete both fields and their six cfg blocks; or, if the device path's separate page/row submissions need the state, add one doc line to disk_window_reads (:1714-1718) naming its unit.
N6. An unreachable lazy build in the pending-plan pass
selene/src/disk_store.rs:2479: let demand_ref = demand.get_or_insert_with(|| self.build_pending_demand()); — demand is created Some when free_slots() > 0 || any_packed (:2464-2468), and 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 cannot fail, or restructure so the None case skips the loop entirely. (Falls away entirely if T2 is taken.)
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 (not opened)), which already stops on the wanted event. poll_until takes impl Fn rather than FnMut, so counting to N needs a Cell at the seven call sites (:9530, :9662, :9766, :9986, :10231, :10741, :10834). Smaller version: delete the helper and use poll_until, or keep a thin wrapper that calls it rather than reimplementing the loop (~14 lines).
N8. Pass 1 and Pass 5b walk each record's active list twice (lowest confidence)
Pass 1 (:2422-2444) reaps upload_done windows; Pass 5b 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 traversal, the active_len copy and a per-upload self.device_inbound[&id].active[index] re-lookup (~12 lines). Confirm the intended pump interleaving with the author before cutting; the counting tests tolerate an extra pump, which is why this is the least certain item here.
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 Hash that forward to Header's. Since this PR puts Hash on Header beside its PartialEq (selene/src/shared/record.rs:165-202 (not opened)) and derives Hash on RankSizes (:96), the wrapper only exists to be the expected field of SegmentKey (:1459-1462). Smaller version: 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 holds; only the phrase 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 has completed can sit in Reading with row_submitted == false and disk_referenced == 0, emitting no rate sample (:2130-2142) and arming no upload (:2778-2784) until a later pump with 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 prefer shared-ancestor windows over 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 description says so, and no per-request tail latency is reported beside the burst medians (AGENTS.md:95-102 (not opened) asks for the headline comparison with its scope attached). Fix: one clause in What or Result, noting that only aggregate burst medians were measured. 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, and §2.4 also restates the module doc (disk_store.rs:7-28) clause by clause (~5 lines). Fix: keep §4's measurement note and the pointer; drop the restatement. (Neither is a claim/evidence defect, which is why this is a nit and not a blocker.)
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 (not opened)). Checked, none added.
- 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, and no persisted format changed.
Hash for Header(shared/record.rs:165-202(not opened)) is an exhaustive destructure skipping only non-semanticversion, matchingPartialEq(:144-160,Eqat:163,RankSizesderivesHashat:96);Eq/Hash for packed::Layout(shared/packed.rs:99-141) destructureLayout,PackedOfferandPackedUnitexhaustively;header_eq_implies_same_hash(record.rs:2229-2306(not opened)) pins version-insensitivity,createdsensitivity and raw-vs-packed distinction. A missed field would fail safe (coarser hash, slower lookup). No record-format, header-layout, wire-protocol or re-export change, so existing v1–v4.ckptfiles load unchanged (charter line 42). - 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(not opened)). - 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:463-486) on both backends.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. - 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::applydrops only that endpoint's lookup row (:4445-4456); a private child or a follower's transient upload failure fails one restore (:2156-2183).docs/prefix-cache-offload.md:439-448states exactly this scope. - 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), so the one documented extra partial window per segment is all a lone restore pays.read_into/read_into_packedstay private onHostInbound(called fromselene/src/composite.rs:886-889(not opened)), so no caller-visible API grew. - 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. 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 (not opened)).
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. Whoever merges second must re-verify the ordering, and 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 its fixtures and for every assertion touching a reviewed construct, not line by line. - Prompt-injection check: nothing in the PR body, its comments, the code or the docs attempted to direct the reviewer; the
Discord: Doonerline is the author's only contact detail. No material was copied out of the repository.