#2 [high] Research summary
Reviewed the four threads against the diff and their callers (selene/src/{offload,memory,pool/store,shard}.rs, helios/src/{runtime_core/cache_memory,server/runtime,server/metrics,scheduler,cache}.rs, selene-manager/src/store.rs). Mechanisms are generally well-guarded (20 debug/test sites assert the clean_slots invariant; estimate_prefill_delta_ns is genuinely read-only; stale pool tickets are covered by direct tests; the new pressure priority keeps retention_rank as tiebreak so recency/role ordering is not reversed). The problems are in what the PR measures and in two undisclosed behaviour/default changes.
Findings, with citations:
1. Major — the prefill-rate estimator was changed, not replaced, and its sample scope shrank. The body says restores are priced "instead of wall-clock prefill EMA"; the EMA survives as the cold fallback and its measurement changed (helios/src/server/runtime.rs, new lines ~2790-2805):
if step.kind.is_prefill() && step.lanes.len() == 1 && self.store.is_some() {
let tokens = step.lanes[0].tokens as u64;
let capacity = step.prefill_capacity() as u64;
if capacity > 0 && tokens.saturating_mul(2) >= capacity {
and the time span changed from end-to-end wall clock to GPU-only when queued (observe_prefill_rate, ~3093-3115):
let seconds = crate::scheduler::observed_duration_ns(timing)
.map(|ns| ns as f64 * 1e-9)
.unwrap_or_else(|| instant.elapsed().as_secs_f64());
Main sampled every prefill submission and summed all prefill lanes. Now only single-lane, ≥50%-full prefills train the fallback, so mixed-batch and short incremental turns — precisely the "short incremental turns" case in table D — never do, and INITIAL_PREFILL_RATE can persist indefinitely. Impact: estimated_prefill_saved_seconds cold-fallback pricing is trained from a non-representative subset and can misprice row restores in the opposite direction from the claimed fix. Fix: keep wall-clock sampling for the fallback (or store both), sample any prefill step as before, and disclose the change.
2. Major — new hard startup failure plus a dead operator warning when local disk is off. selene/src/offload.rs:681-685 sizes required_intake to 0 without a directory, headroom_inner:178 (} else if disk {) returns intake == 0 for memory-only stores so transfer_slots == 0, and then :711-717:
if bytes == 0 {
return Err(format!(
"prefix cache memory of {checkpoint_memory} bytes is smaller than one {}-byte page record",
A --prefix-cache-memory below one page record now refuses to start where main created a small/empty slab pool. Separately, Prepared::intake_warning (:413-428) compares pool.intake_slots() < required_intake, and required_intake == 0 without a disk means the "intake shrunk to fit the host budget" warning can never fire again. Fix: clamp/allow a zero-record pool instead of erroring, and keep the warning meaningful for the memory-only path.
3. Major — metric/rate span contraction: a latency median is published into a transfer histogram, and the prefill histogram is zeroed by construction (helios/src/server/runtime.rs, new ~3395-3412):
let effective_rate = if prefill_saved_seconds > 0.0 {
gained as f64 / prefill_saved_seconds
} else {
f64::INFINITY
};
let mut priced_hit = hit.clone();
priced_hit.estimated_seconds = transfer_seconds;
metrics.host_lookup_cost(&priced_hit, effective_rate);
metrics.host_lookup_cost (helios/src/server/metrics.rs:538-560) emits hit.estimated_seconds*1e9 as "transfer" and missing/rate*1e9 as "prefill". So for row-only restores flare_host_cache_transfer_ns becomes a per-source latency median (mixed units in one histogram), and when the delta estimator reports zero savings the prefill sum is recorded as 0 ns while missing_tokens still rises — dashboards computing prefill-per-missing-token read a fabricated zero. Fix: give row-restore latency its own metric (or leave estimated_seconds untouched for the metric call) and skip the prefill sample instead of storing 0.
4. Minor — RowRestoreLatency decay is suspended while any sample is in flight (helios/src/server/runtime.rs, new ~3330-3345): if bucket.in_flight > 0 { return median; }. in_flight is incremented in start() and only cleared in finish() (called from the StoreEvent::Fetched handler and the fetch error path). A fetch whose event never arrives therefore pins that source's estimate at its last median forever, permanently over-pricing row restores from that tier. Fix: age out stale in_flight entries or decay regardless of in-flight count.
5. Minor — undisclosed on-the-wire event breaks mixed-version rank processes (selene/src/shard.rs:465-485): StoreInvalidated, / 4 => Self::StoreInvalidated, / _ => return Err(invalid("unknown prefix record event kind")),. The body claims "No Protobuf schema changes and no model core re-export required", but a rank-1 peer on the previous build fails to decode kind 4 from a newer rank 0. Fix: state the wire addition and the resulting "same version on all ranks" requirement, or make the decoder tolerant.
6. Minor — the packing guarantee is test-only, and layout construction got more expensive. helios/src/runtime_core/cache_memory.rs: row_conflicts and verify_physical_invariants (:101-162) are #[cfg(test)], so "midpoint-ordered placement pairs it with the enclosing densest-plane band without widening any row's conflict span" (:75-85) is never checked at runtime, and codec_layout_tests.rs (not opened) is a CPU fixture-only proof. Also plan_mapping_handles now rebuilds layouts inside the search (:692-731: Layout::grouped(...) + pack_rows(...) per doubling/binary-search step per rank, memoised only against the immediately preceding rank), and Layout::grouped sorts every planned chunk (:287-295) where main iterated nested loops without a sort. Not a demonstrated regression — main's victim selection was O(N²) — but the search and the sort belong in the PR's cost story.
7. Minor — zero-progress eviction can spin admission. helios/src/scheduler/cache_memory.rs:648-662 returns EvictionReport::default() when no prioritized candidate exists; ensure_resources (helios/src/scheduler.rs:1258-1285) re-enters its loop on an empty report with no bound, so when every remaining checkpoint is pinned the admission loop spins instead of failing. The loop shape predates the PR, but the new silent early return makes zero-progress the outcome rather than an eviction attempt.
8. Claim accuracy. Beyond the EMA reversal in (1): every A/B table is against 5d53040e, six commits behind the base 1fbcc3c9, so charter requirement #210 ("an actual speedup over main on a served workload") is not met by the evidence given; the description omits the docs changes (docs/api.md (not opened), docs/prefix-cache-offload.md (not opened), docs/runtime-core-design.md (not opened), selene-manager/docs/operating.md (not opened)), the Kind::StoreInvalidated wire event, the new sub-page startup error, AdmissionPlan: Clone / refresh_admission_plan_in_place, and the backing_conflict term in ensure_resources (scheduler.rs:1258-1281). Issue #451, which the body cites as motivation, is left open and unanswered while this PR reverses the plane rule the author defended there.
#3 [high] 674 Correctness lens — findings F1-F8 with citations
LENS: Correctness, Contracts & System-Level Consequences, PR #674, head 7d7dcdc, base 1fbcc3c9.
F1 (Major) — prefill-rate estimator CHANGED, not replaced; sample scope shrank. helios/src/server/runtime.rs (new ~2790-2805), in submit path:
if step.kind.is_prefill() && step.lanes.len() == 1 && self.store.is_some() {
let tokens = step.lanes[0].tokens as u64;
let capacity = step.prefill_capacity() as u64;
if capacity > 0 && tokens.saturating_mul(2) >= capacity {
main sampled every prefill submission and summed all prefill lanes. observe_prefill_rate (~3093-3115) time span changed:
let seconds = crate::scheduler::observed_duration_ns(timing)
.map(|ns| ns as f64 * 1e-9)
.unwrap_or_else(|| instant.elapsed().as_secs_f64());
if tokens > 0 && seconds > 0.0 { self.prefill_rate = 0.8*self.prefill_rate + 0.2*(tokens as f64/seconds) }
observed_duration_ns (helios/src/scheduler/cost.rs:21-29) = max(gpu_ns) capped with wall_ns when not queued; GPU-only when queued. PR body claims restores are priced "instead of wall-clock prefill EMA" — EMA survives as cold fallback (estimated_prefill_saved_seconds, runtime.rs ~3295-3330: falls back to gained/fallback_prefill_rate.max(1.0)). Mixed-batch and <50%-full single-lane prefills never train it -> INITIAL_PREFILL_RATE can persist. Contradicts table D's "short incremental turns" claim. Fix: keep wall-clock sampling, sample all prefill steps, disclose change.
F2 (Major) — new hard startup failure + dead warning when local disk off.
selene/src/offload.rs:681-685 required_intake = 0 without directory; :178 } else if disk { (was memory != 0 || disk) so intake=0 -> transfer_slots=0 (:707-710); then :711-717:
if bytes == 0 {
return Err(format!(
"prefix cache memory of {checkpoint_memory} bytes is smaller than one {}-byte page record",
Memory budget < one page record now refuses startup. And Prepared::intake_warning :413-428 compares pool.intake_slots() < required_intake -> required_intake==0 means the host-budget shrink warning can never fire again. Fix: clamp to zero-record pool; keep warning meaningful.
F3 (Major) — metric span contraction: latency median published as transfer histogram; prefill histogram zeroed. helios/src/server/runtime.rs (~3395-3412):
let effective_rate = if prefill_saved_seconds > 0.0 { gained as f64 / prefill_saved_seconds } else { f64::INFINITY };
let mut priced_hit = hit.clone();
priced_hit.estimated_seconds = transfer_seconds;
metrics.host_lookup_cost(&priced_hit, effective_rate);
helios/src/server/metrics.rs:538-560 host_lookup_cost writes hit.estimated_seconds1e9 into host_transfer_ns and missing/rate1e9 into host_prefill_ns. Row-only restores: transfer_ns becomes per-source latency median (mixed units); when delta==0, prefill recorded as 0 ns while missing_tokens rises. Fix: separate row-restore latency metric; skip prefill sample instead of 0.
F4 (Minor) — RowRestoreLatency decay suspended while in_flight>0 (runtime.rs ~3330-3345 if bucket.in_flight > 0 { return median; }); in_flight only cleared in finish() from StoreEvent::Fetched and the fetch-error path. Lost event pins the estimate forever -> permanent over-pricing of that tier's row restores. Fix: age out stale in_flight or decay regardless.
F5 (Minor) — undisclosed on-the-wire event; mixed-version ranks cannot interoperate.
selene/src/shard.rs:465-485: StoreInvalidated, / 4 => Self::StoreInvalidated, / _ => return Err(invalid("unknown prefix record event kind")),
Body says "No Protobuf schema changes... required". Also Pending.invalidated :565-570 and into_events (:650-660, :726-731) route it through (Kind::Stored, id).
F6 (Minor) — packing guarantee test-only + heavier layout construction.
helios/src/runtime_core/cache_memory.rs: #[cfg(test)] on row_conflicts (:101) and verify_physical_invariants (:122); the "without widening any row's conflict span" claim lives only in a comment (:75-85). codec_layout_tests.rs is CPU-fixture only.
plan_mapping_handles (:692-731) rebuilds Layout::grouped + pack_rows per doubling and per binary-search step per rank (memoised only vs immediately preceding rank); Layout::grouped sorts all planned chunks (:287-295) where main used nested loops.
F7 (Minor) — zero-progress eviction can spin admission. helios/src/scheduler/cache_memory.rs:648-662 returns EvictionReport::default() when no prioritized candidate; ensure_resources (helios/src/scheduler.rs:1258-1285 loop) re-enters unbounded on empty report with all checkpoints pinned. Loop predates PR but new early return makes zero progress the outcome.
F8 (Claims) — all A/B tables against 5d53040e, six commits behind base 1fbcc3c9 -> charter #210 not met. Omitted from description: docs changes (docs/api.md, docs/prefix-cache-offload.md, docs/runtime-core-design.md, selene-manager/docs/operating.md), Kind::StoreInvalidated wire event, new sub-page startup error, AdmissionPlan:Clone / refresh_admission_plan_in_place (scheduler.rs:1562-1567), backing_conflict in ensure_resources (scheduler.rs:1258-1281). #451 left open although the PR reverses the plane rule defended there.
SOUND AREAS (state plainly): estimate_prefill_delta_ns is read-only (checkpoints.rs new fn, tests assert active_requests==0); stale-pool-ticket handling + plans-map invalidation covered by direct tests (pool/store/tests.rs new lookup_for_ignore_stale_ticket..., local_fallback_after_unfetched_pool_hit...); pressure-aware priority keeps retention_rank as tiebreak so recency/role ordering not reversed (cache.rs eviction_candidate_with_priority); clean_slots invariant asserted at 20 sites, including persistence points mark_durable (:1447), complete_record (:1304), promote_role (:1031); manager waiter epoch/cursor wraparound tests exist; window_released AtomicBool + wakeup OnceLock has no unwrap panic path.
#1 [medium] 674: intake sizing / offload.rs details
selene/src/offload.rs
required_intake = if directory.is_some() { target_intake_slots(..) } else { 0 }at :681-685.- New error when the memory pool would be zero bytes: :711-717 "prefix cache memory of N bytes is smaller than one M-byte page record". Previously
slab::SlabPool::sized(&layout, 0, intake)presumably succeeded (empty pool). intakefield of the slab pool now comes fromtransfer_slots(host - memory_bytes)/page_record_bytes at :707-710 for the non-capture case; with memory_bytes>0 and no disk,headroom_innernow returns intake=0 (theelse if diskbranch at :178 wasmemory != 0 || diskbefore) so transfer_slots=0.intake_warning():413-428 unchanged, butrequired_intake=0means the shrink warning can never fire when no disk; andcapture_headroom_slots:233-240 is the new bounded headroom used by memory.rs:2997.- selene/src/offload/tests.rs:1525-1532 asserts capture_headroom_slots(0)=0, (100)=10, (600)=48.