Recommendation: Ready To Merge
Head 0ebee3d4 cleanly rebases onto main (4cc6f2fd, preserving #660 and #670) and resolves every blocker, disclosure item, subtraction, and platform/ordering nit from Round 2 — including the RowRestoreLatency::start decay-clock bug (with a dedicated aged-median regression test), flare_selene::worth_restore deduplication, HostAdmissionProbe extraction, Windows is_direct_unsupported parity, shared levels::POOL_LEVELS, and explicit PR-body disclosures. Direct verification of all four subsystems on 0ebee3d4 confirms no remaining correctness, safety, concurrency, or CI blockers; only optional follow-up cleanups and merge-order coordination remain.
Merge Risk
Level: Medium
- Broad cross-crate cache-core surface (
+10,106 / -1,158across 42 files): Modifies GPU VMM snapshot-alias planning (helios/src/runtime_core/cache_memory.rs), scheduler pressure eviction and prefill-delta pricing (helios/src/scheduler/), local/pooled host offload and direct I/O (selene/), and manager arena retention and event-driven waiter wakeups (selene-manager/src/store.rs,arena.rs). Core state-machine invariants are guarded by debug assertions, unit/integration suites, and 8/8 TLA+ models with mutation checks. - Wire, startup, and public crate compatibility: Adds rank-relay wire event
Kind::StoreInvalidated = 4(selene/src/shard.rs:470, 484), fails startup cleanly on sub-page memory-only budgets (selene/src/offload.rs:706-712), splits committed vs reserved disk inventory gauges (docs/api.md:390-394), and updates publicflare-seleneAPIs (selene/src/store.rs:248-256, 377, 401-404, 433-440, 451,selene/src/levels.rs:109-114) in lockstep with workspace callers; all are now explicitly disclosed in the PR description. - Concurrent PR overlap: Open PRs
#655(helios/src/scheduler/checkpoints.rs),#665(helios/src/cache.rs,docs/prefix-cache-offload.md(not opened)), and#659(helios/src/runtime_core/cache_memory.rs) modify overlapping regions and will need coordinated merge sequencing.
Walkthrough
- Resident-aware lookup, diskless intake sizing & telemetry (
helios/src/server/runtime.rs:1635-1650, 3271-3367,helios/src/server/metrics.rs:1409-1428,selene/src/offload.rs:676-712,selene/src/levels.rs:109-132,selene/src/store.rs:244-256, 377, 451-479): Passes GPU-resident token offsets on pool lookups, allocates zero local intake slots when local disk is disabled (failing cleanly on sub-page memory-only budgets), separates ready disk inventory from uncommitted reservations, shareslevels::POOL_LEVELSbetweenRanking::rates()and Prometheus labels, exportsflare_selene::worth_restore, and groups admission probe parameters intoHostAdmissionProbe. - L1 DRAM clean retention & non-blocking shutdown drain (
selene/src/memory.rs:923-1085,selene/src/pool/store.rs:307-357,selene/src/store.rs:401-404, 433-440): Retains cleanpersisted_in_poolrecords in L1 DRAM with invariant-checkedclean_slotsand handover revalidation (handover_valid,refresh_ancestors,refresh_same_page_descendants,promote_role), and narrows shutdown drain topending_pool_drain(). - GPU snapshot-alias packing, pressure eviction & restore pricing (
helios/src/runtime_core/cache_memory.rs:655-770,helios/src/scheduler/cache_memory.rs:593-649,helios/src/cache.rs:628-707,helios/src/scheduler/checkpoints.rs:445-494,helios/src/server/runtime.rs:250-333,verification/helios-lifecycle/check.py:515-528): Packs shared GPU snapshot aliases with symmetric exponential+binary handle budgeting, addsevict_for_pressurewith matching mutation guard, prices restores via read-onlyestimate_prefill_delta_nspaired withRowRestoreLatency(preserving aged decay clocks on failed fetches, covered athelios/src/server/runtime/phase_tests.rs:8829-8851). - Direct compressed I/O, event-driven waiters, clean arena retention & offer coalescing (
selene/src/disk.rs:848-875, 1271-1447, 1774-1786,selene/src/shard.rs:465-500,selene-manager/src/arena.rs:163-200,selene-manager/src/store.rs:1443-1666, 2237-2272, 5309-5365): Uses aligned whole-recordO_DIRECTwrites with exactset_lentruncation and portableis_direct_unsupportedfallback, propagatesKind::StoreInvalidated = 4across sharded ranks, replaces tick-polled put waits with losslessWindowReleaseSignal+WindowHolddrop-ordered wakeups and epoch-tracked rotating scans, retains clean manager RAM viaArena::coalescing_block, and coalesces covered waiting offers directly toPresent.
Pre-merge Checks
- [PASS] Security / malicious screen: No credential handling, external exfiltration, or prompt-injection vectors found;
unsafeslice construction inselene/src/disk.rs:1277, 1321, 1404is bounded by caller-pinned buffer/slab lifetimes. - [PASS] Charter & value fit: Directly advances the prefix-caching charter goal, stays model-agnostic, fixes open issue
#451, and follows the four-part PR description with explicit disclosures (note: SM120 A/B tables remain measured on pre-refactor7d7dcdcbvs5d53040eand transparently noted as such). - [WARN] Related / duplicate / conflict check: Directly addresses
#451(issue still open and un-updated with the midpoint half-width conclusion); overlaps open PRs#655,#665, and#659with merge order to be coordinated. - [PASS] Tests & verification evidence: Author reports clean
-D warningscheck across all 4 crates and passing Linux suites on0ebee3d4(selene585,selene-manager205 lib + 128 integration,helios1,817 release lib,flare254 release, andverification/helios-lifecycle/check.py --mutations8/8 TLA+ models + Rust mutations), including the newRowRestoreLatencyaged-decay regression test (phase_tests.rs:8829-8851); confirm green GitHub CI checks on0ebee3d4before merging.
Blockers
None.
Should Fix
None.
Subtract / Simplify
- Share greedy conditioned-window partitioning between
conditioned_window_endsandset_conditioned_inputs(helios/src/scheduler.rs:2094-2123,:2162-2183): Both loops implement the samefeatures + input.feature_range.len() > capacityboundary split (withconditioned_window_endsadditionally filteringtoken_span.end > consumed). Extracting a small shared window-boundary helper keeps both paths aligned if conditioned-input windowing changes later.
Nits
- Post wrap-up on
#451: Add a brief comment on open issue#451recording the midpoint half-width conflict-span resolution implemented here. - Coordinate merge order: Sequence with open PRs
#655(helios/src/scheduler/checkpoints.rs),#665(helios/src/cache.rs,docs/prefix-cache-offload.md(not opened)), and#659(helios/src/runtime_core/cache_memory.rs). - PR-body wording & optional follow-up: In
What §3, refer toflare_host_cache_pool_inbound_bytes_per_second{level}as "pool restore rate estimates" (matchinghelios/src/server/metrics.rs:1412anddocs/api.md:394-398, which already document it accurately). Optionally, if separating pooledHostNvmevsRemoteNvme(orNeighbourGpuvsHostDram) row-restore latencies becomes useful later,RowRestoreSource(helios/src/server/runtime.rs:250-260) can key onLevel.
Dropped on verification
- Upstream claims that
0ebee3d4and all Round-2 fixes were absent (RowRestoreLatency::start,worth_restore,HostAdmissionProbe,POOL_LEVELS, Windowsis_direct_unsupported, PR body disclosures) — Stale snapshot: Upstream flash lenses inspected the stale default ref (19ce4a7b) instead ofpr/674(0ebee3d4), where every one of those fixes is verified landed (helios/src/server/runtime.rs:284-293, 3271-3362,helios/src/server/runtime/phase_tests.rs:8829-8851,selene/src/store.rs:451-479, 516-519,selene/src/lib.rs:53,selene/src/disk.rs:1779-1785,selene/src/levels.rs:109-132,helios/src/server/metrics.rs:1418-1427). - Correctness F1b (
RowRestoreLatency::in_flighthas no reaper) — Duplicate / already dropped in Round 1:row_restore_latency.start/finish(helios/src/server/runtime.rs:2814, 3410-3415) is 1:1 paired withscheduler.finish_inbound(:2815, 3418), so a droppedStoreEvent::Fetchedalready leaks the scheduler'sInboundTicketand GPU pages. - Correctness F2 (
observe_prefill_raterequiringstep.lanes.len() == 1pins multi-lane servers atINITIAL_PREFILL_RATEforever) — False:ActionCosts::observe(helios/src/scheduler/cost.rs:830-864) updatesPrefillPredictoron every GPU-timed prefill step regardless of lane count, soestimate_prefill_delta_ns(helios/src/scheduler/checkpoints.rs:445-494, called athelios/src/server/runtime.rs:3257-3266) prices warm restores without consultingfallback_prefill_rate. - Correctness F4 (
Rate::get()permanently clamps faster-than-seed rates atself.seed) — False: Verified atselene/src/levels.rs:69-75and test:169-172that.min(self.seed)applies only in theSome(last) if self.median < self.seedrecovery arm; measured rates>= seedreturn uncapped via_ => self.median, andmetrics.rs:1412/selene/src/store.rs:254-256/docs/api.md:394-398accurately document the gauge as source-ranking rate estimates. - Simplicity F1 (delete
RowRestoreLatencyand reuseselene::levels::Rate) — Already dropped in Round 2:Rateispub(crate)inflare-selene, models upward-recovering throughput with a finiteseed, and lacks per-keyin_flightduration tracking; removing the 3-line timestamp overwrite instart()is strictly simpler. - Simplicity F5 (replace aligned-prefix branch in
write_record_directatselene/src/disk.rs:1278-1305withwrite_direct_slices) — Misguided / throughput regression:write_record_directwrites the multi-hundred-MiB aligned prefix zero-copy fromspan.addressand copies only the< 4 KiBtail intoself.scratchin a singlering.transfer, whereaswrite_direct_slices(:1331-1376) copies the entire record through the small scratch buffer in sequential transfers.