#1 [high] PR #665 mechanism map with exact citations (head a7568c2)
helios/src/cache.rs (head a7568c2):
- 84-86: new Checkpoint fields
reused: bool,reused_at_evicted_pages: u64,reused_at_evicted_nodes: u64. - 219-222: new PrefixCheckpointCache fields
evicted_pages,evicted_checkpoints(init 251-252). - 346-361 is_protected: false unless node.reused; page_turnover = evicted_pages - node.reused_at_evicted_pages; node_turnover = evicted_checkpoints - node.reused_at_evicted_nodes; protected unless (page_turnover >= self.tail_pages.max(1) && node_turnover >= self.ready_checkpoints.max(1)). Thresholds are CURRENT global counts, not the counts at reuse time.
- 363-365 eviction_key = (is_protected, retention_rank, id). Used at 732 min_by_key inside eviction_candidate_within_budget (706-734);
below/immediate/protected_token_budgetfilters untouched (712-731). - 367-374 mark_reused: copies counters, then
self.nodes.get_mut(&id).unwrap(). - 384-389 touch_hit = touch()? then mark_reused (infallible after touch).
- 466-477 duplicate-publication branch of publish_with_retention calls touch_hit(id, use_epoch) UNCONDITIONALLY (line 471).
- 478-481 inheritance: proposal.parent.is_some_and(|p| is_protected(parent) && parent_len.saturating_mul(2) >= tail_tokens); stored at 503-505.
- 601-609 retire_leaf: increments evicted_pages by node.tail_pages.len() and evicted_checkpoints by 1 ONLY if node.ready.
- 626-657 compact_ancestor: does NOT touch evicted_pages/evicted_checkpoints; does self.tail_pages += node.tail_pages.len() after uncount (630) so compaction keeps tail_pages flat.
- 756-758 evict() doc comment updated; loop 759-775 unchanged.
Scheduler call sites:
- helios/src/scheduler.rs:1727 fresh_admission = accounting.is_none(); 1734-1739 touch_hit on hit if fresh_admission else plain touch.
- scheduler.rs:1884-1887 in finish_inbound:
if matches!(result, PublishResult::Created {..}) { self.stats.snapshot_publications += 1; self.cache.touch_hit(id, ticket.demand_epoch)?; } - scheduler.rs:3101 retire() publishes terminal via publish_with_retention; 3107-3118 completion refresh stays plain
touchon id and its parent, withrefresh_recencygate. - Only other touch_hit call site: cache.rs:471.
Tests added: helios/src/cache/tests.rs:1314-1502 (4 tests). lifecycle_tests.rs:79-81 + 96-97 (fork copies new fields), :502 key() now sorts by cache.eviction_key.
#2 [high] PR #665 correctness/contracts findings (F1-F9) + sound areas
VERIFIED FINDINGS (all at head a7568c2).
F1 [Major] Protection is NOT monotonic: it can be re-granted with no new reuse hit.
helios/src/cache.rs:346-361
let page_turnover = self.evicted_pages.saturating_sub(node.reused_at_evicted_pages);
let node_turnover = self.evicted_checkpoints.saturating_sub(node.reused_at_evicted_nodes);
!(page_turnover >= self.tail_pages.max(1) as u64
&& node_turnover >= self.ready_checkpoints.max(1) as u64)
Denominators tail_pages / ready_checkpoints are CURRENT global counts (mutated in count/uncount, cache.rs:256-274) while numerators are monotonic. So once a node demotes, publishing more checkpoints raises the denominators and flips the test back to protected. Sequence: reuse at (P=0,C=0); evict 5 pages/1 node with tail_pages=4,ready=1 -> demoted; then 3 new checkpoints -> tail_pages=7,ready=4 -> node_turnover=1 < 4 -> protected again. Impact: during exactly the scan-burst the PR targets (cache refills fast), a stale reused session regains priority over the fresh scans and the eviction ORDER inverts back to the pre-PR behaviour; "ages out once evictions turn over both" (cache.rs:347-348) is false. Also the page denominator counts unready nodes' pages while only ready leaves increment the numerator (cache.rs:604-609). Fix: snapshot the thresholds at reuse time (store reused_at_tail_pages / reused_at_ready_checkpoints) and compare turnover against those, so demotion is monotonic; or make demotion sticky with an explicit demoted: bool.
F2 [Major] compact_ancestor never advances turnover, so single-child chains never age protection.
helios/src/cache.rs:626-630 fn compact_ancestor -> self.uncount(&node); self.tail_pages += node.tail_pages.len(); and no evicted_pages/evicted_checkpoints update, versus helios/src/cache.rs:601-609 retire_leaf which does. evict_checkpoint (cache.rs:745-753) picks compaction whenever the victim has exactly one child. Impact: under a single-child chain (the normal long-conversation shape the PR benchmarks: 4x127K 4-turn) eviction retires an unbounded number of snapshots while protection never ages -> the "unbounded protection livelocks on workload phase shifts" failure the PR says it prevents is reachable via an unchanged code path. Fix: count compaction turnovers too (e.g. evicted_checkpoints += 1, and evicted_pages += 0 since pages move) or age on snapshots retired rather than leaves.
F3 [Major] Every host restore is born protected; the creation path is recorded as a reuse hit.
helios/src/scheduler.rs:1884-1887
if matches!(result, PublishResult::Created { .. }) {
self.stats.snapshot_publications += 1;
self.cache.touch_hit(id, ticket.demand_epoch)?;
}
Created is the FIRST publication of that prefix on GPU, i.e. a creator, not a hit. This contradicts the PR's own invariant asserted in its test helios/src/cache/tests.rs:1337-1338 ("Creator completion recency refresh must not mark an un-reused scan as protected"). Impact: a cold scan leaf fetched from the host tier receives the highest eviction priority tier, defeating the PR's purpose whenever the host tier is enabled — and that is the one path the description admits is unmeasured (both A/B arms run --prefix-cache-memory 0). Fix: only touch here (host reuse is already counted via stats.host_hits), or set reused from whether the ticket had >1 waiter / whether the key was previously retired on GPU.
F4 [Major] Any duplicate publication is a reuse hit, including same-request republishing.
helios/src/cache.rs:466-477 (Existing branch) -> self.touch_hit(id, use_epoch)?; unconditional. Callers of publish_with_retention that can reach Existing for the SAME request: scheduler.rs:3101 (retire's terminal publication; the prompt-end Anchor often already occupies the same endpoint when few tokens were generated) and scheduler.rs:2948 (publish_boundary, re-published per boundary). retire() then ALSO does a plain touch at scheduler.rs:3107-3109. Impact: a one-shot scan that republishes its own endpoint self-promotes to protected with no second client and no cross-request reuse, inflating exactly the adversarial arm the PR targets. No test distinguishes same-request from cross-request duplicates. Fix: pass an explicit hit flag into publish_with_retention instead of inferring reuse from Existing.
F5 [Major] Documented contract reversed with no doc update and no maintainer sign-off.
docs/core-design.md:1564-1566 "Optional capture cannot displace an equal or higher retention rank. Optional Anchor and Message captures reclaim lower-rank victims strictly by demand-recency order." and docs/scheduling-runtime-design.md:644-645 "uses demand recency, checkpoint role, and endpoint length to compare eligible victims". The diff makes is_protected the FIRST sort key (cache.rs:363-365) so a reused lower-rank victim now outranks an unreused higher-rank one. #568 shipped the explicit invariant "Victim ordering remains strictly (node.retention_rank(), node.id)". AGENTS.md:204-206 requires an explicit maintainer design decision for an invariant change, and AGENTS.md:227 lists core-design.md as required guidance for cache changes. The description cites neither #568/#298/#416 nor the docs. Fix: update both design sections in this PR and record the owner decision.
F6 [Major] The lifecycle conformance key now depends on state the projection omits, so the BFS can prune live states.
helios/src/cache/lifecycle_tests.rs:498-505 ordered.sort_by_key(|node| self.cache.eviction_key(node)); while projection() (lifecycle_tests.rs:315-352) emits only completed, created, required[] and 8 per-node fields — no evicted_pages/evicted_checkpoints. Since eviction_key depends on is_protected -> evicted_*, two states differing only in those counters collide in visited.insert(next.key()) (lifecycle_tests.rs:617) and one branch is never explored. verification/helios-lifecycle/README.md:229-230 still states "The visited key includes the projection and relative retention order" and :240-241 "the model does not prove demand/role retention ranking". So "TLA+ 10/10 models, 12/12 checks passed" is not evidence for the changed ordering (also: no RetentionRank reference anywhere under verification/helios-lifecycle). Fix: add the two counters to the projection and update README.
F7 [Major] Missing runnable mutation check; description claims evidence that does not exist.
docs/design-review.md:226-228 "Run mutation testing (check.py --mutations or cargo-mutants) when adding or changing safety guards" and :247-251 "Leaving an applicable crate test, simulator sweep, TLA+ conformance run, or Kani proof unrun blocks commit and PR acceptance; noting it as a limitation does not make the omission acceptable." This PR adds a guard (is_protected demotion) and reports only check.py --jobs 4. The existing mutation target verification/helios-lifecycle/check.py:515-519 sits on let tokens = self.protected_eviction_tokens(node, rank); — the exact filter chain the new key is layered onto. Also: description claim "Selene restore touch_hit is verified by unit tests and TLA+" is false — the 4 added tests are cache-level (cache/tests.rs:1314-1502) and no test asserts reuse/protection after finish_inbound (grepped: tests.rs:2914, 3152, 3048 touch finish_inbound only for pins/pages/rank).
F8 [Minor] No observability: CacheStats (cache.rs:182-191, 880-905) and the server metrics (helios/src/server/metrics.rs:246-262, 1132, 1290) are unchanged, so no counter exposes protected victims or reuse marks. A deployment that regresses under this policy cannot see why; contrast #549 which exposes gauges.
F9 [Minor] Inheritance uses token ratio but aging uses page/node turnover, so a scan that extends a hot parent inherits protection on 33% overlap.
helios/src/cache.rs:478-481 is_protected(parent) && parent_len.saturating_mul(2) >= tail_tokens -> child born reused: true (cache.rs:503). A 640-token scan reusing a 128-token hot prefix is not protected (test cache/tests.rs:1377-1380) but one reusing 200 of 300 tokens is, even though 100 tokens are new scan content. Protection leaks from a legitimately hot root onto scan endpoints; no test covers the boundary.
SOUND (verified, no issue): the policy is O(1) per candidate with no allocation and no new lock — nodes is single-owner &mut state inside RequestScheduler, so there is no contention, head-of-line blocking, or memory amplification added. saturating_* everywhere prevents overflow. #[derive(Clone)] on PrefixCheckpointCache carries the new counters into the cache_memory.rs:337 simulation clone, so quote/apply determinism is preserved (cache_memory.rs:412-424 compares re-simulation). mark_reused's unwrap() (cache.rs:370) is provably unreachable after touch's existence check. fresh_admission = accounting.is_none() (scheduler.rs:1727) is a correct preemption/re-admission discriminator (re-admissions always carry Some: runtime.rs:1518, 2913, 2941). Mandatory eviction still terminates because protection only orders victims, never filters them (cache.rs:763), so there is no admission livelock. No wire/core-format change; exported cores still load.
#3 [high] Research summary
I completed the correctness/contracts/system-level lens over all four changed files, their callers (ensure_resources, refill_reservations, evict_checkpoint, finish_inbound, retire, quote_snapshots/apply_snapshot_quote, import's clone at cache_memory.rs:337), the tests, and both design docs. Nine findings recorded in the scratchpad, five of them Major, plus the areas I verified sound.
The three strongest defects are all in the new protection rule itself. (1) is_protected (cache.rs:346-361) divides a monotonic turnover numerator by a current denominator (tail_pages, ready_checkpoints), so protection once demoted is re-granted when the cache refills — during exactly the scan burst the PR targets — meaning the PR's own stated "ages out" behaviour is false and the eviction order can invert back to pre-PR ranking. (2) compact_ancestor (cache.rs:626-630) never advances turnover while retire_leaf (cache.rs:601-609) does, so single-child chains — the 4x127K multi-turn shape the PR benchmarks — can evict unboundedly without ever aging protection, which is the livelock the PR claims to prevent. (3) finish_inbound calls touch_hit on PublishResult::Created (scheduler.rs:1884-1887), marking a first-ever GPU creation as a reuse hit and giving cold host-tier scans top eviction priority — contradicting the invariant the PR's own test asserts at cache/tests.rs:1337-1338, on the one path the description admits is unmeasured.
On contracts: the diff reverses a guarantee #568 shipped and both design docs still state (core-design.md:1564-1566, scheduling-runtime-design.md:644-645) with no doc update and no maintainer sign-off (AGENTS.md:204-206, 227). The lifecycle conformance key key() (lifecycle_tests.rs:498-505) now sorts by state the projection omits, so the depth-10 BFS can collide/prune live states — and the README already says the model does not prove victim ranking, so the reported TLA+ pass does not evidence the change. Also missing: the --mutations run docs/design-review.md:226-251 calls blocking for a new safety guard, and the description's "Selene restore touch_hit is verified by unit tests" claim is inaccurate.
I verified as sound: zero contention/allocation/memory amplification added (single-owner &mut cache state, O(1) key), saturation arithmetic, parity of the new counters through Clone so the snapshot-quote determinism check still holds, non-emptiable mandatory eviction (so no admission livelock), the fresh_admission preemption discriminator, and the absence of any wire/core-format change.
#4 [high] PR #665 description claim quotes, evidence scope, and test-coverage gaps
Verbatim claims from the PR description (head a7568c2) that findings F3/F4/F6/F7 contradict:
-
"Call
touch_hitonly on fresh admission hits (accounting.is_none()) inRequestScheduler::admit_planned_with_checkpoint_accounting, duplicate publications (PublishResult::Existing), and host restores inRequestScheduler::finish_inbound; completiontouchinretireand preemption re-admissions refresh recency only." -> F4: "duplicate publications (PublishResult::Existing)" is not restricted to cross-request reuse; theExistingbranch (cache.rs:466-477) is reached by the same request's own re-publication at scheduler.rs:3101 (retire's terminal publish) and scheduler.rs:2948 (publish_boundary). -> F3: "host restores inRequestScheduler::finish_inbound" fires onPublishResult::Created(scheduler.rs:1884-1887), which is a first GPU creation, not a restore hit. -
"
is_protecteddemotes a reused checkpoint once evictions turn over bothtail_pages.max(1)andready_checkpoints.max(1)." -> F1: demotion is not monotonic; the thresholds are current global counts, so refilling the cache re-protects a demoted node. -
"Preserved invariants & tests: ... keep
eviction_candidates(),reclaimable_if_pinned, and retirement fences unchanged." -> True as stated, but the PR does not mention that it replaces #568's "Victim ordering remains strictly(node.retention_rank(), node.id)" invariant, nor thatdocs/core-design.md/docs/scheduling-runtime-design.mdstill assert demand-recency order (F5). -
"Selene restore
touch_hitis verified by unit tests and TLA+, not live offload." (from the Limits paragraph) -> F7: false. The 4 added tests (cache/tests.rs:1314-1502) are cache-level only; no test assertsreused/is_protectedafterfinish_inbound. Existingfinish_inboundtests assert only pins/pages/rank: scheduler/tests.rs:2914 (finish_inbound_attaches_to_an_existing_checkpoint_and_frees_the_ticket), :3152 (cancelled_inbound_waiter_leaves_ticket_resources_until_finish_inbound, asserts retention_rank at :3179-3180), :3048, :3074, boundary_tests.rs:333, checkpoint_lifecycle_tests via checkpoints.rs:3416. -
Evidence scope for F3 (why the host-restore defect is unmeasured): both A/B arms run
--prefix-cache-memory 0, so the host tier is off entirely, and the measurement is "2 cold-salted trials/arm" on a single boot, 4x RTX PRO 6000, DeepSeek-V4.1-Flash TP4, 2,606,848 KV tokens / 20,366 pages. -
Test that pins the PR's own contrary invariant (useful when arguing F3 is a self-inconsistency): helios/src/cache/tests.rs:1337-1338 comment
// Creator completion recency refresh must not mark an un-reused scan as protected.paired withcache.touch(scan, 6).unwrap();at :1338. -
Files changed: 4, all under helios/src (cache.rs +64/-4, cache/tests.rs +192, cache/lifecycle_tests.rs +6/-1, scheduler.rs +9/-1). No docs/, no verification/, no workflow edits — so no design-doc update accompanies the contract reversal in F5.
-
For F5's owner-sign-off requirement, the two governing rules quoted from AGENTS.md: :204-206 "Resolve conflicts through an explicit maintainer decision on the design before implementing a change to that invariant; a commit acknowledgment or routine PR approval is not that decision." and :227 which lists docs/core-design.md as required guidance for "Change Helios runtime, scheduling, caches".
-
Engagement state: zero comments, zero reviews, zero CI checks on head a7568c2.