PR #496 review — "Coalesce shared ancestor reads across concurrent Selene disk fetches"
Head reviewed: 0c04b1e2 · Base: main c0c4f798 · Files: selene/src/disk_store.rs (+3313/−931), selene/src/shard.rs, docs/prefix-cache-offload.md (+35/−2) · 3 files, +3358/−933.
Case file: https://autobot.eidonix.com/api/v1/cases/774e16ea-5f84-4ff8-9166-74ab6876cc37.html
Lenses applied: architecture/scope, conventions & duplication, simplicity, correctness, prose. Five reviewers, no toolchain or GPU available — every finding below is established from source at the head commit, not from a build or run.
Key findings
- No blockers. This is the second revision; last round's blocker (an unexplained 8/9 vs 7/9 retrieval result at 61.3K tokens) and five of six should-fixes are genuinely resolved at this head. The change belongs in the repository, sits in the right layer, and its evidence is the kind the charter demands.
- The scope verdict is positive. The charter's "What gets merged" accepts a reproducible measured performance issue (AGENTS.md:165-166 (not opened)), and the PR reports one on a served workload:
flare run, 8 concurrent/v1/chat/completionsfollow-ups against a shared ~61K-token disk-resident ancestor, physical NVMe reads 18,177.5 → 4,306.7 MB (−76.3%, 4.22×) and burst-median ingress-to-first-token TTFT 7,974.6 → 5,662.8 ms onQwen3.8-27B-NVFP4TP1,mainc0c4f798vs head0c04b1e2. No rejection criterion is tripped: no CPU/non-NVIDIA path, no backend swap, no serving-path change, no CUDA inselene, no per-model case, no new flag or env knob, no record-format or re-export break. - Five should-fix items, all small. (1) a rank-local rate sample was added to the cross-rank completion enum, which forces an
unreachable!()in the protocol mapper and re-triggers the composite's maintenance pass once per physical window; (2)HeaderIdentityhand-writes a 37-lineHashthat must be kept in step by hand withHeader'sPartialEqin another module; (3) the admission guard restatesLayout::record_slotsinstead of calling it; (4) the new §2.4 doc paragraph carries twelve behaviours and states the metrics contract twice; (5) theStaged-vs-DiskThreaddesign decision needs a recorded maintainer sign-off. - Six nits, all deletions or wording:
inbound_ratenow measures pure disk-thread time soestimated_secondsprices restores optimistically;Staged::close'sabandonedcount is amaxover unrelated map sizes; three verbatim unindex blocks and two identical detach closures; a one-elementVecand twoidfields duplicating their map keys; two test-fixture shapes that break crate precedent; three PR-description wording/arithmetic items. - Everything else checked out: slot and file lifetimes, per-record failure isolation, the unchanged caller-owned host path, the wire
Kindcode set, no data-format change, and tests that assert byte-exact GPU pages at the real submit sites rather than through mocks.
Blockers
None. No correctness defect, no compatibility break, and no scope violation was found in the changed paths.
Should Fix
S1. 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 } (selene/src/disk_store.rs:97-101) was added to the enum whose own doc comment reads "Completion the transport reports to the disk store" (:83), where every other variant is a job completion carrying a JobId. This variant carries no id: it is a per-window bandwidth sample for Staged's own inbound Rate, produced inside Staged::apply_shared_disk when a shared window's physical reads finish (:1619) and consumed by a short-circuit at the top of DiskStore::apply (:3632-3635), with a unreachable!() immediately below to keep the match exhaustive (:3638).
Because the same enum is what shard::Sharded serialises between ranks, Kind::of now has to panic on it (selene/src/shard.rs:476-478: unreachable!("window rate samples stay local to rank zero")), while 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). That panic is upheld only by two hand-written matches! guards that must stay in sync: Sharded::absorb_local pushes the sample straight into self.events and continues (shard.rs:722-725), and Peer::forward skips it (shard.rs:1148-1150). Anything else that maps Kind::of over a Sharded's event list panics — including the existing test helper events.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. Disk-store test code has to filter the variant by hand (disk_store.rs:6341) and match it out of the stream explicitly (:9145).
Concrete, verified cost beyond ergonomics. CompositeStore::poll does self.stats.progress += 1 for every transport event before dispatch (selene/src/composite.rs:1375-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-1428). With this change each physical WINDOW_PAGES (64-page) window read bumps progress and therefore re-runs both, once per window per restore — the opposite of the hot-path relief this PR is after. DiskStore::apply deliberately does not bump progress for this variant (disk_store.rs:3632-3636), so the two stores' progress counters now advance at different rates for the same work.
Request. Carry the sample out of band rather than as a completion variant — any of: a Staged drain method over 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 precedent the crate already has for a rate signal that is not an event (Budget::progress(), selene/src/input.rs:146-152 (not opened)). Whichever shape, exclude it from CompositeStore's stats.progress (composite.rs:1376 should count completions only). 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 (not opened)). 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, and its totality now depends on two guards far from it. The fix needs no new machinery. Note the mechanism is correct and is not in question — observing a physical rate, the vanished per-record observe, and the two rank guards all behave as intended; the finding 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.
S2. 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 (selene/src/disk_store.rs:1006-1010), then writes Hash by hand: it destructures Header, hashes fourteen fields one at a time plus each RankSizes (:1014-1050; the destructure ends in .. 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 and 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 (disk_store.rs:1229, lookups at :1650), and coalescing silently stops working — a performance regression with no test failure, because nothing in the suite pins hash/eq agreement.
It is also a convention departure, not merely a hazard: 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 (:1052, :1058). The manual impl exists only because Header does not derive Hash. Separately, HeaderIdentity restates Header identity where a per-record unique key already exists: 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 with the same field list and version still excluded — and let SegmentKey/WindowKey derive; HeaderIdentity then 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 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, written with a non-exhaustive pattern so the compiler cannot help, is exactly the duplicate representation docs/design-review.md:74 (not opened) 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 exists to catch.
S3. pick_next_pending_plan restates Layout::record_slots instead of calling it
Finding. selene/src/disk_store.rs:1760-1793 computes a candidate window's slot cost 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 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 accounts for anything beyond pages + row. Secondary cost: lock(&self.resources.transfers) is taken once per candidate record per pump iteration here and then immediately again by allocate.
Request. let needed = lock(&self.resources.transfers).layout().record_slots(plan.count, plan.row);, hoisted next to free outside the plan loop; also drop the dead if demand.is_empty() guard 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 helper already exists.
S4. 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, including the missing immutability invariant and the WINDOW_PAGES naming. What remains is shape and duplication: .agents/skills/repo-prose/SKILL.md:71 (not opened)/:84 ask for ordinary readable sentences and no "you had to be there" density, and AGENTS.md:52-60 (not opened) 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 ("sharing covers only live windows"; "at most one extra partial window when skip_pages % WINDOW_PAGES != 0") 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 read as one mechanism, and duplicated prose drifts (AGENTS.md:43-49 (not opened) prose review; design-review principle 16, write without hidden context).
S5. 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 the old "Nothing here waits" text — 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 via started: Vec<bool>, and a close-only-when-settled rule (selene/src/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 (not opened)).
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
N1. 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:447-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 (selene/src/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.
N2. Staged::close's abandoned count no longer matches its message, and two settled() predicates share a name
internal is a .max() over owners.len(), maintenance.len(), shared_segments.len() and shared_windows.len() (disk_store.rs:2522-2527), and abandoned = store_jobs.max(internal) (:2528), reported as "{abandoned} disk transport jobs did not complete within {:?}" (:2541-2544). Map sizes are 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, i.e. what the message says. Separately, Segment::settled (:661-664, file handle reached a terminal state) and SharedSegment::settled (:1106-1109, disk jobs drained) are two different lifetime predicates with the same name in one file. Request: count owners.len() in the message and, if leaked staging state is worth catching, report it with its own message ("{n} shared windows/segments leaked"); rename one of the two settled()s.
N3. Dead guard, plus three verbatim unindex blocks, two identical detach closures, and id fields duplicating their map keys
if demand.is_empty() { 0 } else { ... }atdisk_store.rs:1781-1787cannot change the result —map_or(0, ..)on an empty map already yields0.- The "unindex this window, but only if the index still points at it" body appears verbatim three times (
:1525-1527infail_segment_users,:1543-1545infail_window,:1837-1839insweep_shared_windows). Extractfn unindex_window(&mut self, key: &WindowKey, id: SharedWindowId). - The follower-detach
retainclosure appears twice identically (:1813-1816indetach_unwinding_windows,:1900-1904in Pass 1 ofpump_device_inbound), matching on the(record, plan_index)pair that isWindowFollower's identity (:1119-1123). GiveWindowFolloweramatches/removemethod. SharedSegment.idandSharedWindow.id(:1083,:1131) duplicate theirHashMapkeys and are read only to compare against a key — delete them and iteratefor (&id, seg) in &self.shared_segments. Request: the four deletions above. Why: the index-still-points-at-it guard is the subtle part of the unindex code and stating it three times invites drift;idduplicates an invariant nothing enforces.
N4. memory.rs::windows() is now the last third copy of the WINDOW_PAGES splitter, and two fixture shapes break crate precedent
memory.rs::windows()(selene/src/memory.rs:1336-1367) re-expresses the same policyplan_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. Output type differs (VecDeque<copier::Job>vsVec<WindowPlan>), so full convergence is a refactor; the minimum is a cross-reference comment on both sides and a test pinning the shared policy (design-review.md:74(not opened)).HostInboundis a one-elementVec<Segment>behind an always-zero index (disk_store.rs:267,:658,:750,:789-791,:1351-1360), with aget_mutmiss branch guarding an impossible state and aSegment::reads_left(:658,:822,:867) that 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 and delete the flags, or state the flags' purpose.GatedCopier::wrap(:8092-8122) returns a positional four-tuple ofArc<Mutex<…>>, and three of five call sites discard the tail with_(:8406,:8530,:8984); the crate's fixture precedent returns named handles (StoppedCopier,SimulatedGpu::shared_mapped,selene/src/testing.rs:178(not opened)/:225). A named struct (hold,held,fail) says which gate each site wants. Test-only.- Also:
poll_all_fetches(:8215-8232) duplicatescrate::testing::poll_until(selene/src/testing.rs:25-37(not opened)), which the file already imports; the only difference ispoll_untiltakingFnrather thanFnMut, so counting needs aCell. Keeping the thin local wrapper is defensible — the saving is ~10-16 lines. Request: the cross-reference comment, and the three small deletions (Vec→Segment,reads_left,disk_read_countedor its doc,GatedCopierstruct).
N5. 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:1619, reached viaOwner::SharedSegment). 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.99×; 7,958.0 → 2,251.5 is 3.535 but it says 3.52×. The 27B rows (4.22×, 3.76×) and all four TTFT percentage deltas check out (7,974.6 → 5,662.8 = −29.0%; 6,883.6 → 5,951.9 = −13.5%; 3,327.5 → 3,225.0 = −3.1%; 3,137.7 → 3,049.9 = −2.8%). Add a caption sentence saying whether the column is the 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) — precisely what forces theunreachable!()atshard.rs:476-478. Say the enum gained a rank-0-local variant instead.
Resolved since the previous round at f9c9191 (reported here for closure, not re-raised)
- Blocker — the 8/9 vs 7/9 retrieval result at 61.3K. Resolved. Five cold-VRAM restart repeats against one shared 60,534-token disk checkpoint (seed 1234..1238,
top_logprobs = 5) produced identical FP32 top-5 logprobs and token IDs onmainand at head across all five (6/9, 8/9, 7/9, 9/9, 4/9). Cause identified: Flare has no greedytemperature = 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 pinned bymisaligned_follower_attaching_to_shared_partial_tail_and_row_matches_private_restore(byte-equalSimulatedGpupages and row against a private baseline,skip_pages = 13, partial <64-page ancestor tail plus a partial leaf chunk carrying the row). inbound_ratecomputed from logical bytes (was should-fix). Resolved: the sample carries only physicalwin.read_bytes/read_elapsed(:1596-1620, pushed:1619),applyfeeds the sampler and returns beforestats.progress += 1(:3632-3635),stats.bytes_instays logical (:3669), the old per-recordobserveis gone, andcoalesced_restores_keep_inbound_rate_physical_and_bytes_in_logicalcovers 1-vs-8 simultaneous and staggered. Live confirmation in the description: rank-0flare_host_cache_inbound_bytes_per_secondstays physical (6.07 GB/s single vs 7.71 GB/s 8-way simultaneous and 6.02 GB/s staggered on the 27B).- Docs overstating the mechanism, stale signatures, misplaced rustdoc. Resolved:
plan_windows-accurate facts, realwrite_from/read_intosignatures, the immutability/pin invariant, the live-window limit and the extra-partial-window bound are all stated (docs:337-366);allocate's contract comment is back abovefn allocate(:241-243) andfree_slotshas its own line (:236-239); the module doc now describes per-fetch window credits, follower sharing and close-before-Fetched(:7-27). - Benchmark provenance; expected costs presented as results. Resolved: the table is keyed to
main c0c4f798vs0c04b1e2, the single-restore cost is labelled "As an expected bound" with thedevice_inbound.len() <= 1fast path named, and un-rerun multi-host RoCE moved to "Not covered". - Duplication of the window planner, the window key and the attach loop. Resolved:
plan_windows(segments, align_to_window)(:679-727) replaced the twin splitters;HeaderIdentity/SegmentKey/WindowKey(:1001-1064) plus awindow_indexHashMap makefind_reusable_windowan O(1) lookup (:1646-1663) and remove the per-pumpPathBufclones;has_window_credit(:1683-1687) andattach_pending(:1711-1730) replace the duplicated attach loops;PlanStateis gone in favour ofstarted: Vec<bool>; the diagnostic counters are gated under#[cfg(any(test, feature = "test-support"))](:200-208, accessors:1279-1295) rather than left asallow(dead_code).
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 decrements inapply_shared_disk(:1594) andapply_device_transferrun before any release decision, so a reply can never arrive for a freed window. Segment (file handle) removal requires no users andsettled()(Pass 5e,:2213-2230), sodisk::Closeis submitted only after the last attached restore's I/O drained. Every new test assertspool.free_slots() == pool.slot_count()— the right property rather than a mock. - Failure isolation keeps the "don't swallow the error" rule. A private child or follower GPU-upload error fails only that restore (
record.fail,:1538-1553,:1652-1660). A shared segment open/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). - Host path unchanged.
read_intokeepsplan_windows(..., false)(:1349), private per-restore opens and unaligned packing;CompositeStore::start_readuses only that path. Keeping caller-owned host reads off the shared path is the right call — those buffers have caller-defined lifetimes (design-review principle 6), and it is stated in both code (:679-681) and doc (:345-346). - No compatibility break. Records stay immutable and pinned;
Headerand the on-disk layout are untouched; there is no core re-export change;WINDOWS_IN_FLIGHTstill derives fromcrate::shared::WINDOW_CREDITS(:60); the wireKindcodes are unchanged because the sample is never forwarded (shard.rs:1148-1150).HeaderIdentity's field list mirrorsHeader'sPartialEqfield for field, so the sharing key cannot currently collide two headers that compare unequal (S2 is about maintainability, not a present collision). Files written before this PR load unchanged. - No scope expansion, architectural violation or knob. No CPU/non-NVIDIA path, no backend swap, no orchestration, no serving-path change; no CUDA in
selene, no eager serving, no runtime compilation, no model knowledge, no per-model special case, no env var, no recipe field. Sharing is derived from(path, expected Header)identity (:1001-1064, acquisition:1425-1462), so it generalises as the charter requires. The only new conditional compilation is the diagnostic counters. - Concurrency and admission.
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 (WINDOW_CREDITS) budget before a finished slot can release, so no follower is starved by a peer's release;pump_allruns maintenance, outbound, host-inbound, then device (:2291-2312), consistent with the stated #497 merge-order note;pending_page_reads/pending_row_readsare pushed only insidesubmit_disk's success arm, so FIFO reply matching cannot be left with an unmatched entry. - Tests exercise the real path, not mocks. Byte-exact
SimulatedGpupage and row assertions in every coalescing test (e.g.:8368-8379), and the counters asserted are physical increments at the realsubmit_disk/submit_transfersites, satisfying AGENTS.md:194-199 (not opened). The shared fixtureswrite_shared_ancestor_treeandpoll_all_fetchesare used by five of the seven new tests, so they are not scaffolding. - Scale is not churn. +3313/−931 in
disk_store.rsis large but load-bearing: the host path must stay private, the device path genuinely needs per-file and per-window reference state to keep each follower's upload and each failure independent, 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 and what could not be settled
- Size of the
estimated_secondsoptimism (N1). Code shows only the direction; the factor needs a run or a test comparingestimated_secondsagainst a measured single-restore wall time. - How
Headershould gain hashing (S2).impl Hash for Headerbeside itsPartialEq, versus arecord::HeaderKeydigest versus hashing onlyPrefixKey— a maintainer/author call for internal API shape. Either removes the drift hazard. - Which shape for S1's out-of-band sample (
Stageddrain method vs counters folded intoStoreStatsatselene/src/store.rs:185-244, which would also make coalescing visible to operators, or a field onFetched) — internal API shape, a maintainer call. The one measured consequence to watch is theCompositeStoremaintenance amplification; the description reports no maintenance-run counts, so its practical cost is unquantified. - N3/N4 removals need the author's intent on
Unopenedshared segments (whethershared_segmentsinStaged::close'sinternalis meant to cover a segment whoseOpenhas not yet been submitted) and on whetherdisk_read_countedis load-bearing for any assertion beyonddisk_window_reads. - #497 rebase. Both PRs touch
Staged::pump_all; whoever merges second must confirm the resolved order still runshost_inboundandpump_device_inboundahead of writes and maintenance. Not checkable from this branch. - Not verified here, and declared Not covered by the author: multi-host RoCE serving, 2-GPU
split_pools, discrete PCIe GPUs, Windows serving (13 coalescing tests do pass on Windows IOCP; full Windowsseleneremains gated on/dev/urandomperdocs/TODO.txt), and liveCompositeStore/PooledStoreGPU serving. Also not read in full: the ~5,300-linedisk_store.rstest module past the fixtures that were inspected. - Review limits. No toolchain, GPU or test run was available to this review: nothing was compiled or executed, so findings rest on source at the head commit and on the PR description's reported evidence (476
selenetests on x86_64 and ARM64 Linux, 13 coalescing tests on Windows IOCP, 21 single-GPU SM121helios offload::tests,pytest tests/preparation/test_core_boundary.py(not opened)), not on a build this review performed. No instructions were embedded in the material reviewed; nothing in the diff, comments, description or docs attempted to direct the reviewer.