Prose review — PR #496, "Coalesce shared ancestor reads across concurrent Selene disk fetches"
Head 0c04b1e2, base main; 3 files (+3358/−933): selene/src/disk_store.rs, selene/src/shard.rs, docs/prefix-cache-offload.md.
Rules applied: AGENTS.md §"Required prose review" (lines 43–70) and §"Required PR descriptions" (lines 72–140: the four-part Why / What / Result / Evidence order, "distinguish an expectation from a measured result", connect claims to the artifact actually tested, explain differences between runs and keep material failures visible, name the companion PR and merge order, Discord: line); .agents/skills/repo-prose/SKILL.md (not opened) (present-state specification, resolve references, "state evidence as conditions, measurement, result, and conclusion", separate measurements from hypotheses); docs/design-review.md (not opened) principle 16 ("Write without hidden context").
Key findings
- No blocking or should-fix prose findings remain at this head. The three items that should have been fixed at the previous head (
f9c9191) are all fixed — see "Verified fixes" below — and no new defect was introduced in the rewrite. - Nit (PR description): the "Physical
inbound_rateand logicalbytes_in" bullet says oneInboundWindowSampleis emitted "per completed physical window read", but the only emitter is the shared device-fetchstaging path. Caller-ownedread_intorestores emit none. - Nit (PR description): two Flash-Next "Read Reduction" ratios do not match the MB columns (3.99x vs 4.01, 3.52x vs 3.54); the caption does not say whether the column is a ratio of tabulated means or a mean of per-trial ratios.
- The docs addition to
docs/prefix-cache-offload.md§2.4 (and the one-line restatement in §4) is accurate, present-tense and self-contained, and the code comments in the diff describe the code as it exists.
Angle 1 — PR description
The four parts are present, in order, and argued causally rather than by vocabulary dump:
- Why explains the Helios endpoint-key dedup that makes each branch submit its own
Staged::fetch, and why sharing is valid (published record files are immutable and pinned inDiskStore), and why the coalescing point must beStagedrather thanDiskThread(the disk thread sees only file offsets and raw host addresses and finishes atxxh3completion, whereas shared staging slots must stay pinned until every attachedCopierupload completes). SatisfiesAGENTS.md's requirement that Why name the mechanism, not just the symptom. - What gives four bolded before/after bullets: the separated host and GPU read paths with their differing window planning, reference-counted windows with credit-based attachment and the
device_inbound.len() <= 1short-circuit, physicalinbound_rateversus logicalbytes_in, and failure isolation plus docs. It explicitly states the compatibility line ("No core re-export or format change is required"), which is what a reviewer of a cache-layer change needs. - Result gives the measured table and then a clearly labelled "As an expected bound" paragraph for the single-restore cost — the distinction
AGENTS.mdrequires. - Evidence names the suites, the counts (
476crate tests,21single-GPUoffload::tests,13coalescing tests on Windows IOCP,pytest tests/preparation/test_core_boundary.py(not opened)), and a genuine "Not covered" list. - The companion-PR paragraph states what #497 contributes, that both base on
main, and that whichever merges second reconcilesStaged::pump_all, with the specific call-order consequence (host_inboundandpump_device_inboundahead of writes and maintenance).Discord: Dooneris present.
Verified fixes since the previous head
- Misplaced rustdoc — fixed.
selene/src/disk_store.rs:236reads "Free slots in the shared pool; zero when this transport has no pool." abovefn free_slots(:237-239), and the original two-line contract comment ("Slots forpagespage records and, whenrow, all row pieces;Noneleaves the pool unchanged when it cannot supply all of them.") is back directly abovefn allocateat:241-243; the function body at:243-254does exactly that (allocatesrecord_slots(pages, row)and returnsNonewithout touching the pool when the pool cannot supply it). - Unexplained deterministic score difference — fixed. Evidence now reports 5 cold-VRAM restart repeats (
seed = 1234..1238,60,534prompt tokens,top_logprobs = 5) with identical FP32 top-5 logprobs and token IDs onmainand head across all 5 (6/9, 8/9, 7/9, 9/9, 4/9), and attributes the cross-seed variation to positive-temperature sampling; it also explains why greedy is unavailable (Helios clamps requesttemperatureinto the core's positive sampling range). That turns a bare "8/9 vs 7/9" into a conclusion, which is whatAGENTS.mdasks for. - Expected cost stated as result — fixed. Now: "As an expected bound, single-restore callers skip demand indexing (
device_inbound.len() <= 1) and pay at most one extra partial window per segment whenskip_pages % 64 != 0." The<= 1short-circuit exists inbuild_pending_demand, and the one-extra-partial-window bound follows from the aligned plan (see "Verified accurate claims"). - Benchmark provenance — fixed. "Benchmark setup: … comparing
main(c0c4f798) against0c04b1e2" names the head as the tested artifact, and the "Not covered" list no longer contradicts it.
Nit — the InboundWindowSample claim is scoped wider than the code
"Emit one
TransportEvent::InboundWindowSampleper completed physical window read fromdisk::Reply.elapsed(forwarded on rank 0 inSharded, ignored on peer ranks) soDiskStore::inbound_rateprices admission from physical disk bandwidth whileStoreStats.bytes_instays logical."
The sole push site of TransportEvent::InboundWindowSample is Staged::apply_shared_disk (selene/src/disk_store.rs:1617-1620, reached through Owner::SharedSegment in step, :2339-2341), i.e. only shared device-fetch staging windows. The caller-owned host path (HostInbound / read_into) is dispatched separately (:2334-2338) and never emits a sample. Consequence: for a DiskStore whose restores run through read_into (the composite path), inbound_rate is not fed by those reads. docs/prefix-cache-offload.md:362-366 and :1528-1531 say "physical staging-window disk reads", which is closer but still reads as covering both paths.
Fix: in the What bullet say one sample per completed shared device-fetch staging window, and state what feeds inbound_rate for caller-owned reads.
Nit — two read-reduction ratios do not match the tabulated MB figures
Read Reduction column vs the MB columns in the Result table:
- 27B simultaneous: 18,177.5 → 4,306.7 MB, 4.22x = 4.221 ✓
- 27B staggered: 18,194.2 → 4,843.6 MB, 3.76x = 3.756 ✓
- Flash-Next simultaneous: 7,944.9 → 1,981.1 MB, claimed 3.99x; ratio of the tabulated means is 4.010.
- Flash-Next staggered: 7,958.0 → 2,251.5 MB, claimed 3.52x; ratio is 3.535.
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%). The discrepancy is plausibly a mean of per-trial ratios while the table otherwise reports means of trials (the 27B rows say "means over 2 interleaved repeats"; the Flash-Next rows do not say). Fix: say in the caption whether "Read Reduction" is the ratio of the tabulated means or the mean of per-trial ratios, and make the two Flash-Next values consistent (4.01x / 3.54x under a ratio of means).
Verified accurate claims (spot-checked against the code)
- "at most one extra partial window per segment when
skip_pages % 64 != 0" matches the aligned planning inplan_windows(..., align_to_window = true)(selene/src/disk_store.rs:679-681, body around:702-734). Stagedsignatures in the docs (write_from(id, header, temporary, path, pages, row, sums),read_into(id, path, expected, first_page, pages, row)) matchselene/src/disk_store.rs:1308and:1334.shard.rsforwarding::722forwardsInboundWindowSampleon rank 0,:476'sunreachable!()is guarded by that earliermatches!check, andPeer::pollignores them (:1148).
Angle 2 — Commit messages
Single commit, "Coalesce shared ancestor reads across concurrent Selene disk fetches": imperative mood, scoped to the layer it changes, matching neighbouring selene subjects ("Keep checkpoint cache counts instead of scanning for stats (#460)", "Link host-cache records under any offered ancestor, not only the nearest (#429)"). Its body carries the same four-part argument as the description. Nothing to fix.
Angle 3 — Docs changed (docs/prefix-cache-offload.md)
§2.4 (lines 333–366) now states, in present tense: shared open handle and window coalescing aligned to WINDOW_PAGES (64-page) boundaries in the record file; one GPU upload per attached restore from the shared slots; slots returning only after disk read and every upload complete; read_into reads slicing relative to each request's starting page and running independently; the immutability/pin precondition and the close-before-Fetched invariant; preference for windows demanded by sibling restores; both sharing limits (only Reading/Read windows, so released windows are re-read; and the one-extra-partial-window bound); the shared-versus-private error scope; and the logical bytes_in versus physical inbound_rate accounting. §4 (lines 1528–1531) restates the accounting split consistently.
Judged against the prose skill's hidden-context test, the paragraph resolves fetch/read_into from the same bullet and from §2.2, and it now says what the windows are aligned to (the previous nit). The earlier optional nit — that shared-error versus private-error scope appeared only in the PR body — is also resolved at :358-362, so the design document is self-contained. No findings.
Angle 4 — Code comments in the diff
- Module doc,
selene/src/disk_store.rs:14-27: accurate — at mostWINDOW_PAGESpages per window;WINDOWS_IN_FLIGHTcredits per outbound record, host read or device fetch; one shared handle per record file; one GPU upload per follower;Fetchedafter the disk close settles. SharedFileState(:1066-1078),SharedSegment::reusable/settled(:1097-1110),SharedWindow's release condition (:1125-1129) all match the implementation, includingsweep_shared_windows'sfollowers.is_empty() && disk_referenced == 0 && upload_referenced == 0.HeaderIdentity'sHashcontract (:1001-1050) is consistent withHeader'sPartialEqfield list inselene/src/shared/record.rs:136-152(both excludeversion).- Pass comments in
pump_device_inbound("Pass 1" … "Pass 5a"–"Pass 5e", including "Pass 4: start new shared windows (or attach to one started by an earlier record in this pass) as slots and disk queue depth allow.") are invariant/intent comments, not journey narration; acceptable under the prose skill. - The diagnostic counters (
disk_opens,disk_window_reads,coalesced_windows,:1285-1295) are gated under#[cfg(any(test, feature = "test-support"))], matching the description's "Gates diagnostic counters under#[cfg(any(test, feature = "test-support"))]". - Test names state the property under test (
different_skip_pages_coalesce_aligned_windows_to_exact_gpu_pages,misaligned_follower_attaching_to_shared_partial_tail_and_row_matches_private_restore,coalesced_restores_keep_inbound_rate_physical_and_bytes_in_logical,shared_ancestor_failure_propagates_to_all_followers_without_leaks), and each corresponds to a claim made in the description.
Open questions and what could not be checked
- Whether the two Flash-Next "Read Reduction" values are a mean of per-trial ratios cannot be settled from the description; only the author's raw trial records would settle it. Either way the fix is a caption sentence.
- Whether suppression of
InboundWindowSampleon theread_intopath was intentional is a behavioural (not prose) judgement; the prose fix is to scope the sentence. If it is intentional, one clause saying composite restores keep their own disk-rate estimate would make the description complete. - Not verified here (outside the prose lens): the correctness of the coalescing logic itself, the live benchmark numbers, and multi-host/Windows claims. Nothing in the description asserts an artifact I could not locate in the tree or in the diff.
- No instructions were embedded in the material reviewed; nothing in the diff, comments or docs attempted to direct the reviewer.