Final review report · NVIDIA/hyperflare-inference #674

Raw Markdown for agents: https://autobot.eidonix.com/p/b68290d7-be5c-423a-983b-7669c4224851.md

Recommendation: Changes Requested

The four prefix-cache subsystems in PR #674 are technically sound, well-tested (CI green on 7d7dcdc with 8/8 TLA+ models and mutation guards passing), and free of verified correctness or concurrency blockers; our deep-dive confirmed that several upstream candidate alarms (including an alleged eviction spin loop and metric unit mismatch) were false. However, a small decay-clock reset bug in RowRestoreLatency::start on failed fetches, missing PR-description disclosures for real behavior/wire changes, and A/B benchmarks measured against 5d53040e (four commits behind base 1fbcc3c9, before #663 and #667) should be addressed before merging this +11.2k-line cache-core change.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. Re-baseline headline A/B evidence against 1fbcc3c9 and disclose omitted behavior changes in the PR description (docs/design-review.md Principles 12 & 16; charter #210):
    • A/B tables A–C compare against 5d53040e, which is 4 commits behind the PR base 1fbcc3c9 (#657, #666, #663, #667, with #663 touching scheduler waiting-age pricing and #667 touching Orbit/GB10/multi-host peer exports; Table F was run on 7d7dcdcb). Re-verify the headline A/B against 1fbcc3c9 (or confirm #663/#667 caused no baseline shift) and update #451 with the midpoint half-width conflict-span conclusion.
    • Add explicit disclosure to the PR body for: (a) sub-page warm memory budgets without local disk now failing startup (selene/src/offload.rs:711-717), (b) the new rank-relay wire event Kind::StoreInvalidated = 4 (selene/src/shard.rs:470,484) requiring matching rank builds in multi-host TP deployments, (c) retention and narrowed sampling of the fallback prefill_rate EMA (helios/src/server/runtime.rs:2793-2803, 3110-3115, 3334-3335) rather than complete removal, (d) once-per-episode stale pool-lookup ticket refresh (helios/src/server/runtime.rs:3227-3243), and (e) the documentation updates in docs/ and selene-manager/docs/operating.md.
  2. Prevent RowRestoreLatency::start from resurrecting a decayed latency median on failed fetches (helios/src/server/runtime.rs:302-304):
    • start() unconditionally overwrites bucket.last = Some(now) whenever bucket.median_seconds.is_some(). If a tier experienced a slow spike long ago (so its estimate has decayed toward zero via the 10 s half-life) and a new row-only restore fails synchronously (store.fetch(...) returns Err) or asynchronously (finish(&key, false) does not call observe()), bucket.in_flight returns to 0 while bucket.last stays reset to now—jumping estimate_seconds() back to 100% of the stale median for another recovery window.
    • Fix: Do not overwrite bucket.last in start() (estimate_seconds() already returns the undecayed median while bucket.in_flight > 0 at :341); only refresh bucket.last inside observe() (or upon successful completion).

Subtract / Simplify

  1. Collapse TierStore::retired and TierStore::retired_offered into one method (selene/src/store.rs:433-444, selene/src/memory.rs:1185-1189, 3612-3626, selene/src/pool/local.rs:120-137, selene/src/pool/cascade.rs:415):
    • The trait default forwards retired_offered -> retired, while every real implementor overrides both and forwards retired -> retired_offered(&[]). Replace both with a single fn retired(&mut self, _key: PrefixKey, _tier: PoolTier, _how: Retirement, _offered: &[Retiring]) {} and pass &[] at non-cascade call sites.
  2. Deduplicate writeback_wake_cursor / writeback_wake_remaining bookkeeping in selene-manager/src/store.rs (:1586-1594, :1743-1768, :1850-1858, :4161-4168, :4236-4243):
    • The modulo/clamp cursor fixup is duplicated across six sites, and close_operations (:4237-4243) omits the removed_before_cursor adjustment that resolve_published_waiters (:1571-1591) and expire_waiters (:1826-1855) perform. Extract remove_writeback_waiter(index) and retain_writeback_waiters(predicate) helpers to own the invariant in one place.
  3. Pass transfer and prefill seconds directly to Metrics::host_lookup_cost (helios/src/server/runtime.rs:3408-3415, helios/src/server/metrics.rs:538-560):
    • Currently admit_with_host_store computes effective_rate = gained as f64 / prefill_saved_seconds (with f64::INFINITY for 0.0) and clones HostHit just to satisfy host_lookup_cost(&priced_hit, effective_rate), which divides missing / rate.max(1.0) right back into seconds (and clamps if 0 < effective_rate < 1.0). Accepting (missing_tokens, transfer_seconds, prefill_saved_seconds) directly deletes the HostHit::clone(), the f64::INFINITY trick, and the round-trip distortion.
  4. Extract Incoming::clear_pool_lookup(&mut self) in helios/src/server/runtime.rs (:1800-1803, :2614-2617, :3030-3033, :3044-3047, :3076-3079):
    • Five sites repeat the same four-field reset (pool_lookup, pool_lookup_started, pool_lookup_reissued, pool_plan). One helper eliminates the duplication and prevents leaving pool_lookup_reissued stale on future edits.
  5. Narrow is_role_preserving_compaction visibility and simplify the redundant branch in helios/src/cache.rs (:646-654, :688-695):
    • is_role_preserving_compaction is marked pub(crate) but only called at helios/src/cache.rs:637; make it private. The three-arm let tokens = ... ladder at :688-695 can collapse to if role_preserving { 0 } else { self.protected_eviction_tokens(node, rank) }, provided the literal mutation match in verification/helios-lifecycle/check.py:517 ("let tokens = self.protected_eviction_tokens(node, rank);") is updated in the same commit (and coordinated with #665).

Nits

Dropped on verification