PR #665: helios: add scan-resistant dual-turnover prefix cache eviction

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/db99fc12-8430-43cb-b71b-42cf3ed2f6f2

Opened by a workflow run, Dec 1, 2026 3:15 PM EST.

Classify draft

Selected: performance, area:caching

Threshold: 65%

Priority

Type

Area

Model

explore

Author: FujitsuPolycom (CONTRIBUTOR; Discord "Dooner") Motivation: GPU prefix-cache eviction ranks victims purely by recency, and because completions refresh recency, dead one-shot prefills outrank idle multi-turn sessions and get kept while reused sessions are dropped. This adds a one-bit "reused" protection flag, with turnover-based aging so protection expires on workload shifts. Scale: +271 / −6 in 4 files (cache.rs +64/−4, cache/tests.rs +192, lifecycle_tests.rs +6/−1, scheduler.rs +9/−1) Proposal:

Full report · Notes

Value Proposition

Value Proposition — PR #665, helios: scan-resistant dual-turnover prefix cache eviction

Charter alignment. The change sits in the right layer: victim selection in helios/src/cache.rs is runtime cache/scheduling policy, not recipe or model computation, and it adds no CLI flags, no floats, no unsafe, no per-model branches, and no core/wire-format change (~68 net production LOC of +271/−6 across 4 files under helios/src). That satisfies "keep the runtime small and model-agnostic." The description follows the mandated four-part shape (why/what/result/evidence) and reports A/B numbers against a named main commit (5d53040e) on a served workload — the form that "bring real evidence (#210)" asks for.

It nonetheless departs from the project's own written record three ways: it replaces the "strictly (node.retention_rank(), node.id)" victim-order invariant that #568 (merged 2026-11-28, lukealonso) was explicitly built around, without citing #568; it routes #298/#416's completion touch through plain touch, so completion no longer confers protection, without citing those PRs; and it updates no docs, though docs/core-design.md:1538-1583 still tells operators victims are reclaimed "strictly by demand-recency order." Every comparable merged PR (#298, #416, #567, #568, #582, #655) edited docs/*.

Novelty & status. Genuinely additive. No merged commit fixes this, and #568 is the predecessor being revised, not a fix — so not obsolete. Not superseded either: open #549 (WynnD, "Report KV pages held by active requests") conflicts only textually (same Checkpoint literal in Fixture::fork, same key() sort in lifecycle_tests.rs) with no semantic overlap — pins vs. victim order.

Value vs. cost. Real but thin evidence: n=2 cold-salted trials per arm, single boot, no variance reported, one configuration (SM120 TP4, DeepSeek-V4.1-Flash, --prefix-cache-memory 0, 128-token pages). The headline Long-MT p50 TTFT improvement (−86.3%) is far larger than the 1.74x hit-rate gain explains, and the scan-thrash eviction count barely moved (168/215 → 132/217). The one path the description admits is unmeasured — host-restore touch_hit (scheduler.rs:1886) — is also its weakest claim: the host tier was off in both arms and the four added tests are cache-level. There is no linked issue or user report; motivation rests entirely on the author's own benchmark, in an area with five eviction-policy PRs in three weeks (#298, #416, #460, #568, #567 closed). Currently zero CI, reviews, or comments.

Changes to require: cite and reconcile #568/#298/#416; update docs/core-design.md; run check.py --mutations (required by docs/design-review.md:226-251 for a changed safety guard); add a test driving finish_inbound's touch_hit plus live host-tier evidence; report variance and explain the Long-MT TTFT delta; single out #568's policy_tests.rs results; coordinate the #549 rebase.

Verdict: Worth it with changes.

Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Classify intake

Selected: triage:review, performance, area:caching

Threshold: 65%

Triage

Priority

Type

Area

Model

Apply Labels (Intake)

Applied: +triage:review

Subtraction and simplicity

Subtraction/simplicity review of PR #665: the production diff is genuinely lean (~68 lines, no flags, knobs, env vars, floats, unsafe, model branches, or unread fields/counters), so there are only two real cuts and one convention item.

  1. Dead duplicate write — helios/src/cache.rs:466-471. The diff swapped touch for touch_hit, but left existing.accessed = existing.accessed.max(use_epoch); in place; touch_hit → touch (cache.rs:376-389) performs exactly that assignment, so line 468 is a no-op second writer of the same field. Delete that one line.
  2. Inert 33-line test — helios/src/cache/tests.rs:1472-1504 (reclaimable_if_pinned_matches_evict_with_mixed_protected_and_probationary_nodes). Cannot fail from this diff: evicted_after_pin (tests.rs:1026-1038) evicts with usize::MAX so victim order is irrelevant, and reclaimable (cache.rs:785-843) reads none of reused/is_protected/evicted_* state. Also the third copy of the parity property, already covered by tests.rs:1040-1080 and cache/lifecycle_tests.rs:640-703. Delete it.
  3. Convention — docs/core-design.md:1536-1542 and :1565 still specify victim order as strictly (epoch, role, tokens, id) / "strictly by demand-recency order", while cache.rs:363-365 sorts is_protected first. AGENTS.md:52-60 requires design docs to specify implemented behaviour, so the file must be edited, not left stale.

Rejected false positives: the fresh_admission if/else at scheduler.rs:1734-1739 cannot collapse to plain touch_hit (preemption re-admissions must not promote; host restores take the early return at :1876-1883); and advance_completed(Fence(0)) at tests.rs:1434/1451 is load-bearing for page/snapshot ownership (cache.rs:865-876, :449-465).

Open: whether #568's scheduler policy tests still assume strict rank ordering; whether finish_inbound's touch_hit (scheduler.rs:1886) has any direct test (host tier runs --prefix-cache-memory 0 in both A/B arms); other docs not checked for the same stale statement.

Full report · Notes

Correctness and contracts

PR #665 adds a one-bit reuse flag plus dual-turnover aging to Helios prefix-cache eviction. It meets the repo's shape requirements (no flags, no model branches, integer-only, A/B evidence for a served workload), but four of its new code paths do not implement the behaviour the description claims, and it reverses a documented invariant without the sign-off the repo requires.

Findings that matter most:

  1. Aging is not monotonic (Major). is_protected compares a monotone turnover numerator against current global counts (helios/src/cache.rs:346-361, denominators mutated at :256-274), so a demoted checkpoint is re-protected as the cache refills — during exactly the scan burst the PR targets.
  2. Compaction never ages protection (Major). compact_ancestor (helios/src/cache.rs:626-630) does not touch the turnover counters that retire_leaf increments (:604-609), so single-child chains — the PR's own 4x127K shape — can evict unboundedly while protection persists forever, the livelock the description claims to avoid.
  3. Host restore of a new prefix is treated as a reuse hit (Major). finish_inbound calls touch_hit on PublishResult::Created (helios/src/scheduler.rs:1884-1887), so cold host-tier scans are born protected — the one path both A/B arms run with --prefix-cache-memory 0, and contrary to the PR's own test comment (helios/src/cache/tests.rs:1337-1338).
  4. Same-request republishing self-promotes (Major). The Existing branch calls touch_hit unconditionally (helios/src/cache.rs:466-477) and is reached by retire/publish_boundary (helios/src/scheduler.rs:3101, :2948) for the publishing request's own endpoint.
  5. Documented contract reversed without sign-off (Major). is_protected is now the first sort key (helios/src/cache.rs:363-365), while docs/core-design.md:1564-1566 and docs/scheduling-runtime-design.md:644-645 still promise strict demand-recency order; AGENTS.md:204-206 requires an explicit maintainer decision. No docs are touched.
  6. Conformance key is unsound (Major). key() sorts by eviction_key (helios/src/cache/lifecycle_tests.rs:498-505) but projection() omits reused/turnover, so the BFS can prune live states; the reported TLA+ pass does not evidence the new ordering.
  7. Missing blocking mutation run and a false evidence claim (Major). docs/design-review.md:226-251 requires --mutations for a new guard; the description's "verified by unit tests" for the host-restore path has no test behind it.

Sound: no added contention/allocation, saturating arithmetic, Clone parity preserving quote determinism, non-emptiable mandatory eviction, correct fresh_admission discriminator, no wire-format change.

Open: whether #568's end-to-end policy tests still hold; whether the "TLA+ verified" and A/B claims (n=2, one boot) reproduce; whether an off-GitHub (Discord) decision covers the invariant reversal.

Full report · Notes

Final review

Recommendation: Changes Requested

PR #665 proposes a clean, zero-knob, model-agnostic scan-resistant eviction policy (~68 net production LOC, no flags, floats, unsafe, or wire/core-format changes) in the right Helios cache/scheduler layer. However, two blocking issues prevent merge on head a7568c2: is_protected compares monotonic turnover against live growing cache counts so already-demoted checkpoints silently regain protection when new entries publish, and the PR omits the mandatory check.py --mutations verification gate while inaccurately claiming unit tests and TLA+ verify host-restore touch_hit. Several concrete should-fix items (snapshot-compaction turnover omission, preemption asymmetry in finish_inbound, stale design docs, and a BFS key() collision in lifecycle_tests.rs) and two clean subtractions also need resolution before merge.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

  1. Non-monotonic is_protected aging re-protects stale demoted checkpoints without a new hit (helios/src/cache.rs:346-361, :257-274, :604-609).
    • is_protected checks !(page_turnover >= self.tail_pages.max(1) as u64 && node_turnover >= self.ready_checkpoints.max(1) as u64) against live self.tail_pages and self.ready_checkpoints, both of which grow on every publication (count() at :257-264). Once a stale checkpoint demotes (is_protected == false), any subsequent publication that raises tail_pages or ready_checkpoints above the node's turnover flips is_protected back to true without a second reuse hit.
    • Concrete proof in the PR's own test geometry (helios/src/cache/tests.rs:1447-1467): after the 3rd leaf eviction (evicted_pages = 6, evicted_checkpoints = 3, tail_pages = 2, ready_checkpoints = 2), stale is demoted. If two fresh 1-page checkpoints publish before the next eviction instead of one (tail_pages = 4, ready_checkpoints = 4), node_turnover = 3 < 4 silently re-promotes stale to protected so evict drops fresh work instead. The same dynamic inflates the aging horizon during a workload shift from a few large sessions to many small checkpoints. (Secondary asymmetry: self.tail_pages counts both ready and unready checkpoints at :263, whereas evicted_pages counts only node.ready leaves at :604-609.)
    • Fix: Make demotion sticky once reached — e.g., clear node.reused = false on any expired nodes when turnover advances in retire_leaf (or evaluate against a monotonic bound that cannot re-enable already-demoted nodes, taking care not to freeze a near-empty warmup count at mark_reused time). Add a regression test in helios/src/cache/tests.rs that publishes multiple fresh checkpoints after demotion and asserts the demoted entry stays probationary.
  2. Missing blocking check.py --mutations run and inaccurate verification claim for host restore (docs/design-review.md:226-228, 247-251, helios/src/scheduler.rs:1884-1887, verification/helios-lifecycle/check.py:515-520).
    • docs/design-review.md:226-228 and :247-251 require running python3 verification/helios-lifecycle/check.py --mutations (or cargo-mutants) whenever adding or changing safety/eviction guards, and explicitly state that leaving an applicable CPU check unrun blocks PR acceptance. check.py:515-520 directly guards eviction_candidate_within_budget, whose victim ordering this PR modifies, yet only check.py --jobs 4 is reported.
    • Additionally, the PR description claims "Selene restore touch_hit is verified by unit tests and TLA+, not live offload", which is unsupported: none of the four added tests (helios/src/cache/tests.rs:1315-1504) invokes finish_inbound, none of the existing finish_inbound tests (helios/src/scheduler/tests.rs:2914-3208) asserts reuse protection or eviction ordering after restore, and CacheOwnership.tla (verification/helios-lifecycle/README.md:240-241) models neither host restore nor retention/eviction ranking.
    • Fix: Run python3 verification/helios-lifecycle/check.py --mutations and report its result; add a unit test in helios/src/scheduler/tests.rs exercising finish_inbound and asserting protection/eviction order against an un-reused scan; and update the PR description so its evidence claims accurately reflect what was tested.

Should Fix

  1. compact_ancestor never advances turnover counters, preventing aging under snapshot-only compaction pressure (helios/src/cache.rs:626-657 vs :601-609, :749-753).
    • Under snapshot-row pressure (when KV pages are not exhausted), evict_checkpoint retires single-child interior ancestors via compact_ancestor (freeing 1 snapshot and 0 pages) without incrementing either evicted_checkpoints or evicted_pages. Stale protected entries therefore never age out when eviction pressure is absorbed by ancestor compaction, and even alongside leaf evictions compacted checkpoints never advance node_turnover.
    • Fix: Count compacted ready snapshots in turnover (and ensure snapshot-pressure turnover can age out stale protected entries rather than stalling indefinitely on page_turnover == 0), and add a compaction-aging test in helios/src/cache/tests.rs (plus a regime-shift check with reused Phase-1 documents in helios/src/scheduler/policy_tests.rs).
  2. Preemption and cancelled-waiter asymmetry on host restore (helios/src/scheduler.rs:1884-1887 vs :1727-1739).
    • For GPU hits, admit_planned_with_checkpoint_accounting gates touch_hit on fresh_admission = accounting.is_none() (scheduler.rs:1727, 1735) so preempted re-admissions refresh recency only. In finish_inbound (scheduler.rs:1884-1887), PublishResult::Created unconditionally calls self.cache.touch_hit(id, ticket.demand_epoch)? even when the ticket's only waiter was a preempted re-admission (helios/src/server/runtime.rs:3158 passes accounting.clone()) or all waiters were cancelled before transfer completion (ticket.waiters.is_empty(), as in scheduler/tests.rs:2976, 3152).
    • Fix: Record fresh_admission: bool on Ticket (set/ORed at scheduler.rs:1686-1709) and call touch_hit in finish_inbound only when ticket.fresh_admission && !ticket.waiters.is_empty() (otherwise plain touch), covered by a test in helios/src/scheduler/tests.rs.
  3. Design documents contradict the new victim ordering (docs/core-design.md:1536-1567, docs/scheduling-runtime-design.md:643-645, docs/prefix-cache-offload.md:298, AGENTS.md:52-60).
    • helios/src/cache.rs:363-365, :732 places is_protected ahead of RetentionRank, displacing #568's documented invariant ("Optional Anchor and Message captures reclaim lower-rank victims strictly by demand-recency order", docs/core-design.md:1565-1566) and changing #298/#416's completion refresh (scheduler.rs:3107-3118) so it refreshes recency only within the unprotected tier. All three design docs still state strict demand-recency/role ordering, violating AGENTS.md:52-60.
    • Fix: Update docs/core-design.md:1536-1567, docs/scheduling-runtime-design.md:643-645, and docs/prefix-cache-offload.md:298 to specify the two-tier protection ordering, inheritance rule, and dual-turnover aging, and cite #568 and #298/#416 in the PR description.
  4. BFS deduplication key in helios/src/cache/lifecycle_tests.rs:498-505 collides distinct reused states.
    • Fixture::key() appends the eviction_key-sorted semantic node IDs to self.projection(), which intentionally omits reused and turnover counters so it stays aligned with CacheOwnership.tla's 29-integer state tuple (verification/helios-lifecycle/README.md:230-234). Because Action 8 (duplicate publication, lifecycle_tests.rs:293-296) now mutates node.reused = true via touch_hit, two states with identical projection() — e.g., reused = [false, false, false] vs reused = [false, false, true] — both sort to [1, 2, 3] and produce identical key() values, causing visited.insert(next.key()) (:617) to prune downstream branches where subsequent duplicate publications yield distinct eviction orders.
    • Fix: Append each live node's protection/reuse state (and relevant turnover state) to Fixture::key() — leaving Fixture::projection() unchanged so CacheOwnership.tla stays valid — and re-run check.py.

Subtract / Simplify

  1. Delete dead duplicate write of existing.accessed (helios/src/cache.rs:468).
    • In publish_with_retention's Existing branch (cache.rs:466-471), line 468 writes existing.accessed = existing.accessed.max(use_epoch);, and line 471 immediately calls self.touch_hit(id, use_epoch)?, whose self.touch(id, use_epoch)? (:377-382) performs the exact same assignment. Delete line 468 (−1 LOC, eliminates duplicate field writer).
  2. Delete inert 33-line duplicate test (helios/src/cache/tests.rs:1472-1504).
    • reclaimable_if_pinned_matches_evict_with_mixed_protected_and_probationary_nodes calls evicted_after_pin (tests.rs:1026-1038), which evicts with pages: usize::MAX, snapshots: usize::MAX and compares sorted(...) sets; victim order cannot alter the drained fixpoint, and reclaimable() (cache.rs:785-843) reads none of the new fields. The same parity invariant is already tested on strictly richer topologies by projection_matches_eviction_for_chains_branches_and_compaction (tests.rs:1041-1080) and reclaimable_projection_matches_eviction_with_pins (lifecycle_tests.rs:641-703). Delete :1472-1504 (−33 LOC).

Nits

Dropped on verification

Full report

Classify triage

Selected: triage:review

Threshold: 65%

Triage

Apply labels

No label changes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with. decide malicious: all_clear (100%): No malicious content found

explore

Author: FujitsuPolycom (CONTRIBUTOR; Discord "Dooner") Motivation: GPU prefix-cache eviction ranks victims by recency plus role, and completions refresh recency, so a one-off scan of large prompts pushes long-lived multi-turn sessions out first. The PR adds a per-checkpoint "reused" bit plus a turnover-based aging rule and sorts victims so un-reused (probationary) entries go before reuse-protected ones. Scale: +698 / −47 lines in 9 files (head c9197427, squashed; supersedes the earlier 4-file/+271/−6 figure) Proposal:

Full report · Notes

Classify intake

Selected: triage:review, performance, area:caching

Threshold: 65%

Triage

Priority

Type

Area

Model

Apply Labels (Intake)

No label changes

Subtraction and simplicity

Verdict: the production diff is already lean — no flags, env knobs, config switches, fallback branches, floats, unsafe, speculative traits, or dead code left behind (the old existing.accessed write was correctly deleted now that touch_hit refreshes accessed). AGENTS.md:450-460 is respected. What follows is five concrete simplifications, not a rework request.

  1. retire_leaf (cache.rs:615-626) and compact_ancestor (cache.rs:643-645, :672-675) repeat the horizon capture + evicted_pages/evicted_checkpoints bump + demote_expired_reused verbatim, differing only in the page count. One note_ready_retirement(&node, pages) helper (~14 lines gone) preserves the subtle "horizons before uncount" ordering in one place.
  2. is_protected (cache.rs:351-355) is a one-line wrapper over node.reused that forces &self through eviction_key (:378-380); fold to an associated fn eviction_key(node) and drop the over-wide pub(crate) (test modules are children).
  3. mark_reused (cache.rs:382-389) has exactly one caller, touch_hit (:399-404), and re-probes nodes for the node touch just fetched — merge, saving a hash probe per hit. Also unify reused_at_evicted_nodes with the evicted_checkpoints counter it compares to (:369).
  4. Two new tests are near-copies of their predecessors: policy_regime_shift_ages_out_reused_old_large_documents_… (policy_tests.rs:6429-6480) = :6379-6427 plus two lines; sticky_demotion_does_not_reprotect_after_fresh_publications (cache/tests.rs:1471-1567) repeats :1395-1469 for 56 lines. ~90 duplicated lines; parameterize or extract setup.
  5. Docs: prefix-cache-offload.md:374-376 still states the pre-PR flat eviction order, contradicting the tiered rule the PR added at :298-303; helios/README.md:713-715 still says "Leaf LRU eviction" although AGENTS.md:227 makes that file required reading for cache changes.

Cross-lens note (fix is a deletion, so reported here): the Existing path still promotes unconditionally at cache.rs:485 while Created gates on ticket.fresh_admission && !ticket.waiters.is_empty() (scheduler.rs:1886), making prefix-cache-offload.md:298-303's absolute claim false as written.

Open: whether that promotion is intended; which of the two doc passages was meant to survive; no build/test/mutation run was possible (source-level only); check.py (not opened) still has no mutation target for is_protected/demote_expired_reused, so docs/design-review.md:226-228 (not opened) remains unmet for this code.

Full report · Notes

Correctness and contracts

Reviewed PR #665 at head c9197427 (Correctness, Contracts & System-Level Consequences lens). Core policy is sound, but the new "reuse-protected" tier has a hole in every non-Created publication path, and two process gates the PR claims are unmet.

Findings:

  1. Major-high, F1 — publish_with_retention's Existing branch calls touch_hit unconditionally (helios/src/cache.rs:481-491, hit at :485) while finish_inbound gates only PublishResult::Created (helios/src/scheduler.rs:1884-1891). Waiterless restores and preempted re-admissions that hit an existing key still promote a probationary entry and reset its turnover stamps — falsifying the sentence this PR added at docs/prefix-cache-offload.md:300-303. The two new tests (scheduler/tests.rs:3233, :3258) exercise only the Created branch.
  2. Major, F2 — Same hole on completion: retire publishes at scheduler.rs:3101-3106 before consulting request.preempted at :3097, so a preempted request's duplicate terminal publication promotes even though the recency touch is correctly suppressed at :3111.
  3. Major, F6 — docs/prefix-cache-offload.md:374-377 still states the superseded flat demand-epoch/role order, contradicting the tiered rule the PR added at :298-303 and the rewritten docs/core-design.md:1536-1584.
  4. Major, F8 — verification/helios-lifecycle/check.py has no occurrence of is_protected, demote_expired_reused, eviction_key, touch_hit, ready_tail_pages or evicted_pages, no new test in aux_tests (:323-336), and only the two pre-existing cache.rs mutants (:511-520). "26/26 Rust KILLED" evidences old guards only, against docs/design-review.md:226-228/:247-251.
  5. Minor, F3 — demote_expired_reused ages unready nodes (cache.rs:360-376) while eviction candidates are ready-only (:699-705); I verified no production path creates an unready publication, so this is an unenforced invariant needing one if !node.ready { continue; } — it supersedes the dossier's unready-inheritance concern.
  6. Minor, F4 — new O(all-nodes) demotion walk per retirement on ensure_resources/refill_reservations, amplified inside simulate_snapshot_quote's repeated cache clones.
  7. Minor, F7 — A/B numbers were measured on a7568c2c, before all hardening; the new 2x demotion branch only removes protection, so the gains are an upper bound for the shipped code, with n=2, one boot, no live host-restore evidence.
  8. Cleared: counter bookkeeping + stats() full-scan assert, ordering cannot livelock or filter all victims, sticky demotion closes the old blocker, Fixture::key()/TLA+ tuple integrity, fresh_admission wiring, no lock/retention/failure-propagation or platform-parity regression, no metric-span change.

Open: whether Existing promotion is intended; which offload-doc ordering should survive; whether mutations will ever cover the new guards; how the hardened head scores; #549's textual overlap.

Full report · Notes

Re-review

Recommendation: Ready To Merge

Rebased onto main (1fbcc3c9) at head c5b39236, PR #665 resolves every blocker, should-fix, subtraction, and nit from the prior review and closes the residual Existing-restore and documentation issues found on intermediate head c919742. The policy remains lean, zero-knob, and model-agnostic (135 net production LOC across cache.rs and scheduler.rs; no flags, floats, unsafe, or core-format changes), with sticky dual-turnover + compaction aging, per-waiter host-restore freshness gating across both Created and Existing matches, synced design docs, and full check.py --mutations plus unit/policy coverage reported on the pushed tree.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

None.

Subtract / Simplify

  1. Factor duplicate retirement turnover accounting in helios/src/cache.rs:630-641, :658-690: retire_leaf and compact_ancestor repeat the same pre-uncount horizon capture (ready_tail_pages.max(1), ready_checkpoints.max(1)), if node.ready guard, counter updates, and demote_expired_reused call. Folding them into one note_ready_retirement(&mut self, node: &Checkpoint, pages: u64) helper called right after self.nodes.remove(&id) and before self.uncount(&node) (passing node.tail_pages.len() as u64 vs 0) removes ~14 lines and enforces the pre-uncount ordering in one place.
  2. Collapse one-line is_protected wrapper and narrow eviction_key visibility (helios/src/cache.rs:353-355, :378-380): is_protected(&self, node: &Checkpoint) reads only node.reused without touching self, and eviction_key is only called from cache.rs:777 and child test module cache::lifecycle_tests (lifecycle_tests.rs:504). Replacing both with a private associated function fn eviction_key(node: &Checkpoint) -> (bool, RetentionRank, CheckpointId) deletes 6 lines and removes the receiver indirection.
  3. Inline single-caller mark_reused and align field naming (helios/src/cache.rs:86, :382-404): mark_reused has only one caller (touch_hit at :402) and performs a second self.nodes.get_mut(&id) lookup right after self.touch already probed the map. Inlining the three field assignments into touch_hit avoids the duplicate hash lookup per hit; renaming reused_at_evicted_nodes (:86) to reused_at_evicted_checkpoints matches evicted_checkpoints (:224).
  4. Deduplicate shared setup in new cache and policy tests (helios/src/cache/tests.rs:1396-1567, helios/src/scheduler/policy_tests.rs:6380-6480): sticky_demotion_does_not_reprotect_after_fresh_publications repeats the first 56 lines of dual_turnover_aging_demotes_stale_reused_entry_after_page_and_node_turnover, and policy_regime_shift_ages_out_reused_old_large_documents_for_newer_chat_workload duplicates policy_regime_shift_ages_out_old_large_documents_for_newer_chat_workload except for the second turn in Phase 1. Extracting two small test helpers removes ~80 lines while keeping all test names unchanged.

Nits

Dropped on verification

Full report

Classify triage

Selected: triage:review

Threshold: 65%

Triage

Apply labels

No label changes Decision to Test: yes (65%): Testing will add considerable value with the code. It is ready to merge and the tests will validate and improve confidence on hardware we have available for testing.

Pre Test Report

Hardware test plan — PR #665 (scan-resistant dual-turnover prefix-cache eviction)

Bottom line

The change is ready to test, but the only thing worth measuring on your hardware is the GPU prefix-cache eviction effect, and the PR's own numbers cannot be reused as-is: they were taken on a7568c2c (pre-hardening), on DeepSeek‑V4.1‑Flash TP4, which is not present on cn5 or cn7, at n = 2 trials/arm on one boot with --prefix-cache-memory 0. Every functional claim except the GPU-tier eviction ordering is already covered by CPU tests, and the one path the PR admits is unmeasured (host-store restore promotion) is observable on cn5 with existing /metrics if you run the disk tier.

Test on cn5 only (4× RTX PRO 6000 Blackwell 96 GiB, amd64, 125 GiB RAM, 16 GiB scratch). Budget ≈ 3.5–4 h of 4-GPU time plus a one-time core acquisition. cn7 is not suitable for the performance question (see §7) — optionally use it for a 20-minute arm64/SM121 smoke test.

Replacement model: nvidia/GLM-5.3-Flash-NVFP4 at TP4 on cn5 GPUs 0–3 — the only 4-rank-capable checkpoint on that host, and GLM at TP4 is the recipe the repo declares end-to-end qualified (docs/model-preparation.md:171). Its page size is 128 tokens (docs/prefix-cache-offload.md:97 region, PR geometry), so the PR's eviction-pressure regime is reproducible. Deviating from DeepSeek is unavoidable; record it as a scope limit (§6).


1. What is being tested (verified against head c5b39236)

Mechanism Code Observable on hardware?
Two-tier victim order (is_protected, RetentionRank, id) after filters helios/src/cache.rs:378-380, applied :777 Yes — via which prefixes survive (usage.prompt_tokens_details.cached_tokens, flare_cache_reused_tokens_total)
Sticky demotion on dual turnover / 2x under compaction cache.rs:360-376, called from retire_leaf / compact_ancestor Only indirectly (survival after many retirements); directly proven by CPU tests
≥33 % inheritance (parent_len * 2 >= tail_tokens) cache.rs:492-495 (PR body) Indirectly via multi-turn hit rate
Fresh-admission gating (touch_hit only on fresh GPU hits) scheduler.rs:1739-1745 Yes — hit rate must not rise on a zero-reuse control workload
Host-restore promotion gated on a live fresh waiter scheduler.rs:1863-1903, cache.rs:423-506 Yes, but only with the disk tier enabled — host_hits vs cache_reused_tokens discriminate (§5)
Completion refresh stays plain touch scheduler.rs:3138-3155 Indirectly (multi-turn retention)

Citations: PR body/review for #665; /metrics names in docs/api.md:336-346; cached_tokens semantics docs/api.md:1006-1007.

Not hardware: check.py --mutations, TLA+ conformance, --jobs 4, unit/policy tests. These are CPU-only gates (docs/design-review.md:209-251) and must be run before any GPU allocation, not during it.


2. Phase 0 — CPU gate (no GPU; ~45 min wall, run on cn5 CPU or a login node)

Do not allocate GPUs until all of this is green.

# build both arms from the same tree, only the commit differing
git checkout 1fbcc3c9 && cargo build --release --manifest-path flare-cli/Cargo.toml (not opened)
cp flare-cli/target/release/flare /tmp/flare-main
git checkout c5b39236 && cargo build --release --manifest-path flare-cli/Cargo.toml (not opened)
cp flare-cli/target/release/flare /tmp/flare-665

# blocking CPU gates on the PR head
cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) --features runtime-core,server
python3 verification/helios-lifecycle/check.py --tlc-jar /path/tla2tools.jar --mutations --jobs 4

Pass: both binaries byte-identical to their commits; tests green; --mutations reports its KILLED totals. Also record sha256sum of both binaries and of the core you will serve — the A/B is a binary swap only (the change adds zero flags, so nothing else may differ).

Core acquisition. The listed models are checkpoints, not exported cores; flare run needs an SM120/gb202 TP4 core, and each TP size needs its own export (docs/model-preparation.md:168-171). Check first, and only export if absent — export is the single largest GPU-time risk in this plan:

flare models list --json          # look for a gb202-tp4 (or gb202-tp1) GLM-5.3-Flash NVFP4 entry
flare inspect <CORE> --plain      # must show the expected tensor_parallel and sm120/gb202 arch
# only if missing (one-time, hours; runtime flags never require a re-export — docs/cli-design.md:896-899):
.venv/bin/ignition export glm-5.3-flash-nvfp4 --gpus 0,1,2,3

If only a TP2 core exists, fall back to --gpus 0,1 for both arms and note that the KV pool (and therefore eviction pressure) is roughly halved — do not mix TP widths between arms.


3. Phase 1 — geometry and pressure pre-flight (cn5, 4 GPUs, ~20 min)

Start each arm once, identical flags, and prove the two arms are comparable and that the workload actually creates eviction pressure. If any of these differ between arms, stop: the comparison is invalid.

# arm ∈ {main, 665}; PORT=8000
/tmp/flare-$ARM run $CORE --gpus 0,1,2,3 --host 127.0.0.1 --port 8000 \
  --max-concurrency 32 --mtp-draft-tokens 7 --mtp-adaptive-verification \
  --mtp-max-verification-token-budget 128 --mtp-adaptive-verification-alpha 1.0 \
  --scheduler-policy balanced --embedding-table-storage disk \
  --embedding-table-cache-size 84GiB --embedding-table-workers 1 \
  --embedding-table-resident-scales --kv-cache-limit memory --memory-limit 83GiB \
  --prefix-cache-memory 0 --prefix-cache-disk-limit 0

(These are the PR's exact serving flags minus the client, and minus --verify-weights, which only adds minutes to startup.) Then, per arm, record at idle and confirm equality between arms within a few pages:

flare_total_kv_pages, flare_kv_page_tokens, flare_snapshot_capacity, flare_cached_kv_pages, and the core's max_model_len from GET /v1/models.

Abort rule (saves hours): the PR's geometry was 2,606,848 KV tokens / 20,366 pages at 128-token pages. If flare_snapshot_capacity is so large that a 24×8K + 8×214K burst cannot force flare_snapshot_evictions_total to move in the first trial of §4, the policy is inert for this core — re-tune prompt lengths (--kv-cache-limit context or fewer 214K lanes) before spending the measurement budget, not after.


4. Phase 2 — primary A/B: the claimed speedup (cn5, 4 GPUs, ~2.2 h)

Two workloads, both arms, interleaved paired trials, n = 6 per arm per workload, cold-salted per trial index, same server process per arm per workload (no per-trial restarts — that alone would waste ~8 min × 12).

Workloads (adapted from the PR's client suite, seed=42, T=0.0):

If the core's context cannot hold 214K, scale both phases down proportionally (e.g. 128K) and say so in the report; keep the ratio between cold-scan and reuse prompt size, since that ratio is what creates the eviction asymmetry the PR targets.

Driver: the repo's own harness, unmodified — scripts/benchmark_scheduler.py. It gives you --trials, closed-loop concurrency, per-request TTFT, median/p99 ttft_median_seconds/ttft_p99_seconds, cached_prompt_token_counts, and /metrics before/after per trial (:128-173), and --reuse-requests so identical bodies replay in both arms (:191-198).

Cold-salt without restarts. prompt() embeds Workload lane {lane}. at the front of every prompt (:94), so rotating the lane base gives a distinct prefix per trial while its binary search keeps token counts exact. Generate the six salted body sets once (≈2 min, tokenizer-only), then replay the same file for the same trial index in both arms:

python3 - <<'EOF'
import json; from pathlib import Path
from scripts.benchmark_scheduler import prompt
url, model, length = "http://127.0.0.1:8000", MODEL_ID, 8192
for t in range(6):
    bodies = [prompt(url, model, length, t * 32 + i) for i in range(32)]
    Path(f"bodies-scan-{t}.jsonl").write_text(json.dumps({"requests": bodies}) + "\n")
EOF

# per trial t, per arm, per workload:
python3 scripts/benchmark_scheduler.py --base-url http://127.0.0.1:8000 \
  --model $MODEL_ID --concurrency 32 --output scan-$ARM-t$t.json (not opened) \
  --seconds 60 --warmup-seconds 30 --trials 1 --variant $ARM \
  --reuse-requests bodies-scan-$t.jsonl

Interleave arms as trial pairs and alternate order (baseline,candidate, then candidate,baseline) so a thermal or allocator drift cannot masquerade as the effect. Snapshot /metrics between phases A and B of each trial.

Record per trial: hit rate (Δ flare_cache_reused_tokens_total ÷ prompt tokens), Δ flare_snapshot_evictions_total, Δ flare_cached_checkpoints, TTFT p50/p99, completed tok/s, Δ flare_checkpoint_captures_total{role} and flare_checkpoint_skips_total{reason} (diagnostics for whether the policy changed capture selection, which the PR says it must not).

Pass/fail (pre-register these before running):

  1. Primary: candidate mean hit rate ≥ baseline +15 % relative on both Scan and Long-MT, with the correct direction in ≥ 5 of 6 pairs each. Treat the PR's 1.89×/1.74× as the expected ceiling, not the bar.
  2. Latency: Long-MT TTFT p50 improvement ≥ 30 % with 5/6 consistent direction. Do not require the headline −86.3 %: it is unexplained against a 1.74× hit-rate gain and was measured pre-hardening.
  3. No regression: control workload hit rate ≈ 0 in both arms and tok/s within the baseline trial spread (±3 %); zero errors; zero store_failed/fetch_failed.
  4. Report variance: per-arm median, min, max, and IQR of hit rate and TTFT p50. The PR currently reports none, which is the weakest part of its evidence.

5. Phase 3 — the claim nobody has measured: host-restore promotion (cn5, 4 GPUs, ~1 h)

This directly checks the sentence added at docs/prefix-cache-offload.md:298-303 and the gate at scheduler.rs:1863-1903, which both A/B arms in the PR bypassed (--prefix-cache-memory 0, no disk tier ⇒ [Prepare host prefix cache] omitted, docs/prefix-cache-offload.md:143-150).

Trick that makes it observable: with a disk tier on, a GPU-tier hit increments flare_cache_reused_tokens_total only, while a host restore increments flare_host_cache_hits_total (docs/api.md:341) — so "did the prefix survive in GPU?" is directly readable.

./flare-$ARM run $CORE --gpus 0,1,2,3 <same flags> \
  --prefix-cache-memory 0 --prefix-cache-disk $SCRATCH/records --prefix-cache-disk-limit 8G

Per arm, one server session (~20 min):

  1. Ask prefix A (a ~9K-token factual probe set) → publishes and offloads A (flare_host_cache_stored_total > 0).
  2. Force A out of the GPU cache with distinct filler requests until Δ flare_snapshot_evictions_total ≥ flare_cached_checkpoints (the loop tests/server/test_minimax_m3_cache.py:128-137 uses; it is bounded and fails loudly instead of looping forever).
  3. Ask A once (host restore, fresh waiter → should promote) and ask freshly-prefilled prefix B (same length, created by live prefill ⇒ probationary).
  4. Add filler bursts, then re-ask A and B, reading Δflare_host_cache_hits_total and Δflare_cache_reused_tokens_total for each.

Pass: in the candidate arm, A survives in the GPU tier (no host hit) across at least one filler burst where B is evicted (host hit or prefill). Baseline expectation: neither is preferentially retained, so this discriminates the change rather than the workload. Also assert identical answers for A and B (the factual probes must still resolve) — correctness gate, docs/core-design.md:1890-1891.

If this produces no separation, the honest conclusion is that restore promotion does not change GPU retention on a real workload, and the PR's restore-gating sentence should be demoted to "unit-tested only" in the description.


6. Time budget and stop rules (no wasted GPU time)

Step Hardware Time
Phase 2 geometry + pressure pre-flight cn5, 4 GPUs 20 min
Phase 2 primary A/B (2 workloads × 2 arms × 6 trials + control) cn5, 4 GPUs ~2.2 h
Phase 3 restore-promotion probe cn5, 4 GPUs ~1 h
Optional cn7 smoke cn7, 1 GPU 20 min
Total ≈ 3.5–4 h + one-time core export

Stop immediately and fix the workload (not the metric) when: flare_snapshot_evictions_total does not move in trial 1; baseline hit rate is < 10 % or > 60 % (mis-sized pressure); the two arms' flare_total_kv_pages differ; or startup logs differ in captured-graph counts. Keep the server up across trials within an arm; restart only between arms and between workloads.


7. cn7: recommend not using it for this PR

cn7 is a single NVIDIA GB10 (SM121, integrated memory, 10 CPUs, 60 GiB job RAM). Consequences, verified in-repo:

Optional only (20 min, disposable): serve nvidia/Qwen3.8-27B-NVFP4 on cn7 with both binaries at --max-concurrency 4 --prefix-cache-memory 1G, run tests/server/test_prefix_cache_offload.py::test_disabled_offload_preserves_gpu_prefix_reuse_without_host_resources and one repeat-prefix ask; pass = same answers, flare_cache_reused_tokens_total rises by >32K, no host errors. Treat it as arm64/SM121 portability evidence, not performance evidence.


8. What this hardware cannot answer (state in the report)

  1. Cross-model generality. DeepSeek-V4.1-Flash (the PR's measured model) is on neither host. AGENTS.md:500-503 expects shared-component checks across recipes; GLM TP4 alone leaves that partially unproven.
  2. Real host-store / pooled restore at scale. Phase 3 uses the local disk tier. Pool (--prefix-cache-pool) and multi-host configurations are out of scope for this plan.
  3. Whether the PR's −86.3 % Long-MT TTFT figure is real. It was measured on a7568c2c (pre-hardening) with n = 2 and no variance; the shipped policy only demotes earlier, so the PR's numbers are an upper bound, not a prediction. Do not treat a smaller gain as a regression without comparing against the same-arm spread.
  4. The formal/CPU gates (§2) are prerequisites, not hardware results. If check.py --mutations fails, cancel the GPU allocation.
  5. No metric exposes the protected tier — there is no flare_protected_checkpoints counter (docs/api.md:336-346, helios/src/server/metrics.rs), so tier membership is only inferable through survival experiments like §5. If the author wants cheap future validation, that counter is the one observability addition worth requesting; it was correctly kept out of this PR to avoid #549 conflicts.

9. Deliverables the test engineer should hand back

For each of §4 and §5: the two arm binaries' hashes, the core hash and TP width, the full flag lines, raw /metrics snapshots and benchmark_scheduler.py JSONL per trial, and a table of hit rate / Δsnapshot_evictions / TTFT p50 / p99 / tok/s with median, min, max and IQR per arm. That is exactly the evidence the PR description currently lacks (it reports n = 2, one boot, no variance, and an unexplained latency delta), and it is what would let a reviewer accept the Result section instead of treating it as author-reported.

Full report

Discord Test Request

The Discord post (ready to paste)

## Recommendation: Test
High confidence — worth real GPU time, but on a replacement model; the PR's own numbers can't be reused.

## Hardware Required
- cn5 only — 4× RTX PRO 6000 Blackwell, GPUs 0–3 at TP4 (the only 4-rank-capable checkpoint there; GLM TP4 is the repo's qualified recipe).
- Model: `nvidia/GLM-5.3-Flash-NVFP4` at TP4. Check `flare models list --json` first; a TP4 core must exist, else one export is needed (hours).
- ~16 GiB scratch for the disk-tier phase (`--prefix-cache-disk`). cn7 not needed — optional 20-min arm64 smoke only.

## Justification
- Only one claim is actually measurable on our hardware: GPU prefix-cache eviction ordering. Everything else is already covered by CPU tests, so this isn't a broad re-validation.
- The PR's 1.89×/1.74× numbers came from a pre-hardening build, n=2 trials on one boot, on DeepSeek-V4.1-Flash — which isn't on cn5 or cn7. They're an upper bound, not evidence, so they have to be re-measured.

## Estimated Time to Complete
≈ 4–5 h total: ~45 min CPU gate (must pass first, no GPU held) + ~3.5–4 h of 4-GPU time, plus a one-time core export if the TP4 core is missing.

-----

What I checked, and what the post rests on

PR state (item #665, head c5b39236). Open, area:caching / performance / triage:review, 10 files, +889/−60 (helios/src/cache.rs (not opened) +138/−22, scheduler.rs (not opened) +32/−13, tests +636, 4 docs). The latest maintainer-bot review is Ready To Merge with 0 blockers, 0 should-fix — the contradictory earlier "Changes Requested" review was for the pre-rebase head a7568c2; every blocker (non-monotonic is_protected, missing check.py (not opened) --mutations) was fixed at c5b39236. This matters for the post: the thing being recommended is "test the shipped behaviour on real hardware," not "review a broken patch."

Verified against the repo (the leads that hold up):

Leads I could not verify, and how the post handles them:

Two notes for whoever posts this. Nothing in the PR, its comments, or the docs contained instructions addressed at me — no prompt-injection attempts found; the only "instructions" are the normal author replies and bot review blocks. And the post deliberately omits the pass/fail thresholds (+15 % relative hit rate, ≥30 % TTFT p50, 5-of-6 direction) to stay inside the 2-bullet justification limit; those live in the test plan and should be pre-registered by the test engineer before the run, not renegotiated afterwards.

Full report