#1 [high] Research summary
Lens B (architecture & scope). I read the charter, AGENTS.md (contribution scope/rejection criteria, required PR descriptions, validation), docs/design-review.md principles, docs/verification.md, docs/prefix-cache-offload.md (esp. §2.4, §2.5, §4, §5) and the changed code in selene/src/disk_store.rs in context (Staged, Resources, Owner, HostInbound, SharedSegment/SharedWindow, pump_device_inbound passes 1–5e, DiskStore::apply/fetch, Rate, plus composite.rs callers), and PR #497 as the stacked companion.
Verdict: the change sits in the right layer (Selene's disk transport; no CUDA, no model knowledge, no new flags/env switches, no per-model branching, no core/format change, and no re-export needed — behaviour derives from record path + header identity, which matches AGENTS.md "keep native specialization focused on cache storage contracts" and principle 3). It has served-workload evidence of the kind the charter demands for a performance PR ("benchmarks showing an actual speedup over main on a served workload"). But it adds a second, shared, reference-counted I/O lifecycle inside shared cache machinery (+2803/−913 in an already 8.8k-line file) and it silently changes what the store's own bandwidth metric means, which is used for restore-cost estimates.
Findings:
-
should fix (high) — metering semantics changed: selene/src/disk_store.rs:1530/1829/3626-3628.
SharedWindow::read_bytesaccumulates the physical reply bytes once per window, and each follower adds the whole window'sread_bytesto its ownrecord.bytes(line 1829), which becomesstats.bytes_inand is fed toinbound_rate.observe(bytes, job.started.elapsed()). Before this PR each restore read its own windows, so bytes_in and the observed rate were both physical. Now bytes_in stays logical (bytes delivered to GPU) while physical reads drop up to 4.2×, so the observed inbound rate is inflated toward the coalescing factor. That rate is the basis ofDiskStore::hit().estimated_seconds(line 3587) and of/metrics host_cache_inbound_bytes_per_second(helios/server/metrics.rs:1310 (not opened)) — the very number §4 of docs/prefix-cache-offload.md uses for "Inbound latency"/"Copy-out bandwidth" gating and that the PR's own table quotes. Effect: restore estimates used by tier choice/scheduling become optimistic (up to ~4× low) under concurrency, and qualification-measured disk bandwidth no longer means device bandwidth. Fix: feed the rate from physical window bytes (count a window's bytes once, e.g. at segment/window completion rather than per follower) while keepingbytes_inas the logical restored-bytes counter, and state the distinction in §2.5/§4. This is checkable from the code alone; a test assertingbytes_in == physical bytes / coalescingand rate stability across concurrency would settle it. -
should fix — scope/complexity needs maintainer sign-off, and the module contract is now self-contradictory. disk_store.rs:8-24 still promises "at most WINDOWS_IN_FLIGHT windows of one record staged at a time" and "Nothing here waits", while the file now hosts five new lifecycle types (HostInbound, SharedSegment with 5-state file machine, SharedWindow with two reference counts, DeviceActiveWindow/PlanState) with out-of-order plan completion, linear demand indexing, and a close-only-when-settled rule (lines 2205-2255). AGENTS.md "Reject unsupported abstractions and churn" and design-review principle 1/6 ask for the smallest footprint in shared code and explicit lifetimes; this is a substantial new ownership protocol in shared cache policy rather than a small fix. Recommendation: keep the technical content but require an explicit maintainer decision on the design (and on whether coalescing belongs in
Stagedversus inside the disk thread, which already owns the file handle), and rewrite the module/Stageddoc comments so they describe the two-window-credit, follower-shared staging model rather than the old per-record window rule. As written, a future reader of the header comment will misread the invariants ofpump_device_inbound. -
should fix — docs/prefix-cache-offload.md:337-342 asserts coalescing unconditionally and the same edited paragraph keeps signatures that do not exist. The text says concurrent fetches "share one open file handle and coalesce aligned 64-page windows while staged", omitting the two material caveats the PR itself discloses: windows already released are read again by later arrivals (so coalescing is best-effort and timing-dependent), and device restores now split up to one extra partial window when
skip_pages % 64 != 0. Per AGENTS.md ("State support as present qualification… unresolved defects, unrun checks and pending measurements"), §2.4 should state those limits. Also, the paragraph this PR edited still claimswrite_from(key, metadata, buffers)andread_into(key, buffers); the real signatures arewrite_from(id, header, temporary, path, pages, row, sums)(line 1242) andread_into(id, path, header, first_page, pages, row)(line 1268). Fix both while the sentence is being touched. -
nit — evidence staleness: the PR's own "Not covered" note says the SM121 single-pass runs predate the linear demand-index and close-count edits, and that the numbers come from a revision before those changes. Those edits alter exactly the scheduling path that produced the measured windows, and AGENTS.md requires the claimed result to be tied to the code under review. Re-run at least one TP1 simultaneous and one staggered configuration at the head commit before merge, or restate the table's scope explicitly as measuring an earlier revision.
-
nit — the coalescing counters exist only under
test-support(lines 192-200 withallow(dead_code), accessors at 1213-1236), so nothing in a production or qualification run can show whether coalescing happened; combined with finding 1 the mechanism is unverifiable outside unit tests, while §4 of the offload doc gates defaults on store counters. Consider exposing opens/reads/coalesced windows throughStoreStats(no per-model or flag implications) instead of test-only accessors.
Nothing found for the per-model-flags, environment-variable, format-compatibility or silent-field-drop criteria: the change introduces none of those, and the failure-isolation rules (private child/upload failures fail only their restore; shared open/read failures fail all attached restores after drain, keeping the record_read invalidation path at lines 3630-3641) preserve the existing "don't swallow the error" rule.
#2 [high] PR #496 lens B: bytes_in / inbound_rate inflation by coalescing
Finding 1 (should fix, high) — selene/src/disk_store.rs (PR #496 head f9c9191).
- SharedWindow.read_bytes is accumulated once per physical reply (apply_shared_disk, line ~1530:
win.read_bytes += reply.bytes, set at line 1979 initialised 0). - Each follower adds the whole window's read_bytes to its own record.bytes in pump_device_inbound Pass 1 (line 1829:
record.bytes += win.read_bytes;) — so N followers each count the full window. - record.bytes becomes the Ok payload of TransportEvent::Fetched (line 2235 / 2251), hence
DiskStore::apply->stats.bytes_in += bytesandself.inbound_rate.observe(*bytes, job.started.elapsed())(lines 3624-3628). inbound_ratefeedsDiskStore::hit().estimated_seconds(line 3587) and /metricshost_cache_inbound_bytes_per_second(helios/src/server/metrics.rs:1310); docs/prefix-cache-offload.md §4 uses that for "Inbound latency"/"Copy-out bandwidth" gating and §2.11 defaults.- Before the PR each restore read its own windows, so bytes_in and rate were both physical. Now bytes_in stays logical while physical reads drop up to 4.21x (PR table) => observed device rate inflated toward the coalescing factor; restore-cost estimates become optimistic (up to ~4x low) under concurrent restores.
- Fix: observe the rate from physical window bytes (count once per window/segment completion), keep bytes_in as logical restored bytes, and document the distinction in §2.5/§4. Test that settles it: bytes_in == physical/coalescing and rate stable across concurrency.
- Note: rate.observe also gets each follower's full window bytes -> rate sample = logical_bytes/elapsed; elapsed per record starts at DiskStore::fetch (line 3813
started: Instant::now()), andinbound_rate.started()at 3806.
#4 [high] Report run 2 (head 0c04b1e2) — Lens B verdict: previous should-fixes resolved; 2 remaining notes
PR #496 lens B (architecture & scope), head 0c04b1e2
Previously reported, now resolved at 0c04b1e2
- inbound_rate no longer fed from logical bytes:
DiskStore::applyshort-circuitsTransportEvent::InboundWindowSampleintoself.inbound_rate.observe(bytes, elapsed)(selene/src/disk_store.rs:3632-3635) and the oldself.inbound_rate.observe(*bytes, job.started.elapsed())inside theFetchedarm is gone (job fieldstartedremoved, :3851-3856).stats.bytes_in += bytesstays logical (:3669). Docs state the split: docs/prefix-cache-offload.md:362-366 and :1529-1532. - Module contract rewritten: selene/src/disk_store.rs:7-27 now describes per-fetch window credits, shared handles/follower windows, and "Submissions never block the caller … last user of a shared segment holds its Fetched event until the file close settles". Old "at most WINDOWS_IN_FLIGHT windows of one record" / "Nothing here waits" text gone.
- Docs §2.4 now carries the two limits (windows released before a later attach are re-read;
skip_pages % WINDOW_PAGES != 0adds ≤1 partial window per segment) and the real signatureswrite_from(id, header, temporary, path, pages, row, sums)(:1308) /read_into(id, path, expected, first_page, pages, row)(:1334); docs:337-366. Resources::allocaterustdoc restored aboveallocate(disk_store.rs:241-243) withfree_slotsdoc at :236.- WindowKey/HeaderIdentity/SegmentKey single definition (:1001-1064),
window_indexO(1) lookup,has_window_credit/attach_pendingextracted, demand tableHashMap<WindowKey, usize>;build_pending_demandshort-circuit fordevice_inbound.len() <= 1(:1760 área). - Test-only coalescing counters gated with
#[cfg(any(test, feature = "test-support"))](:200-208, accessors :1279-1295).
Remaining findings
Should fix (layering) — a store-local statistic now rides the transport event channel and forces an unreachable!() in the sharded protocol mapper
TransportEvent::InboundWindowSample { bytes, elapsed }is a variant of the enum that is the cross-rank wire event set (selene/src/disk_store.rs:97-101).Kind::ofmust therefore panic on it: selene/src/shard.rs:476-478TransportEvent::InboundWindowSample { .. } => unreachable!("window rate samples stay local to rank zero"). That invariant is maintained only by hand at the two call sites that would otherwise see it:Sharded::absorb_localforwards the sample intoself.events(shard.rs:722-725) andPeer::forwarddrops it (shard.rs:1148-1150). Any other consumer that mapsKind::ofover aSharded's events panics — including the existing test helper at selene/src/shard/tests.rs:338-339 (events.sort_by_key(|event| Kind::of(event).1)), which today only survives because those tests issue no fetch.- Why it matters (charter "solve the right problem in the right place"; AGENTS.md:188-193 "reject unsupported abstractions"; the enum's doc comment at disk_store.rs:83 is "Completion the transport reports to the disk store", and every other variant is a job completion with an id): a metering sample with no job id is not a transport completion, and putting it here makes the wire-protocol mapper responsible for a local statistic.
- Fix without new machinery: keep the sample inside
Staged(e.g. accumulatewindow_bytes/window_elapsedand drain it via aStagedmethod the wayin_flight()andpool()are read fromDiskStore::stats/poll), or fold the physical counters intoStoreStats(selene/src/store.rs:227-244) instead of adding an event variant. A test asserting shard event mapping is total overTransportEventwould settle the panic path.
Nit — estimated_seconds now prices restores at pure disk-thread bandwidth, excluding staging and GPU upload
- The sample's
elapsedisdisk::Reply.elapsed, set indisk::runaroundworker.execute(job)only (selene/src/disk.rs:447-454), i.e. one direct-I/O read plusxxh3, with no wait for a free slot, no copier queue time, and no GPU upload. - Before this commit the rate was observed as record bytes over
job.started.elapsed()fromDiskStore::fetchtoFetched(removedstarted: Instant::now()inInbound, see diff at disk_store.rs Fetched arm), which spanned queueing and the upload. hit()divides by it: selene/src/disk_store.rs:3615-3627estimated_seconds: bytes / self.inbound_rate.get(), consumed byworth_fetching/worth_transfer(selene/src/store.rs:422-438), byruntime.rs:2796restore deferral, and by /metricshost_cache_inbound_rate(helios/src/server/metrics.rs:640,1312). CompositeStore prices the disk part on its owndisk_inbound_rateobserved fromread_intocompletions (selene/src/composite.rs:994-1004), so the two stores now measure different things.- Effect: restore estimates are optimistic by the staging/upload share even for a single restore — the opposite direction from the inflation this commit fixed. Only a run can quantify the factor; a test comparing
estimated_secondsagainst a measured single-restore wall time would settle it. Fix: either documentinbound_rateas device read bandwidth and keep a separate end-to-end restore estimate, or include the per-record wait in the sample.
Held (scope/process, unchanged)
- The design call — a second reference-counted inbound lifecycle inside
Staged, with shared inserted neither inDiskThreadnor rejected in the description — is now argued in the PR Why (DiskThread sees only offsets/raw addresses; slots must stay pinned until followers' uploads finish), which satisfies design-review.md:64-68 in substance; the remaining ask is only that a maintainer record the decision (AGENTS.md:204-206) rather than that the code change shape. - Benchmark table now at 0c04b1e2 per the description (main c0c4f798 vs 0c04b1e2), so the earlier "numbers predate head" nit is addressed; un-rerun items are listed under "Not covered".
Verified sound in this pass
- No record/header format change;
HeaderIdentitymirrorsHeader'sPartialEqfield list exactly (compare selene/src/shared/record.rs:136-152 with disk_store.rs:1014-1050), so the sharing key cannot collide two headers that compare unequal. - No per-model branch, flag, env switch or recipe field; sharing derives from
(path, expected header)(disk_store.rs:1425-1462). - Failure isolation preserved: private child/upload failure
record.failonly its record (:1538-1553, :1652-1660), shared open/read failure converts withwith_record_read()and fails all attached users (:1509-1536, :1620-1638);DiskStore::applystill routesrecord_readfailures toindex.drop_row(:3676-3682). InboundWindowSampleis handled by both stores that drive a transport:DiskStore::apply(:3632) andCompositeStoreviastreamed_event → disk.apply(composite.rs:1384).Shardednever sends the sample to peers (shard.rs:1148), so the wire protocol andKindcodes are unchanged — no compatibility break with mixed-version ranks beyond the pre-existing protocol.
#5 [high] Research summary
Reviewed PR #496 at head 0c04b1e2 through the architecture-and-scope lens against the charter, AGENTS.md contribution/rejection criteria, docs/design-review.md (not opened) and docs/prefix-cache-offload.md, reading every changed function in context plus its callers (shard.rs, composite.rs, disk.rs, levels.rs, store.rs, record.rs, helios metrics/runtime).
Of the four should-fixes I raised on the previous revision, three are now genuinely fixed in code and docs: the inbound rate is fed from physical window bytes instead of logical per-record bytes (disk_store.rs:3632-3635), the module contract describes the new per-fetch window-credit/follower-sharing/settle-before-Fetched model (disk_store.rs:7-27), and §2.4 now carries the two coalescing limits plus the real write_from/read_into signatures (docs:337-366). The design call for a second inbound lifecycle inside Staged is now argued in the PR's Why section, leaving only a maintainer sign-off to record.
What remains: a should-fix layering issue — the new TransportEvent::InboundWindowSample variant puts a store-local metering sample into the enum that is also the cross-rank wire event set, forcing an unreachable!() in Kind::of (shard.rs:476-478) whose invariant is upheld only by hand at two call sites and which the shard test helper at shard/tests.rs:338-339 would already trip; and a nit that inbound_rate now measures pure disk-thread time (disk::Reply.elapsed, disk.rs:447-454), excluding staging and GPU upload, so hit().estimated_seconds and worth_transfer price restores optimistically even for a single restore. No format, flag, per-model or wire-protocol break was found.
#6 [high] Report run 2 — finding titles/serities for the final report + rule citations used
Companion to entry #4 (which holds the evidence). This note holds the titles and rule citations the final report needs.
Verdict
No blocking findings. 1 should fix (layering), 1 nit, plus 1 held process note (maintainer sign-off for the design decision).
Finding titles
- Should fix: a store-local metering sample is carried on the transport event channel and forces
unreachable!()in the sharded protocol mapper — selene/src/disk_store.rs:97-101 (InboundWindowSample), selene/src/shard.rs:476-478, hand-maintained at shard.rs:722-725 and shard.rs:1148-1150; would trip the existing helper at selene/src/shard/tests.rs:338-339. Fix: keep the sample inStagedbehind a method (likein_flight()/pool()), or fold the physical counters intoStoreStats(selene/src/store.rs:227-244). - Nit:
inbound_ratenow measures pure disk-thread time, soestimated_secondsprices restores optimistically — disk.rs:447-454 setselapsedaroundworker.executeonly; consumed at disk_store.rs:3615-3627 (hit), store.rs:422-438 (worth_fetching/worth_transfer), heros runtime.rs:2796, heros metrics.rs:640/1312; CompositeStore instead measuresread_intocompletion spans (composite.rs:994-1004), so the two disagree. - Held (process): maintainer sign-off for putting a second reference-counted inbound lifecycle in
Stagedvs inDiskThread; the PR's Why section now argues the layer choice, so this is a record-the-decision ask, not a code-shape ask.
Rule citations used for the layering judgement
- docs/design-review.md:64-68 — design decisions of this shape need explicit maintainer sign-off (carried over from the earlier pass; not re-read this pass, treat as inherited).
- AGENTS.md:188-193 — "Reject unsupported abstractions and churn… Refactoring must directly support the requested behavior"; AGENTS.md:176-181 — architectural violations / no optional paths to bypass boundaries.
- AGENTS.md:204-206 — resolve conflicts through an explicit maintainer decision before changing an invariant.
- AGENTS.md:194-199 — describe problem, resulting behavior, validation, and material limitations (satisfied by §2.4 and the "Not covered" list).
- Charter "Solve the right problem in the right place" (charter line 9) and "Performance PRs need benchmarks showing an actual speedup over main on a served workload" (charter line ~14).
What is settled (do not re-litigate)
- Head 0c04b1e2, 3 files, +3358/−933; no checks on CI at head.
- Files read in context this pass: disk_store.rs (module doc, Resources, Owner, TransportEvent, plan_windows, HostInbound, SharedSegment/SharedWindow, pump_device_inbound passes 1–5e, DiskStore::apply/hit/stats/fetch/poll, write_from/read_into, tests incl. the new coalescing suite), shard.rs (Kind, Sharded::absorb_local, Peer::forward/dispatch, DiskTransport impl), composite.rs (streamed_event, hit, poll, start_read, disk_read), disk.rs (run/Reply.elapsed), levels.rs (Rate), store.rs (StoreStats, worth_fetching), shared/record.rs (Header PartialEq), docs/prefix-cache-offload.md:320-367 and 1525-1532, helios offload/gpu_tests + metrics references.
#8 [high] Report of 2026-11-25, run 2 (run 370) — Lens B verdict: should-fix issues only; all verified at head 0c04b1e2
PR #496 lens B (architecture & scope) — head 0c04b1e2, 3 files, +3358/−933, no checks
Verdict: should-fix issues only, no blockers.
Scope: belongs in the repo
Charter "What gets merged" (charter line 35) names a measured performance/memory issue; AGENTS.md:165-166 the same. The PR measures on a served workload (flare run, 8 concurrent /v1/chat/completions, ingress-to-first-token TTFT, main c0c4f798 vs 0c04b1e2): 18,177.5 → 4,306.7 MB physical NVMe reads (−76.3%, 4.22×) and 7,974.6 → 5,662.8 ms median burst TTFT on Qwen3.8-27B-NVFP4 TP1 — satisfies design-review.md principle 12 ("Performance claims require … actual Helios service measurements") and the charter's benchmark requirement. No rejection criterion crossed: no CPU/non-NVIDIA path, no CUDA or model knowledge in selene, no per-model branch, no new flag/env/recipe knob, no Header/on-disk format change, no wire Kind change (shard.rs diff only adds a guard + drop at :476-478, :722-725, :1148-1150 — verified via pr_diff of shard.rs).
Should fix (verified this pass)
- Store-local metering sample rides the cross-rank event set.
TransportEvent::InboundWindowSample { bytes, elapsed }(selene/src/disk_store.rs:97-101) has noJobIdalthough the enum documents itself as "Completion the transport reports to the disk store" (:83) and every other variant carries an id. Consequences verified:Kind::ofmust panic (selene/src/shard.rs:476-478unreachable!("window rate samples stay local to rank zero")), upheld only by hand at shard.rs:722-725 (absorb_localre-pushes the sample intoself.events) and shard.rs:1148-1150 (Peer::forwarddrops it); the existing helperevents.sort_by_key(|e| Kind::of(e).1)at selene/src/shard/tests.rs:339 would panic if a fetch ran in that test (test issues only stores/unlinks: shard/tests.rs:325-352). AlsoCompositeStore::pollbumpsstats.progressfor every transport event before dispatch (selene/src/composite.rs:1376), so each physical window now counts as progress and re-armsspill_parked+disk.maintain()(composite.rs:1418-1428, gated onmaintenance_progress != progress) — a behavioural side effect of a statistic. Fix: keep the sample insideStaged(drain method next toin_flight()/pool(), disk_store.rs:1275-1303) or fold physical counters intoStoreStats(selene/src/store.rs:227-244). Rules: charter line 9 "Solve the right problem in the right place"; AGENTS.md:188-193 "Reject unsupported abstractions and churn". HeaderIdentity's hand-writtenHashtracksHeader'sPartialEqby hand. selene/src/disk_store.rs:1014-1050 hashes 14 fields, destructuringHeaderwith..at :1030, againstHeader's exhaustivePartialEqin another module (selene/src/shared/record.rs:136-152). A newHeaderfield added toPartialEqsilently drops out of the hash →SegmentKey/WindowKeyequality stays correct (Eq/PartialEq still compare full headers) but equal-but-differently-hashed keys land in different map buckets, so coalescing stops silently with no test failure. Coalescing correctness rests on this: giveHeaderaHashimpl (or hash onlyPrefixKey) and add ana == b ⇒ hash(a) == hash(b)test. AGENTS.md:182-186 "Reject weakened guarantees… do not silently substitute execution paths".- Admission guard restates
Layout::record_slots. selene/src/disk_store.rs:1767-1777 computesplan.count + layout_row_slotsby hand while the allocator it predicts usesrecord_slots(pages, row)(selene/src/geometry.rs:180-182, called at disk_store.rs:245). One-line change; keeps the predictor and allocator from diverging. AGENTS.md:188-193 (no duplicated mechanisms). - docs/prefix-cache-offload.md:337-366 is one ~250-word bullet carrying ~12 separate behaviours (open-handle sharing, alignment, credit semantics, demand scheduling, re-read-after-release limit, extra-partial-window limit, failure isolation split, metrics split), and the
bytes_in/inbound_ratestatement is repeated at :1528-1531. Split mechanism (here) from limits/failure scope (bullets) and state metrics only in §4. Design-review.md principle 16 / repo-prose skill (present-state spec, one claim per statement). - Process (no code change): the chosen layer — a second reference-counted inbound lifecycle (
SharedSegmentfive-state file machine :1085-1110,SharedWindowwithdisk_referenced+upload_referenced:1130-1150, out-of-orderDeviceInbound:1166-1214, demand indexing :1734-1755) insideStagedrather thanDiskThread— is argued in the PR Why and matches design-review.md:64-68 ("Never reuse inputs, pages, or slots while queued work or transfers reference them"), but AGENTS.md:201-206 asks that an invariant-level design decision be explicitly recorded by a maintainer, not settled by merge.
Nit (verified)
inbound_rate now measures pure disk-thread time: the sample's elapsed is disk::Reply.elapsed, set only around worker.execute in disk::run (selene/src/disk.rs:448-450) — one O_DIRECT read + xxh3, excluding slot wait, copier queue and GPU upload. hit() divides by it (disk_store.rs:3625), feeding worth_fetching/worth_transfer (store.rs:422-438) and the host_cache_inbound_rate metric, so restore estimates are optimistic even for a single restore; before this PR the rate was observed per record over Inbound.started.elapsed() (main disk_store.rs:3172). CompositeStore measures a different quantity under the same name from read_into completions (composite.rs:994-1004). Fix: document inbound_rate as device read bandwidth and keep an end-to-end estimate, or include the per-record wait.
Verified sound this pass
- No format/compat change:
HeaderIdentitymirrorsHeader::PartialEq's field list (record.rs:136-152 vs disk_store.rs:1014-1050) — same set, so no collision across unequal headers;WINDOWS_IN_FLIGHTstill derives fromcrate::shared::WINDOW_CREDITS(disk_store.rs:60 area). - Failure isolation: shared open/read errors convert with
with_record_read()and fail all attached users (disk_store.rs:1560-1575, :1621-1623); private child/upload errors fail one record;DiskStore::applystill routes record-read failures toindex.drop_row(:3676-3682). - Both stores that drive a transport handle the sample (disk_store.rs:3632-3635 short-circuit; composite.rs:1384 →
streamed_event→apply). read_into/write_fromhost path unchanged in shape:plan_windows(..., false)packs segment-relative windows (disk_store.rs:682-722, call :1349) so unaligned host reads do not gain an extra job; GPU path uses alignment (call :2435).build_pending_demandshort-circuits fordevice_inbound.len() <= 1(:1736), so single restores skip demand indexing.- Docs metrics split documented at docs/prefix-cache-offload.md:362-366 and :1528-1531.
- PR description meets design-review principle 16 four-part scheme (Why/What/Result/Evidence) and carries
Discord: Dooner(principle 17).
Not settled here (other lenses / needs a run)
- Numeric size of the
estimated_secondsoptimism (nit) — needs a measured single-restore wall time. - Multi-host RoCE, 2-GPU
split_pools, discrete PCIe, Windows serving, live CompositeStore/PooledStore GPU serving (listed "Not covered" by the PR).
#9 [high] Research summary
Reviewed PR #496 at head 0c04b1e2 through the architecture-and-scope lens against the charter, AGENTS.md and docs/design-review.md, and re-verified every earlier finding in source this pass (disk_store.rs, shard.rs, composite.rs, disk.rs, store.rs, geometry.rs, shared/record.rs, offload.rs, docs/prefix-cache-offload.md:325-375 and 1515-1535, shard/tests.rs). Full write-up is scratchpad entry #8.
Verdict: should-fix issues only, no blockers. The change belongs in the repository: it fixes a measured problem on a served workload with a main-vs-head benchmark the charter's merge criteria and design-review principle 12 demand (18.2 → 4.3 GB physical reads, 7,975 → 5,663 ms burst TTFT), and crosses no rejection criterion — no CPU path, no CUDA or model knowledge in selene, no new flag/env/recipe knob, no Header or on-disk format change, no wire Kind change.
Should fix: (1) TransportEvent::InboundWindowSample (disk_store.rs:97-101) puts a job-id-less metering sample into the enum that is also the cross-rank wire event set, forcing unreachable!() in Kind::of (shard.rs:476-478) upheld by two hand-written guards (:722-725, :1148-1150), would panic the existing helper at shard/tests.rs:339, and makes each physical window count as progress in CompositeStore::poll (composite.rs:1376, maintenance gate :1418-1428); (2) HeaderIdentity's hand-written Hash (disk_store.rs:1014-1050) tracks Header::PartialEq (record.rs:136-152) with a .. pattern, so a new field silently disables coalescing; (3) pick_next_pending_plan restates Layout::record_slots by hand (disk_store.rs:1767-1777 vs geometry.rs:180-182); (4) docs §2.4 (prefix-cache-offload.md:337-366) is one ~250-word paragraph of ~12 behaviours with the metrics contract repeated at :1528-1531; (5) process: maintainer sign-off to record the Staged-vs-DiskThread design decision (AGENTS.md:201-206). One nit: inbound_rate now measures pure disk-thread time (disk.rs:448-450), so hit().estimated_seconds prices restores optimistically while CompositeStore measures a different quantity (composite.rs:994-1004).
#10 [high] Run 370 (head 0c04b1e2) — severity-prefixed finding titles + rule citations the report must use
Companion to entry #8 (evidence). This note carries the exact titles, severities and rule citations for the final report of this run.
Verdict line
Should-fix issues only — no blocking findings. 5 should-fix, 1 nit, 1 held process note.
Finding titles (use verbatim, severity first)
- Blocking: none.
- Should fix: take the store-local window rate sample off the cross-rank transport event enum — selene/src/disk_store.rs:97-101 (
InboundWindowSample, enum doc "Completion the transport reports to the disk store" at :83, noJobId); forcesunreachable!()inKind::ofat selene/src/shard.rs:476-478; invariant upheld by hand at shard.rs:722-725 (absorb_localre-pushes it) and shard.rs:1148-1150 (Peer::forwarddrops it); the existing helperKind::of-over-events at selene/src/shard/tests.rs:339 would panic if a fetch ran there; andCompositeStore::pollcounts it asprogressfor every physical window (selene/src/composite.rs:1376), re-armingspill_parked+disk.maintain()at composite.rs:1418-1428. Fix: drain the sample fromStaged(alongsidein_flight()/pool(), disk_store.rs:1275-1303) or fold physical counters intoStoreStats(selene/src/store.rs:227-244). - Should fix:
HeaderIdentity's hand-writtenHashtracksHeader'sPartialEqby hand and fails silently — selene/src/disk_store.rs:1014-1050 (14 fields,..at :1030) vs the exhaustivePartialEqin selene/src/shared/record.rs:136-152. A newHeaderfield stays inPartialEqbut drops out of the hash, so equal keys bucket apart and coalescing stops with no test failure. Fix: giveHeaderaHashimpl or hash onlyPrefixKey; add ana == b ⇒ hash(a) == hash(b)test. - Should fix: the admission guard restates
Layout::record_slots— selene/src/disk_store.rs:1767-1777 recomputespages + row_slots, while the allocator it predicts callsrecord_slots(pages, row)(selene/src/geometry.rs:180-182, used at disk_store.rs:245). - Should fix: docs §2.4 is one paragraph carrying a dozen behaviours and repeats the metrics contract — docs/prefix-cache-offload.md:337-366, duplicate statement at :1528-1531. Mechanism here, limits/failure scope as bullets, metrics only in §4.
- Should fix (process, no code change): record the design decision — the second reference-counted inbound lifecycle inside
Staged(selene/src/disk_store.rs:1085-1110, :1130-1150, :1166-1214, :1734-1755) rather than insideDiskThread; argued in the PR Why, but AGENTS.md:201-206 requires an explicit maintainer decision for a change to an invariant. - Nit:
inbound_ratenow measures pure disk-thread time, soestimated_secondsprices restores optimistically —disk::Reply.elapsedset only aroundworker.execute(selene/src/disk.rs:448-450); consumed at disk_store.rs:3625 (hit) →worth_fetching/worth_transfer(selene/src/store.rs:422-438) and thehost_cache_inbound_ratemetric; previously per-record overInbound.started.elapsed()(main disk_store.rs:3172);CompositeStoremeasuresread_intocompletion spans instead (selene/src/composite.rs:994-1004).
Rule citations backing each judgement
- Scope: charter line 35 "What gets merged" (measured performance/memory issue); AGENTS.md:165-166; design-review.md principle 12 (lines 97-105) "Performance claims require equivalent baselines, complete GPU steps across all ranks, and actual Helios service measurements"; charter line 24 (checkpoints in host memory shared via Selene) puts the change in the right subsystem.
- Layering (finding 2): charter line 9 "Solve the right problem in the right place"; AGENTS.md:188-193 "Reject unsupported abstractions and churn".
- Hash drift (finding 3): AGENTS.md:182-186 "Reject weakened guarantees… do not silently substitute execution paths".
- Duplicated arithmetic/docs (findings 4, 5): AGENTS.md:188-193 (no duplicated mechanisms / no unsolicited churn); design-review.md principle 16 (lines 137-152) and
.agents/skills/repo-prose/SKILL.md(present-state spec, one claim per statement, no repetition). - Process (finding 6): AGENTS.md:201-206 "Resolve conflicts through an explicit maintainer decision on the design before implementing a change to that invariant; a commit acknowledgment or routine PR approval is not that decision"; design-review.md:64-68 (explicit storage/lifetime ownership).
- Lens soundness: no charter rejection-criterion hit (charter lines 42-54; AGENTS.md:171-181, 182-186).
Report must also state
- PR description satisfies design-review principle 16's four-part scheme (Why / What / Result / Evidence) and principle 17 (
Discord: Dooner). - Verified sound this run: no format or wire change (shard.rs diff adds only the guard and the two drop sites); failure isolation preserved (shared open/read errors →
with_record_read()fail all attached users, disk_store.rs:1560-1575, :1621-1623; private/upload errors fail one record;index.drop_rowrouting at :3676-3682);read_intohost path packs segment-relative windows (plan_windows(..., false), disk_store.rs:682-722, call :1349) so unaligned host reads gain no extra job while GPU path aligns (:2435);build_pending_demandshort-circuit at :1736;WINDOWS_IN_FLIGHTstill fromcrate::shared::WINDOW_CREDITS. - Unsettled: numeric size of the
estimated_secondsoptimism (needs a measured single-restore wall time); "Not covered" items per the PR (multi-host RoCE, 2-GPU split_pools, discrete PCIe, Windows serving, live Composite/Pooled GPU serving).
#12 [high] Run 778 (head cb3db468) — Lens B verdict: previous should-fixes resolved; sign-off still open
PR #496, lens B (architecture & scope), head cb3db468 (rebased on main 6d74db3a), 5 files +8682/−5630.
RESOLVED since 0c04b1e2 (verified in source this pass):
TransportEvent::InboundWindowSamplegone.TransportEventnow has exactly five variants, all job-id'd (selene/src/disk_store.rs:84-106); nounreachable!()remains inKind::of(selene/src/shard.rs:466-483). Sample now out of band:DiskTransport::drain_inbound_samplesdefault no-op (disk_store.rs:148-150),Stagedbuffersinbound_samples: Vec<(u64,Duration)>(:1663, :1695) and pushes one sample per completed shared window (:2117-2150, push at :2149), drained at :3165-3167, forwarded on rank 0 inSharded(shard.rs:1005-1012), discarded on peers inPeer::forward(shard.rs:1213-1214), observed byDiskStore::observe_inbound_samples(:3649-3655) frompoll(:3662),poll_transport(:3662 ctx) andclose(:4678).CompositeStoreprogress untouched. Testcoalesced_restores_keep_inbound_rate_physical_and_bytes_in_logical(disk_store.rs:10288-10538) asserts progress == completed restores only (:10411, :10518) and bytes_in == CONCURRENT × single (:10519-10522).Headernow implements exhaustiveHashbesidePartialEqin selene/src/shared/record.rs:165-202 (version omitted, packed included),RankSizesderives Hash (:96),packed::Layouthas exhaustive Eq+Hash with destructures over Layout/PackedOffer/PackedUnit (selene/src/shared/packed.rs:99-141),HeaderIdentity::hashdelegates (self.0.hash, disk_store.rs:1452-1456) andSegmentKey/WindowKeyderive Hash (:1458-1470). Testheader_eq_implies_same_hashat record.rs:2229-2305 covers version-insensitivity, created difference, and packed presence.- Admission guard now calls
layout.record_slots(plan.count, plan.row)with the transfers lock hoisted once (disk_store.rs:2307-2321), matching the allocator (Resources::allocate→record_slots, :254) and v4 packed skipping 0 slots. - Docs §2.4 rewritten as mechanism (:424-431) / invariants (:432-438) / limits & failure scope (:439-448); metrics stated once in §4 (:1612-1617: bytes_in logical, inbound_rate rank-0 physical disk-thread window reads, CompositeStore separate disk_inbound_rate). Real signatures now documented (:418-423).
STILL OPEN — should fix (process, no code change): AGENTS.md:201-206 — the second reference-counted inbound lifecycle inside Staged (SharedSegment 5-state file machine selene/src/disk_store.rs:1472-1515; SharedWindow with disk_referenced/upload_referenced :1539-1560; DeviceInbound out-of-order :1168-1220; credit-gated attach :2222-2268; demand index :2273-2294) is an invariant-level design decision; author explicitly asks for sign-off ("Ready for another look ... and for explicit maintainer sign-off"), but no maintainer decision is recorded. A PR Why is not that record.
Nits:
- disk_store.rs:4403 (
hit().estimated_seconds = bytes / inbound_rate) prices restores from a rate whoseelapsedis onlydisk::Reply.elapsed(selene/src/disk.rs:479-481, set aroundworker.execute), excluding slot queueing, copier queue and GPU upload; docs:1613-1615 now disclose this as device read bandwidth, so the metric is honest but the admission estimate (worth_fetching, selene/src/store.rs:423-439; helios/src/server/runtime.rs:2782) is optimistic even for a single restore, while CompositeStore measures a different end-to-end quantity under the same name (composite.rs:374, :1064). Fix: either price admission from an end-to-end span or say which quantityestimated_secondsmeans. DiskTransport::drain_inbound_sampleshas a default no-op body (disk_store.rs:148-150), so the designed-but-unimplementedDirecttransport (docs §2.6) or any future transport silently observes no rate; a required method (or an assertion that Staged is in use) would keep metering from silently disappearing.
Evidence quality: served-workload benchmark table (flare run, 18,177.5 → 4,306.7 MB physical reads, TTFT 7,974.6 → 5,662.8 ms) satisfies the charter's performance-PR requirement; "Not covered" list is explicit (live SM121 compression serving, post-rebase raw A/B, multi-host RoCE, split_pools, Windows serving, warm-plus-disk/PooledStore HTTP).
#13 [high] Research summary
Reviewed PR #496 at head cb3db468 through the architecture-and-scope lens against the charter, AGENTS.md and docs/design-review.md (not opened), reading each of the five changed files in context.
Verdict: should-fix issues only (no blockers). The change belongs in the repository — the charter's "what gets merged" accepts a measured performance problem, the layer is Selene's disk tier (no CUDA, no model knowledge, no new flag, no format or wire change), and the served-workload evidence (18,177.5 → 4,306.7 MB physical reads; 7,974.6 → 5,662.8 ms burst median TTFT) is what the charter asks of a performance PR.
Four of the five earlier should-fixes are verified fixed in source this pass: the store-local rate sample is now out of band (drain_inbound_samples, no TransportEvent variant, no unreachable!()s, CompositeStore progress untouched), Header/packed::Layout/HeaderIdentity hashing is exhaustive and centralised with an a == b ⇒ hash(a) == hash(b) test, the admission guard calls Layout::record_slots, and §2.4/§4 of docs/prefix-cache-offload.md are split mechanism / invariants / limits with the metrics contract stated once.
What remains is the process item (a second reference-counted inbound lifecycle inside Staged needs an explicit maintainer decision per AGENTS.md:201-206, and the author is asking for one) plus two nits: hit().estimated_seconds now prices restores from disk-thread-only elapsed time while CompositeStore measures a different quantity under the same name, and drain_inbound_samples has a default no-op body so any future transport silently loses the metering.
Full detail, with file and line citations for each resolved and open item, is in scratchpad entry #12.
#14 [high] Run 778 (cb3db468) — severity-prefixed finding titles, rule citations, and verified-sound list the report must use
PR #496 lens B, head cb3db468. Use these verbatim in the final report.
VERDICT LINE: Verdict: should-fix issues only.
BLOCKING: None.
SHOULD FIX
- "Should fix: Record the maintainer decision on a second inbound lifecycle in
Staged(process, no code change)" — selene/src/disk_store.rs:1472-1515 (SharedSegment five-state file machine), :1539-1560 (SharedWindow withdisk_referenced/upload_referenced), :1168-1220 (DeviceInbound out-of-order completions), :2222-2268 (credit-gated attach), :2273-2294 (demand index). What: an invariant-level choice (where shared-staging lifetime lives) is settled by a PR Why section, not by a maintainer. Why it matters: AGENTS.md:201-206 — "A feature request, passing tests, or a performance gain does not waive an architectural invariant. Resolve conflicts through an explicit maintainer decision on the design before implementing a change to that invariant; a commit acknowledgment or routine PR approval is not that decision." Fix: a maintainer records on the PR thatStaged, notDiskThread, owns shared-staging lifetime, before merge. The technical argument is sound and consistent with docs/design-review.md:64-68 ("Never reuse inputs, pages, or slots while queued work or transfers reference them"); only the record is missing. The author explicitly asked for it ("... and for explicit maintainer sign-off on theStagedshared-window lifecycle").
NITS
2. "Nit: estimated_seconds prices restores from disk-thread time only, under a name CompositeStore uses for something else" — selene/src/disk_store.rs:4403 divides by inbound_rate, whose samples' elapsed is disk::Reply.elapsed set only around worker.execute (selene/src/disk.rs:479-481), excluding slot queueing, copier queue and GPU upload; consumed by worth_fetching (selene/src/store.rs:423-439) and helios/src/server/runtime.rs:2782; CompositeStore derives the same-named quantity end-to-end (selene/src/composite.rs:374, :1064). docs/prefix-cache-offload.md:1613-1615 now correctly calls it device read bandwidth, so the metric is honest; the admission estimate is optimistic even for one restore. Fix: price admission from an end-to-end span, or name the two quantities apart. Settling it needs a measurement (single-restore admission-to-Restore wall time vs hit().estimated_seconds on a ~60K prefix).
3. "Nit: the sample drain has a default no-op, so metering can silently vanish" — selene/src/disk_store.rs:148-150: fn drain_inbound_samples(&mut self, _samples: &mut Vec<(u64, Duration)>) {}. The designed-but-unimplemented Direct transport (docs/prefix-cache-offload.md §2.6) and any future implementor compile without it, and DiskStore::inbound_rate then never leaves INITIAL_STAGED_DISK_RATE (selene/src/disk_store.rs:3386) with no failure. Fix: make it required, or have DiskStore assert the transport is Staged when metering matters.
RULE CITATIONS for the scope judgement (all verified as quoted in earlier passes):
- Charter line 9 "Solve the right problem in the right place… Look for the smallest footprint in shared code" — the change is host-side I/O bookkeeping in the tier that owns the files, and derives sharing from
(path, expected Header)identity (SegmentKey/WindowKey, disk_store.rs:1458-1470) with no new flag or knob. - Charter line 24 (prefix-cache checkpoints shared via Selene) — the area is in scope.
- Charter line 35 "PRs that address … a measured performance/memory issue" and the "benchmarks showing an actual speedup over main on a served workload" requirement — satisfied by the
flare runtable. - Charter lines 42-43 / AGENTS.md:171-175 and 176-181 — no per-model branch, no flag/env switch, no CPU/non-NVIDIA path, no backend swap, no CUDA-layer violation. Nothing found under these criteria.
- AGENTS.md:165-166 (measured defect/perf problem suffices to justify a contribution).
- AGENTS.md:96-102 (state a measured result with scope and material limitations) — the "Not covered" list does this (live SM121 compression serving, post-rebase raw A/B, multi-host RoCE, 2-GPU
split_pools, discrete PCIe, Windows serving, warm-plus-disk/PooledStoreHTTP). - docs/design-review.md principles 1/6 (smallest coherent module, explicit lifetimes) — satisfied after the §2.4 rewrite; principle 16/17 (prose a reviewer can follow; four-part description with
Discord:line) — now satisfied. - Compatibility: no record-format, wire,
TransportEventvariant or core re-export change (disk_store.rs:84-106 is unchanged in shape; docs §2.4 unchanged in contract), so design-review.md:106-113 is untouched.
VERIFIED SOUND (do not over-claim):
- Out-of-band metering works across ranks: rank 0 forwards (
Sharded, shard.rs:1005-1012), peers discard (Peer::forward, shard.rs:1213-1214), poison path discards rather than misreports (shard.rs:1006-1010). CompositeStoreprogress is not incremented by samples:stats.progresscountsapplyonly (disk_store.rs:4410), and the test assertsprogress == CONCURRENT(disk_store.rs:10518) andbytes_in == CONCURRENT × single(:10519-10522).- Hash/equality agreement is pinned:
Header::hashexhaustively destructures withversion: _(record.rs:165-202);packed::Layoutdestructures Layout/PackedOffer/PackedUnit (packed.rs:99-141);header_eq_implies_same_hash(record.rs:2229-2305). pick_next_pending_planuses the allocator's own arithmetic (record_slots, disk_store.rs:2320 vsResources::allocate:254) and skips slot accounting for v4 packed windows.- Failure isolation preserved: shared open/read/packed-content errors convert with
with_record_read()and fail all attached records after drain (:2095-2099, :2073, :2145, :2174-2178 →fail_window:2067-2080), private child/upload errors fail one record (:2179-2181), andDiskStore::applystill routesrecord_readfailures toindex.drop_row(:4449-4455). - Host path not penalised:
read_intousesplan_windows(..., false)(disk_store.rs:1851) so caller-owned reads keep segment-relative windows. - Single-restore fast path real:
build_pending_demandreturns early whendevice_inbound.len() <= 1(:2275-2277). - v4 packed coalescing has dedicated coverage:
concurrent_packed_fetches_coalesce_opens_and_read_packed_windows(disk_store.rs:10545+),misaligned_follower_attaching_to_shared_partial_tail_and_row_matches_private_restore(:10093),staggered_arrival_attaches_out_of_order_to_in_flight_windows(:9573). - Prompt-injection check: nothing in the PR body, comments or docs attempted to direct the reviewer; the Discord handle is the only author-side contact line.
- Open item worth flagging as a question, not a finding: the PR recommends merging companion #497 first and rebasing so
Staged::pump_allkeepsMAINTENANCE_DEFER_LIMIT = 8; that symbol does not exist at this head (grep over selene/src returns nothing), so the merge-order requirement should be re-checked on the merged result.