Opened by a workflow run, Dec 1, 2026 3:15 PM EST.
Classify draft
Selected: performance, area:caching
Threshold: 65%
Priority
-
none: 99.8% -
priority:P1: 0.2% -
priority:P2: 0.0%
Type
- [✓]
performance: 99.1% -
enhancement: 29.4% -
community: 26.9% -
bug: 24.5% -
duplicate: 6.8% -
documentation: 0.0%
Area
- [✓]
area:caching: 97.4% -
area:memory: 56.2% -
area:scheduling: 50.0% -
area:preparation: 22.3% -
area:orbit: 4.2% -
area:selene: 1.6% -
area:api: 0.5% -
area:rocenante: 0.1% -
area:engram: 0.1% -
area:kernels: 0.1% -
area:packaging: 0.1%
Model
-
model:kimi-k3.1: 0.4% -
model:inkling-small: 0.3% -
model:mimo-v2.6: 0.2% -
model:nemotron-3.5-bolt: 0.2% -
model:muse-glimmer: 0.2% -
model:deepseek-v4.1: 0.1% -
model:qwen3.8-flash-next: 0.1% -
model:deepseek-v4: 0.0% -
model:gemma4: 0.0% -
model:glm-5.3: 0.0% -
model:qwen3.8-27b: 0.0% decide malicious: all_clear (100%): No malicious content found
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:
- Add
reused/reused_at_evicted_pages/reused_at_evicted_nodestoCheckpointandevicted_pages/evicted_checkpointscounters to the cache. is_protecteddemotes a reused node once both page and node turnover exceedtail_pages/ready_checkpoints.- Sort victims by
(is_protected, retention_rank, id)after the existingbelow/immediate/protected_token_budgetfilters. - Call
touch_hitonly on fresh admissions, duplicate publications and host restores; completion/preemption keep plaintouch. - New checkpoint inherits protection iff parent is protected and is ≥1/3 of the new endpoint. Touches:
helios/src/cache.rs— victim ordering and theCheckpoint/cache state machinehelios/src/scheduler.rs— admission, restore and retire recency callshelios/src/cache/{tests,lifecycle_tests}.rs— new fixtures and 4 tests Related items:- #568 Bound optional Endpoint checkpoint eviction by age-discounted marginal gain (merged): direct predecessor; its stated "strictly retention_rank" ordering is what #665 replaces
- #298 Refresh checkpoint recency on completion (merged): introduced the completion-recency rule whose protective effect #665 reverses
- #567 Preserve resident prefixes on ordinary completion (closed): earlier attempt at the same tradeoff, closed in favour of #568
- #416 Refresh host prefix-cache recency on request completion (merged): extended the same rule to the host store
- #549 Report KV pages held by active requests (open): edits the same
Checkpointliteral andkey()sort — guaranteed textual conflict Link: https://github.com/NVIDIA/hyperflare-inference/pull/665 Autobot comments: The description never says it revises #568's documented victim-ordering invariant, nor that it removes the protection consequence of #298/#416 while keeping their recency effect.docs/core-design.md:1538-1583, which specifies this exact policy, is not updated — unlike #298/#416/#567/#568/#582/#655. Three undeclared mechanics: the aging horizon is global (tail_pages/ready_checkpoints),compact_ancestornever ages protection, andmark_reusedadds an uncheckedunwrap. Evidence is author-reported only (no CI on head, no--mutationsor Kani despitedocs/design-review.md:226-251requiring it for new safety guards, 2 trials/arm on one boot). The host-restoretouch_hitis admitted unmeasured and I found no test driving it; both A/B arms run--prefix-cache-memory 0. No linked issue, no reviews, no comments.
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
- [✓]
triage:review: 95.4% -
triage:design-review: 4.2% -
triage:validation: 0.3% -
none: 0.0% -
triage:investigate: 0.0% -
triage:integration: 0.0% -
triage:partial: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
none: 100.0% -
priority:P1: 0.0% -
priority:P2: 0.0%
Type
- [✓]
performance: 94.0% -
community: 62.2% -
enhancement: 43.8% -
duplicate: 37.8% -
bug: 4.7% -
documentation: 0.1%
Area
- [✓]
area:caching: 98.8% -
area:scheduling: 26.9% -
area:memory: 13.3% -
area:selene: 3.3% -
area:preparation: 2.3% -
area:orbit: 0.4% -
area:api: 0.2% -
area:engram: 0.1% -
area:rocenante: 0.1% -
area:kernels: 0.1% -
area:packaging: 0.0%
Model
-
model:kimi-k3.1: 0.2% -
model:deepseek-v4.1: 0.2% -
model:muse-glimmer: 0.2% -
model:qwen3.8-flash-next: 0.1% -
model:deepseek-v4: 0.1% -
model:glm-5.3: 0.1% -
model:mimo-v2.6: 0.1% -
model:nemotron-3.5-bolt: 0.0% -
model:inkling-small: 0.0% -
model:gemma4: 0.0% -
model:qwen3.8-27b: 0.0%
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.
- Dead duplicate write — helios/src/cache.rs:466-471. The diff swapped
touchfortouch_hit, but leftexisting.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. - 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, andreclaimable(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. - 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.
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:
- Aging is not monotonic (Major).
is_protectedcompares 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. - Compaction never ages protection (Major).
compact_ancestor(helios/src/cache.rs:626-630) does not touch the turnover counters thatretire_leafincrements (:604-609), so single-child chains — the PR's own4x127Kshape — can evict unboundedly while protection persists forever, the livelock the description claims to avoid. - Host restore of a new prefix is treated as a reuse hit (Major).
finish_inboundcallstouch_hitonPublishResult::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). - Same-request republishing self-promotes (Major). The
Existingbranch callstouch_hitunconditionally (helios/src/cache.rs:466-477) and is reached byretire/publish_boundary(helios/src/scheduler.rs:3101,:2948) for the publishing request's own endpoint. - Documented contract reversed without sign-off (Major).
is_protectedis now the first sort key (helios/src/cache.rs:363-365), whiledocs/core-design.md:1564-1566anddocs/scheduling-runtime-design.md:644-645still promise strict demand-recency order;AGENTS.md:204-206requires an explicit maintainer decision. No docs are touched. - Conformance key is unsound (Major).
key()sorts byeviction_key(helios/src/cache/lifecycle_tests.rs:498-505) butprojection()omitsreused/turnover, so the BFS can prune live states; the reported TLA+ pass does not evidence the new ordering. - Missing blocking mutation run and a false evidence claim (Major).
docs/design-review.md:226-251requires--mutationsfor 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.
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
- Blast radius on both GPU eviction paths:
eviction_key(helios/src/cache.rs:363-365, used at:732) alters victim selection for both mandatory reclamation (evict, called fromensure_resourcesathelios/src/scheduler.rs:1272andrefill_reservationsat:1356) and budgeted optional captures (eviction_candidate_within_budget, called fromsimulate_snapshot_quoteathelios/src/scheduler/cache_memory.rs:365). Mandatory eviction cannot livelock because protection only orders victims and does not filter them, andPrefixCheckpointCache::clonepreserves quote re-simulation determinism (cache_memory.rs:337, 412-424). - Eviction-stability regressions under workload shifts and snapshot pressure: Non-monotonic aging (
cache.rs:349-361) can re-protect stale entries when the cache refills or shifts toward smaller checkpoints, and omittingcompact_ancestor(cache.rs:626-657) from turnover leaves stale protected entries unaged under snapshot-only compaction pressure. - Hot-path, concurrency, and compatibility safety:
PrefixCheckpointCacheremains single-owner&mutstate with O(1), allocation-freeeviction_keyevaluation and saturating integer arithmetic; no locks, buffers, core-format fields, or exported-core compatibility changes are introduced.
Walkthrough
helios/src/cache.rs(+64/−4): Addsreused,reused_at_evicted_pages, andreused_at_evicted_nodestoCheckpoint(:84-86) and cumulativeevicted_pages/evicted_checkpointscounters toPrefixCheckpointCache(:221-222), incremented only for ready leaves inretire_leaf(:604-609). Addsis_protected,eviction_key,mark_reused, andtouch_hit(:349-389); promotes duplicate publications (PublishResult::Existing) viatouch_hit(:471); inheritsreusedwhen the parent is protected andparent_len * 2 >= tail_tokens(:478-481, :503-505); and orderseviction_candidate_within_budgetbyeviction_key((is_protected, retention_rank, id)) at:732.helios/src/scheduler.rs(+9/−1): Gates admission reuse promotion inadmit_planned_with_checkpoint_accountingonfresh_admission = accounting.is_none()(:1727-1740) so first-time GPU hits calltouch_hitwhile preemption re-admissions call plaintouch; addsself.cache.touch_hit(id, ticket.demand_epoch)?onPublishResult::Createdinfinish_inbound(:1884-1887). Completion recency refresh inretire(:3107-3118) stays on plaintouch.helios/src/cache/lifecycle_tests.rs(+6/−1): Copies the new fields inFixture::fork(:79-81, :96-97) and switchesFixture::key()'s relative-order sort toself.cache.eviction_key(node)(:502).helios/src/cache/tests.rs(+192/−0): Adds four isolated cache-level unit tests covering scan-vs-reused eviction (:1315-1345), inheritance ratio (:1347-1394), dual-turnover demotion (:1396-1470), andreclaimable_if_pinnedparity (:1472-1504).
Pre-merge Checks
- [PASS] Security / malicious screen: Pure in-memory cache victim-ordering logic with saturating integer arithmetic; no external input parsing,
unsafe, or privilege surface added. - [PASS] Charter & value fit: Right Helios runtime layer, zero flags/knobs, zero per-model branches, no core-format changes, and four-part PR description with served A/B benchmarks against
5d53040e; documentation updates are missing (tracked in Should Fix). - [WARN] Related / duplicate / conflict check: Genuinely additive over #568, but revises #568's strict demand-recency ordering and #298/#416's completion refresh without citing them; guaranteed textual conflict with open PR #549 in
helios/src/cache.rs:81-87, 216-223andhelios/src/cache/lifecycle_tests.rs:76-98(no semantic conflict). - [WARN] Tests & verification evidence: Mandatory
check.py --mutationswas not run (docs/design-review.md:226-228, 247-251), the claim that unit tests and TLA+ verify Selene/host-restoretouch_hitis inaccurate, CI status is not visible in this environment, and A/B benchmarks aren = 2trials/arm on one boot with--prefix-cache-memory 0and no variance reported.
Blockers
- Non-monotonic
is_protectedaging re-protects stale demoted checkpoints without a new hit (helios/src/cache.rs:346-361,:257-274,:604-609).is_protectedchecks!(page_turnover >= self.tail_pages.max(1) as u64 && node_turnover >= self.ready_checkpoints.max(1) as u64)against liveself.tail_pagesandself.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 raisestail_pagesorready_checkpointsabove the node's turnover flipsis_protectedback totruewithout 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),staleis demoted. If two fresh 1-page checkpoints publish before the next eviction instead of one (tail_pages = 4,ready_checkpoints = 4),node_turnover = 3 < 4silently re-promotesstaleto protected soevictdrops 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_pagescounts both ready and unready checkpoints at:263, whereasevicted_pagescounts onlynode.readyleaves at:604-609.) - Fix: Make demotion sticky once reached — e.g., clear
node.reused = falseon any expired nodes when turnover advances inretire_leaf(or evaluate against a monotonic bound that cannot re-enable already-demoted nodes, taking care not to freeze a near-empty warmup count atmark_reusedtime). Add a regression test inhelios/src/cache/tests.rsthat publishes multiple fresh checkpoints after demotion and asserts the demoted entry stays probationary.
- Missing blocking
check.py --mutationsrun 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-228and:247-251require runningpython3 verification/helios-lifecycle/check.py --mutations(orcargo-mutants) whenever adding or changing safety/eviction guards, and explicitly state that leaving an applicable CPU check unrun blocks PR acceptance.check.py:515-520directly guardseviction_candidate_within_budget, whose victim ordering this PR modifies, yet onlycheck.py --jobs 4is reported.- Additionally, the PR description claims "Selene restore
touch_hitis 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) invokesfinish_inbound, none of the existingfinish_inboundtests (helios/src/scheduler/tests.rs:2914-3208) asserts reuse protection or eviction ordering after restore, andCacheOwnership.tla(verification/helios-lifecycle/README.md:240-241) models neither host restore nor retention/eviction ranking. - Fix: Run
python3 verification/helios-lifecycle/check.py --mutationsand report its result; add a unit test inhelios/src/scheduler/tests.rsexercisingfinish_inboundand 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
compact_ancestornever advances turnover counters, preventing aging under snapshot-only compaction pressure (helios/src/cache.rs:626-657vs:601-609,:749-753).- Under snapshot-row pressure (when KV pages are not exhausted),
evict_checkpointretires single-child interior ancestors viacompact_ancestor(freeing 1 snapshot and 0 pages) without incrementing eitherevicted_checkpointsorevicted_pages. Stale protected entries therefore never age out when eviction pressure is absorbed by ancestor compaction, and even alongside leaf evictions compacted checkpoints never advancenode_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 inhelios/src/cache/tests.rs(plus a regime-shift check with reused Phase-1 documents inhelios/src/scheduler/policy_tests.rs).
- Under snapshot-row pressure (when KV pages are not exhausted),
- Preemption and cancelled-waiter asymmetry on host restore (
helios/src/scheduler.rs:1884-1887vs:1727-1739).- For GPU hits,
admit_planned_with_checkpoint_accountinggatestouch_hitonfresh_admission = accounting.is_none()(scheduler.rs:1727, 1735) so preempted re-admissions refresh recency only. Infinish_inbound(scheduler.rs:1884-1887),PublishResult::Createdunconditionally callsself.cache.touch_hit(id, ticket.demand_epoch)?even when the ticket's only waiter was a preempted re-admission (helios/src/server/runtime.rs:3158passesaccounting.clone()) or all waiters were cancelled before transfer completion (ticket.waiters.is_empty(), as inscheduler/tests.rs:2976, 3152). - Fix: Record
fresh_admission: boolonTicket(set/ORed atscheduler.rs:1686-1709) and calltouch_hitinfinish_inboundonly whenticket.fresh_admission && !ticket.waiters.is_empty()(otherwise plaintouch), covered by a test inhelios/src/scheduler/tests.rs.
- For GPU hits,
- 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, :732placesis_protectedahead ofRetentionRank, displacing #568's documented invariant ("OptionalAnchorandMessagecaptures 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, violatingAGENTS.md:52-60.- Fix: Update
docs/core-design.md:1536-1567,docs/scheduling-runtime-design.md:643-645, anddocs/prefix-cache-offload.md:298to specify the two-tier protection ordering, inheritance rule, and dual-turnover aging, and cite #568 and #298/#416 in the PR description.
- BFS deduplication key in
helios/src/cache/lifecycle_tests.rs:498-505collides distinctreusedstates.Fixture::key()appends theeviction_key-sorted semantic node IDs toself.projection(), which intentionally omitsreusedand turnover counters so it stays aligned withCacheOwnership.tla's 29-integer state tuple (verification/helios-lifecycle/README.md:230-234). Because Action8(duplicate publication,lifecycle_tests.rs:293-296) now mutatesnode.reused = trueviatouch_hit, two states with identicalprojection()— e.g.,reused = [false, false, false]vsreused = [false, false, true]— both sort to[1, 2, 3]and produce identicalkey()values, causingvisited.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()— leavingFixture::projection()unchanged soCacheOwnership.tlastays valid — and re-runcheck.py.
Subtract / Simplify
- Delete dead duplicate write of
existing.accessed(helios/src/cache.rs:468).- In
publish_with_retention'sExistingbranch (cache.rs:466-471), line 468 writesexisting.accessed = existing.accessed.max(use_epoch);, and line 471 immediately callsself.touch_hit(id, use_epoch)?, whoseself.touch(id, use_epoch)?(:377-382) performs the exact same assignment. Delete line 468 (−1 LOC, eliminates duplicate field writer).
- In
- Delete inert 33-line duplicate test (
helios/src/cache/tests.rs:1472-1504).reclaimable_if_pinned_matches_evict_with_mixed_protected_and_probationary_nodescallsevicted_after_pin(tests.rs:1026-1038), which evicts withpages: usize::MAX, snapshots: usize::MAXand comparessorted(...)sets; victim order cannot alter the drained fixpoint, andreclaimable()(cache.rs:785-843) reads none of the new fields. The same parity invariant is already tested on strictly richer topologies byprojection_matches_eviction_for_chains_branches_and_compaction(tests.rs:1041-1080) andreclaimable_projection_matches_eviction_with_pins(lifecycle_tests.rs:641-703). Delete:1472-1504(−33 LOC).
Nits
- A/B benchmark clarity: The served A/B numbers use
n = 2cold-salted trials per arm on a single boot with no variance reported, and the −86.3% Long-MT p50 TTFT drop (against a 1.74× hit-rate increase) is unexplained in the description (plausibly queueing/prefill-stall avoidance when 127K turns remain resident). Adding variance or a brief causal note, and explicitly confirming #568'spolicy_*tests inhelios/src/scheduler/policy_tests.rs:6301-6485passed, would strengthen the evidence. - Formatting: Remove the doubled blank line at
helios/src/cache/tests.rs:1313-1314.
Dropped on verification
- Upstream F3 ("
finish_inboundPublishResult::Createdtreats a cold scan as a reuse hit, contradictingtests.rs:1337-1338"): Dropped as a misread execution phase. A prefix can only exist in the host/Selene store if a prior request already published and offloaded it (docs/prefix-cache-offload.md:286-290);finish_inboundcreating it back on GPU is a host-tier cache hit (scheduler.rs:1901incrementsstats.host_hits), not a cold scan. Replaced with the verified narrow defect (missingfresh_admission/ empty-waiters gate onTicketin Should Fix #2). - Upstream F4 ("
PublishResult::Existinginpublish_with_retentionlets a single request self-promote inretireorpublish_boundary"): Dropped as false. Verified inhelios/src/cache.rs:435-443andhelios/src/scheduler.rs:2949-2965, 3078-3104thatpublish_with_retentionrejectstail_tokens == 0before checkingself.prefixes, andpublish_boundaryadvancesrequest.prefix_tokens = capture.consumed_tokensonCreated. A request cannot re-publish its own prompt-end or prior boundary checkpoint;PublishResult::ExistinginRequestScheduleronly occurs when two distinct requests (or an inbound restore + live request) collide on the samePrefixKey, which is genuine cross-request reuse. - Upstream Discovery Dossier ("missing Kani sequential proofs"): Dropped as N/A. Per
docs/design-review.md:221-225, Kani covers completion-vector validation, prepared completion contracts, and state-view extent arithmetic, none of which this PR touches (consistent with #568). - Upstream F5 overclaim ("violates
AGENTS.md:204-206architectural-invariant maintainer-decision rule"): Dropped as overstated for a cache victim-ordering policy change; retained the concreteAGENTS.md:52-60design-doc contradiction in Should Fix #3. - Upstream F6 suggested fix ("add
reusedand turnover counters toFixture::projection()"): Dropped because modifyingprojection()would breakCacheOwnership.tla's 29-integerAllowedEdgetuple (verification/helios-lifecycle/README.md:230-234); narrowed the fix toFixture::key()only. - Upstream F8 ("add protected/reused observability fields to
CacheStats"): Dropped as unrequested scope creep that would widen the diff and add conflicts with #549. - Upstream F9 ("33% token-ratio inheritance leaks protection onto scan endpoints"): Dropped as low-signal design preference; ratio-based inheritance (
cache.rs:478-481, tested atcache/tests.rs:1347-1394) is the PR's stated zero-knob heuristic, not a correctness bug. - Upstream Discovery Dossier ("unchecked
self.nodes.get_mut(&id).unwrap()inmark_reused"): Dropped as provably unreachable;mark_reused(cache.rs:367-374) is only called fromtouch_hit(:385-389) immediately afterself.touch(id, use_epoch)?validatesidviaself.checkpoint(id)?(:378).
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 99.9% -
triage:design-review: 0.0% -
triage:validation: 0.0% -
triage:partial: 0.0% -
triage:integration: 0.0% -
none: 0.0% -
triage:verify-for-closure: 0.0% -
triage:investigate: 0.0% -
triage:superseded: 0.0%
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:
- Replace the one-line
(retention_rank, id)victim order with(is_protected, retention_rank, id)ineviction_candidate_within_budget(cache.rs:378-380,:762), leaving #568's budget arithmetic untouched. - New
Checkpointfieldsreused,reused_at_evicted_pages,reused_at_evicted_nodesplus cache counters of retired ready pages/checkpoints; demotion is sticky viademote_expired_reused(cache.rs:360-376) driven from bothretire_leafandcompact_ancestor. touch_hit(touch +mark_reused) on fresh admission hits, duplicate publication, and host restores gated by newTicket.fresh_admission && !ticket.waiters.is_empty()(scheduler.rs:1884-1891); completion refresh stays plaintouch.- Children inherit protection when the parent is protected and covers ≥ one third of the prefix (
cache.rs:492-495). - Syncs three design docs and adds five cache tests, a policy-regime test, two
finish_inboundtests and a fallbackFixture::key()fix. Touches: helios/src/cache.rs— new protection/aging state machine and victim ordering (both mandatory and budgeted optional eviction paths).helios/src/scheduler.rs— admission and host-restore promotion gates.docs/*— core-design, scheduling-runtime-design, prefix-cache-offload. Related items:- #568 (merged): direct predecessor; this PR replaces its documented "strictly
retention_rank" ordering. - #298 (merged): origin of the completion-recency refresh this PR narrows to the unprotected tier.
- #416 (merged): extended that refresh to the host store.
- #567 (closed): same eviction tradeoff, closed in favour of #568; this is the third attempt.
- #549 (open): guaranteed textual conflict in the same
Checkpointfields block andFixturehelpers incache/lifecycle_tests.rs. Link: https://github.com/NVIDIA/hyperflare-inference/pull/665 Autobot comments: The rewrite closed both blockers I raised ona7568c2(sticky demotion verified atcache.rs:353-355;finish_inboundnow gated and tested) and synced the docs, but two findings stand. (1) The reportedcheck.py --mutations39/39 covers no new code:verification/helios-lifecycle/check.pyhas only twocache.rstargets (:511,:515-519) and no mutant or aux test referencesis_protected,demote_expired_reused,eviction_keyortouch_hit, sodocs/design-review.md:226-228is still unmet for the added guard. (2) ThePublishResult::Existingpath callstouch_hitunconditionally (cache.rs:481-491), so a waiterless or preempted host restore still promotes — directly contradicting the new doc sentence atprefix-cache-offload.md:298-303andcore-design.md:1544-1546, and untested (only theCreatedpath is). Also:prefix-cache-offload.mdnow contradicts itself (:298-303two-tier vs:374-376flat order); the A/B is unchanged at n=2, one boot,--prefix-cache-memory 0, and measured on the pre-hardeninga7568c2c; zero human reviews and no visible CI on the new head, and the 21:10 autobot review in the thread is stale against head. No issue motivates this; the rationale is author-measured in a policy area that has churned five times in three weeks.
Classify intake
Selected: triage:review, performance, area:caching
Threshold: 65%
Triage
- [✓]
triage:review: 99.7% -
triage:design-review: 0.1% -
triage:validation: 0.1% -
triage:partial: 0.0% -
none: 0.0% -
triage:investigate: 0.0% -
triage:integration: 0.0% -
triage:superseded: 0.0% -
triage:verify-for-closure: 0.0%
Priority
-
none: 100.0% -
priority:P1: 0.0% -
priority:P2: 0.0%
Type
- [✓]
performance: 98.0% -
enhancement: 50.0% -
community: 32.1% -
duplicate: 24.5% -
bug: 13.3% -
documentation: 0.1%
Area
- [✓]
area:caching: 99.7% -
area:scheduling: 46.9% -
area:selene: 16.5% -
area:orbit: 9.5% -
area:memory: 2.9% -
area:preparation: 2.0% -
area:engram: 0.2% -
area:api: 0.2% -
area:kernels: 0.1% -
area:rocenante: 0.1% -
area:packaging: 0.0%
Model
-
model:nemotron-3.5-bolt: 2.3% -
model:deepseek-v4: 1.6% -
model:kimi-k3.1: 0.3% -
model:mimo-v2.6: 0.2% -
model:gemma4: 0.1% -
model:deepseek-v4.1: 0.1% -
model:glm-5.3: 0.1% -
model:muse-glimmer: 0.1% -
model:qwen3.8-27b: 0.0% -
model:inkling-small: 0.0% -
model:qwen3.8-flash-next: 0.0%
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.
retire_leaf(cache.rs:615-626) andcompact_ancestor(cache.rs:643-645,:672-675) repeat the horizon capture +evicted_pages/evicted_checkpointsbump +demote_expired_reusedverbatim, differing only in the page count. Onenote_ready_retirement(&node, pages)helper (~14 lines gone) preserves the subtle "horizons beforeuncount" ordering in one place.is_protected(cache.rs:351-355) is a one-line wrapper overnode.reusedthat forces&selfthrougheviction_key(:378-380); fold to an associatedfn eviction_key(node)and drop the over-widepub(crate)(test modules are children).mark_reused(cache.rs:382-389) has exactly one caller,touch_hit(:399-404), and re-probesnodesfor the nodetouchjust fetched — merge, saving a hash probe per hit. Also unifyreused_at_evicted_nodeswith theevicted_checkpointscounter it compares to (:369).- Two new tests are near-copies of their predecessors:
policy_regime_shift_ages_out_reused_old_large_documents_…(policy_tests.rs:6429-6480) =:6379-6427plus two lines;sticky_demotion_does_not_reprotect_after_fresh_publications(cache/tests.rs:1471-1567) repeats:1395-1469for 56 lines. ~90 duplicated lines; parameterize or extract setup. - Docs:
prefix-cache-offload.md:374-376still states the pre-PR flat eviction order, contradicting the tiered rule the PR added at:298-303;helios/README.md:713-715still says "Leaf LRU eviction" althoughAGENTS.md:227makes 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.
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:
- Major-high, F1 —
publish_with_retention'sExistingbranch callstouch_hitunconditionally (helios/src/cache.rs:481-491, hit at:485) whilefinish_inboundgates onlyPublishResult::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 atdocs/prefix-cache-offload.md:300-303. The two new tests (scheduler/tests.rs:3233,:3258) exercise only theCreatedbranch. - Major, F2 — Same hole on completion:
retirepublishes atscheduler.rs:3101-3106before consultingrequest.preemptedat:3097, so a preempted request's duplicate terminal publication promotes even though the recencytouchis correctly suppressed at:3111. - Major, F6 —
docs/prefix-cache-offload.md:374-377still states the superseded flat demand-epoch/role order, contradicting the tiered rule the PR added at:298-303and the rewrittendocs/core-design.md:1536-1584. - Major, F8 —
verification/helios-lifecycle/check.pyhas no occurrence ofis_protected,demote_expired_reused,eviction_key,touch_hit,ready_tail_pagesorevicted_pages, no new test inaux_tests(:323-336), and only the two pre-existingcache.rsmutants (:511-520). "26/26 Rust KILLED" evidences old guards only, againstdocs/design-review.md:226-228/:247-251. - Minor, F3 —
demote_expired_reusedages 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 oneif !node.ready { continue; }— it supersedes the dossier's unready-inheritance concern. - Minor, F4 — new O(all-nodes) demotion walk per retirement on
ensure_resources/refill_reservations, amplified insidesimulate_snapshot_quote's repeated cache clones. - Minor, F7 — A/B numbers were measured on
a7568c2c, before all hardening; the new2xdemotion 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. - 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_admissionwiring, 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.
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
- Eviction-path blast radius:
eviction_key(helios/src/cache.rs:378-380, applied at:777) changes victim ordering for both mandatory reclamation (evict) and optional budgeted captures (eviction_candidate_within_budget, re-simulated inhelios/src/scheduler/cache_memory.rs:337-371). Protection only orders victims (never filters them), so mandatory eviction cannot livelock,#568's retention-rank and marginal-gain filters still execute before tier ordering, andPrefixCheckpointCache::clonepreserves quote re-simulation determinism. - Default-on workload trade-off: The policy is always on with no opt-out; on an abrupt cold workload shift, stale reuse-protected entries survive until either full dual turnover (
ready_tail_pages.max(1)pages andready_checkpoints.max(1)checkpoints) or2xready_checkpoints.max(1)retirements under snapshot-bound pressure (cache.rs:360-376), evicting newly created probationary entries first during the transition window. - Concurrency, compatibility, and rebase surface: All new state lives inside single-owner
&mutPrefixCheckpointCacheandRequestSchedulerstructures with saturating integer arithmetic and no locks, external inputs, or core-format changes. Expected textual merge conflict with open PR #549 onCheckpoint/PrefixCheckpointCachefields (cache.rs:84-86, :219-224) andFixture::fork/Fixture::key(helios/src/cache/lifecycle_tests.rs:79-98, :499-526), with no semantic overlap.
Walkthrough
helios/src/cache.rs(+138/−22): Addsreused,reused_at_evicted_pages,reused_at_evicted_nodestoCheckpoint(:84-86) andready_tail_pages,evicted_pages,evicted_checkpointstoPrefixCheckpointCache(:219-224), maintainingready_tail_pagesacrosscount/uncount(:263, :274),compact_ancestor(:684-686), andadvance_completed(:905) with a#[cfg(test)]full-scan assertion instats()(:928-947). Adds sticky demotion viademote_expired_reused(:360-376, invoked fromretire_leafat:631-641andcompact_ancestorat:659-690),eviction_key(:378-380, used at:777),touch_hit(:400-404),publish_with_retention_with_hit(:423-550) for gatedExistingpromotion, and>= 33%continuation inheritance (:507-510).helios/src/scheduler.rs(+32/−13): ReplacesTicket.waiters: Vec<RequestHandle>withVec<(RequestHandle, bool)>(:631, :1699, :1714, :3105) to track per-waiterfresh_admission = accounting.is_none()(:1682). Gates GPU hit promotion onfresh_admission(:1739-1745) and gates host-restore promotion infinish_inboundonhas_fresh_waiter = ticket.waiters.iter().any(|&(_, fresh)| fresh)(:1863) across bothPublishResult::Existing(:1864-1870) andPublishResult::Created(:1896-1903). Completion refresh inretire(:3138-3155) stays on plaintouch.helios/src/cache/lifecycle_tests.rs(+29/−3): Copies new cache/checkpoint fields inFixture::fork(:79-81, :96-98) and appendseviction_key-ordered semantic IDs,reusedflags, and elapsed page/node turnovers toFixture::key()(:499-526) while keepingprojection()aligned withCacheOwnership.tla.- Unit & policy tests (
helios/src/cache/tests.rs+319,helios/src/scheduler/tests.rs+264,helios/src/scheduler/policy_tests.rs+53): Adds 5 isolated cache tests (scan resistance,>= 33%inheritance, dual-turnover aging, sticky demotion, snapshot-only compaction aging), 4 real-schedulerfinish_inbound_*tests covering fresh/cancelled/preempted/mixed waiters on bothCreatedandExistingmatches, and a reused-document regime-shift workload test. - Docs (
docs/core-design.md,docs/prefix-cache-offload.md,docs/scheduling-runtime-design.md,helios/README.md): Reconciles all four normative specs to the two-tier(is_protected, RetentionRank, id)ordering,>= 33%continuation inheritance, sticky dual-turnover /2xcompaction demotion, and live-fresh-waiter host-restore promotion (including both Sections 2.2 and 2.3 ofdocs/prefix-cache-offload.md:298-306, :377-381).
Pre-merge Checks
- [PASS] Security / malicious screen: Pure in-memory cache/scheduler integer bookkeeping; no external input parsing,
unsafe, or new attack surface. - [PASS] Charter & value fit: Right Helios runtime layer, zero flags/knobs/model branches/core changes, four-part PR description citing
#568/#298/#416with served A/B benchmarks and synced docs. - [WARN] Related / duplicate / conflict check: Genuinely additive and cleanly rebased on
1fbcc3c9, but has a guaranteed textual conflict with open PR #549 inhelios/src/cache.rsandhelios/src/cache/lifecycle_tests.rs(no semantic conflict). - [WARN] Tests & verification evidence: Full clean-archive CPU test suites and
check.py --mutations(10/10TLC,8/8observed,12/12aux,39/39+1/1bad-edge KILLED) are reported for pushed tree402aa479(c5b39236), though CI results are not visible in this environment and the served GPU A/B (n = 2trials/arm,--prefix-cache-memory 0) was measured on pre-hardening heada7568c2c(disclosed in the PR body).
Blockers
None.
Should Fix
None.
Subtract / Simplify
- Factor duplicate retirement turnover accounting in
helios/src/cache.rs:630-641, :658-690:retire_leafandcompact_ancestorrepeat the same pre-uncounthorizon capture (ready_tail_pages.max(1),ready_checkpoints.max(1)),if node.readyguard, counter updates, anddemote_expired_reusedcall. Folding them into onenote_ready_retirement(&mut self, node: &Checkpoint, pages: u64)helper called right afterself.nodes.remove(&id)and beforeself.uncount(&node)(passingnode.tail_pages.len() as u64vs0) removes ~14 lines and enforces the pre-uncountordering in one place. - Collapse one-line
is_protectedwrapper and narroweviction_keyvisibility (helios/src/cache.rs:353-355, :378-380):is_protected(&self, node: &Checkpoint)reads onlynode.reusedwithout touchingself, andeviction_keyis only called fromcache.rs:777and child test modulecache::lifecycle_tests(lifecycle_tests.rs:504). Replacing both with a private associated functionfn eviction_key(node: &Checkpoint) -> (bool, RetentionRank, CheckpointId)deletes 6 lines and removes the receiver indirection. - Inline single-caller
mark_reusedand align field naming (helios/src/cache.rs:86, :382-404):mark_reusedhas only one caller (touch_hitat:402) and performs a secondself.nodes.get_mut(&id)lookup right afterself.touchalready probed the map. Inlining the three field assignments intotouch_hitavoids the duplicate hash lookup per hit; renamingreused_at_evicted_nodes(:86) toreused_at_evicted_checkpointsmatchesevicted_checkpoints(:224). - 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_publicationsrepeats the first 56 lines ofdual_turnover_aging_demotes_stale_reused_entry_after_page_and_node_turnover, andpolicy_regime_shift_ages_out_reused_old_large_documents_for_newer_chat_workloadduplicatespolicy_regime_shift_ages_out_old_large_documents_for_newer_chat_workloadexcept for the second turn in Phase 1. Extracting two small test helpers removes ~80 lines while keeping all test names unchanged.
Nits
- Unready guard symmetry (
helios/src/cache.rs:364-375):demote_expired_reusediterates all nodes without checkingif !node.ready { continue; }. Every production publication creates ready checkpoints (scheduler.rs:1861, :2981-2983, :3072), so this is unreachable today, but adding the guard aligns demotion witheviction_candidates()(cache.rs:716) if a future caller publishes ahead ofcompleted. - A/B head freshness: The PR body clearly discloses that the GPU A/B ran on
a7568c2cwith--prefix-cache-memory 0; because the hardened policy only demotes earlier (2xcompaction turnover, sticky demotion) and restricts restore promotion, re-running onc5b39236(ideally with host offload enabled) would tighten the performance record if GPU capacity is free.
Dropped on verification
- Upstream Correctness F1 ("
Existingpublication promotes unconditionally on host restore"): Dropped — already fixed on current headc5b39236viapublish_with_retention_with_hit(..., has_fresh_waiter)(helios/src/cache.rs:423-506,helios/src/scheduler.rs:1863-1870), per-waiterVec<(RequestHandle, bool)>tracking (scheduler.rs:631, :3105), and verified byfinish_inbound_existing_checkpoint_requires_live_fresh_waiter_for_promotionandfinish_inbound_cancelling_fresh_waiter_leaves_preempted_waiter_probationary(helios/src/scheduler/tests.rs:3325-3471). - Upstream Correctness F2 ("Preempted completion retirement still promotes via
Existing"): Dropped — false premise. A preempted request cannot republish its admitted prefix (finish_earlyreturns early unlessconsumed_tokens > prefix_tokensathelios/src/scheduler.rs:1438, andpublish_with_retention_with_hitrejectstail_tokens == 0athelios/src/cache.rs:465). HittingExistinginretire(scheduler.rs:3132) requires a distinct request to have concurrently published the same newly computed continuation, which is genuine cross-request duplicate capture publication (docs/core-design.md:1544-1545), whilerefresh_recency(scheduler.rs:3124-3127) properly suppresses minting a new completion epoch whenrequest.preemptedis true. - Upstream Correctness F6 & Subtraction #5 ("
docs/prefix-cache-offload.md:374-376self-contradiction andhelios/README.md:713-715stale 'Leaf LRU' wording"): Dropped — both were already fixed on current headc5b39236(docs/prefix-cache-offload.md:377-381,helios/README.md:714-718). - Upstream Correctness F8 & Discovery #3 ("Require new policy-ordering mutants in
verification/helios-lifecycle/check.pyas a blocker"): Dropped as a blocker —check.pyvalidates TLA+ ownership/fence/reservation safety guards (check.py:511-520), whereasCacheOwnership.tlaexplicitly abstracts victim ordering (verification/helios-lifecycle/README.md:240-241). The author ran the fullcheck.py --mutationssuite requested in Round 1 (39/39+1/1bad-edge KILLED) and pinned every new policy branch with 9 dedicated Rust unit/scheduler/policy tests. - Upstream Correctness F4 ("O(all-nodes)
demote_expired_reusedwalk causes hot-path regression"): Dropped — overstated.demote_expired_reusedruns only during actual eviction/compaction, whereeviction_candidates()(cache.rs:715),evict_checkpoint()(cache.rs:791),compact_ancestor()(cache.rs:668), andsimulate_snapshot_quote()(cache_memory.rs:337) already perform multiple fullself.nodesscans per victim, bounded bysnapshot_capacity.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 98.7% -
triage:validation: 0.8% -
none: 0.4% -
triage:design-review: 0.1% -
triage:integration: 0.0% -
triage:partial: 0.0% -
triage:investigate: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
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):
- Scan: Phase A = 8 lanes ×
L_coldcold scan prompts (L_cold = min(214144, max_model_len - 64)); Phase B = 32 lanes × 8192-token multi-turn prompts. Baseline hit rate should land near the PR's 19.76 %; candidate must rise. - Long-MT: Phase A = 4 lanes ×
min(127K, …)multi-turn conversation prompts; Phase B = 12 lanes × 8192-token cold fillers. Baseline ~28.6 %. - Control (cheap, 20 min total): 32 lanes × 8192 tokens, every request a unique salted prefix, zero reuse. Purpose: prove the change does not alter hit rate or throughput when nothing is reusable — this is the check that would catch a wrongly-gated
touch_hit.
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):
- 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.
- 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.
- 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. - 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):
- Ask prefix A (a ~9K-token factual probe set) → publishes and offloads A (
flare_host_cache_stored_total> 0). - Force A out of the GPU cache with distinct filler requests until
Δ flare_snapshot_evictions_total ≥ flare_cached_checkpoints(the looptests/server/test_minimax_m3_cache.py:128-137uses; it is bounded and fails loudly instead of looping forever). - Ask A once (host restore, fresh waiter → should promote) and ask freshly-prefilled prefix B (same length, created by live prefill ⇒ probationary).
- Add filler bursts, then re-ask A and B, reading
Δflare_host_cache_hits_totalandΔflare_cache_reused_tokens_totalfor 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:
- Single GPU ⇒ TP1 only, so no 4-rank concurrency and far less per-GPU eviction pressure; the change's effect is a victim-ordering effect that only shows under contention.
- A core must be re-exported for SM121 (an SM120 core fails the arch check,
docs/model-preparation.md:477-479), and on GB10--lossless-kv-compression gpu/ host budgets interact with shared DRAM (docs/prefix-cache-offload.md:96-100, 169-173) — extra cost for no gain. - The candidate models that fit are small (
google/gemma-4-E4B-it,nvidia/Qwen3.8-27B-NVFP4), which reduces per-token cost and shrinks the TTFT signal.
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)
- Cross-model generality. DeepSeek-V4.1-Flash (the PR's measured model) is on neither host.
AGENTS.md:500-503expects shared-component checks across recipes; GLM TP4 alone leaves that partially unproven. - 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. - Whether the PR's −86.3 % Long-MT TTFT figure is real. It was measured on
a7568c2c(pre-hardening) withn = 2and 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. - The formal/CPU gates (§2) are prerequisites, not hardware results. If
check.py --mutationsfails, cancel the GPU allocation. - No metric exposes the protected tier — there is no
flare_protected_checkpointscounter (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.
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):
- GLM at TP4 is the declared end-to-end-qualified recipe, Qwen at TP4 explicitly not —
docs/model-preparation.md:170-171. Supports the model substitution. - cn7 / DGX Spark GB10 is SM121 and an SM120 core fails the arch check —
docs/model-preparation.md:477-479. Supports dropping cn7 for the perf question. --prefix-cache-memorydefaults to zero, and zero with no disk/pool disables offload and omits thePrepare host prefix cachestartup phase —docs/prefix-cache-offload.md:143-150. This is exactly why the PR's A/B never exercised the host-restore path, and why the disk-tier phase is the only way to see it.flare_cache_reused_tokens_total,flare_host_cache_hits_total,flare_total_kv_pages,flare_kv_page_tokens,flare_cached_kv_pagesare all real, documented metrics —docs/api.md:336-346. The Phase-3 discriminator (GPU hit vs host restore) is sound.- The mutation-testing gate is genuinely blocking and "noting it as a limitation" is explicitly not acceptable —
docs/design-review.md:226-228, 247-251. So the CPU gate has to precede GPU allocation; the post's time estimate is sequenced that way. - The PR's measured model and
n=2, pre-hardening (a7568c2c),--prefix-cache-memory 0scope are stated in the PR's own Result section — the "numbers can't be reused" bullet is quoting the author, not accusing him.
Leads I could not verify, and how the post handles them:
- cn5 / cn7 hardware specs are not in the repo — searching the whole tree for
cn5/cn7returns nothing. The 4× RTX PRO 6000 96 GiB / 125 GiB RAM / 16 GiB scratch and GB10 10-CPU/60 GiB figures are outside environment facts. I kept them in the post because a tester standing at the rack can confirm them in seconds, but they are unconfirmed by me. - "GLM-5.3-Flash-NVFP4 is the only 4-rank-capable checkpoint on cn5" is a host-inventory claim, not a repo claim. The post softens it to "check
flare models list --jsonfirst," which is also the plan's own instruction. - Page size "128 tokens" is not stated at
docs/prefix-cache-offload.md:97(that line is about GPU codec workspace sizes, ~130 MiB/GPU on GLM TP4). Page size is runtime-sized, so the plan's pre-flightflare_kv_page_tokensread is what actually establishes it — the post doesn't repeat the 128 figure. flare_snapshot_evictions_total,flare_snapshot_capacity,flare_cached_checkpointsare missing fromdocs/api.md's metrics table. They exist inhelios/src/server/metrics.rs(not opened) (e.g.:1559) and are used bytests/server/test_cache_memory.py:84(not opened) andtests/server/test_minimax_m3_cache.py:131-137(not opened), so they're real and scrapable — but the plan's citation ofdocs/api.md:336-346for them is wrong, and their absence from the docs is an observability gap worth mentioning to the author alongside the missingflare_protected_checkpointscounter.scripts/benchmark_scheduler.py(not opened) line references (:94,:128-173,:191-198) were not confirmed; the harness itself is real and used bytests/, but the specific line numbers should be re-derived before the driver section is handed to a tester.- The
-86.3 %Long-MT TTFT figure remains unexplained against a 1.74× hit-rate gain. The post's "upper bound, not evidence" phrasing is doing real work here: a tester must not read a smaller gain as a regression.
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.