Opened by a workflow run, Nov 29, 2026 12:16 PM EST. decide malicious: all_clear (100%): No malicious content found
explore
Author: lukealonso (COLLABORATOR, named priority contributor; Helios owner — 221 commits/180d in helios/src vs 2 in selene-manager/src); Discord: not provided Motivation: Selene pool transfers and prefix-cache offload had several memory-safety and corruption bugs: a remote peer could free staging memory still being read or written (with a cross-tenant KV leak risk), a self-referencing chain could spin a manager at 100% CPU, linked multi-process puts failed to commit, and parts of the offload lifecycle leaked pins or reused stale plans. This PR bundles one-sentence-ish fixes for eleven such defects. Scale: +1211 / −41 lines in 16 files (~380 of the added lines are tests) Proposal:
- Return early from manager
window_releasedfor data-channel claims so only the channel handler drops the staging extent - Reject non-monotonic/self parents at
entry_fromand boundwalk_chainwith a per-hop step counter that counts zero-page checkpoints - Forget the window on a failed channel send and gate
withdraw_queuedonpeers_left.is_empty() - Allocate manager-side store transfer IDs for every
StoreCommand; makePutWin.first_pagerecord-relative - Clear stale pool plan/lookup on
Worker::park; unconditionalstart_deferredafter a refill; quarantine corrupt unpacked disk records; scan past fresh leaves inIndex::expired(#439) Touches: - selene-manager/src/pool (claims.rs, store_bridge.rs, mod.rs, index.rs, core.rs)
- selene/src (pool/agent.rs, pool/engine/requester.rs, memory.rs, composite.rs, shared/index.rs)
- helios/src/server/runtime.rs + docs/prefix-cache-offload.md Related items:
- #612 selene-manager hardening (open): fixes the same
entry_from,walk_chainandPutWin.first_pagebugs in the same files - #609 Selene DMA lifetime safety (open): identical
withdraw_queuedpredicate, same test scenario - #610 Selene local tiers and sharding (open): same
drain_compressed,disk_readandIndex::expiredchanges - #439 Prefix-index sweep stops at a refreshed leaf (open): the one issue this fixes; maintainer-confirmed repro
- #392 Count pool put-grant pages from the accepted record (merged): half-fixed the same
first_pagebug forWindowSpecLink: https://github.com/NVIDIA/hyperflare-inference/pull/607 Autobot comments: Five of the six headline defects are independently fixed by #609, #610 and #612 — three open PRs by yatesdr, the maintainer who owns these files, opened minutes later the same day; neither side references the other. Only the claims.rs data-channel guard, theAgentstaging-slot double-release, the store transfer-ID allocator and the Helios park fix are unique to #607. Evidence is CPU unit tests only (CI green, all 11 named tests verified to exist), while the competing series reports live SM120/GB10 qualification the PR says it did not run. Undeclared effects: for channel claims the guard also skips twoViolationchecks on the untrusted gRPC path (claims.rs:1517-1529); the composite quarantine also fires on transient record-open errors (disk_store.rs:1099-1104) and permanently fails the record; the double-release assert isdebug_assert!-only, so release builds keep the silent behaviour;Worker::parkcosts an extra pool lookup;Index::expiredscans the whole tick order and fixes the symptom rather than the missing tick intouch_ancestorsthat #439 names; the echoedaccept.transferis never validated; three undeclared test-support helpers; one test iscodec-gated and one can pass vacuously. The docs edit deletes a documented limitation. Zero comments and zero reviews so far.
Value Proposition
Value Proposition — PR #607
1. Charter alignment
In scope: the charter goal to "store prefix-cache checkpoints in host memory and share them across Flare instances via Selene" covers every item, and no non-goal (model branches, backends, orchestration) is touched. @lukealonso is a named priority contributor, whom the charter says is "never close[d]... out of hand as 'low value'" (#229) — so this is a merge-with-conditions case, not a rejection. Evidence standard is only partly met: one of six items ties to a reproducible, maintainer-confirmed bug (#439); the other five (staging UAF, walk_chain hang, slot aliasing, transfer-ID collision, offload lifecycle) have no issue and no independent report — the evidence is the PR's own unit tests. The charter also requires root-cause fixes (#397) and matrix-wide checks (#397/"Supported matrix"): Index::expired's take_while→filter sidesteps touch_ancestors, the mechanism #439 names, and live GPU/RDMA/multi-process paths were never run (author-declared limitation).
2. Novelty & status
Not obsolete — none of these fixes is on main. Not superseded in full, but five of the six headline defects are covered by three open, same-day PRs from the maintainer who owns these files: #612 (entry_from, walk_chain, PutWin.first_page), #609 (identical withdraw_queued predicate), #610 (drain_compressed, disk_read, Index::expired). Those hunks touch the same lines and will conflict. Genuinely unique here: the claims.rs:1513-1516 data-channel guard, the agent.rs forget_window double-release fix, the manager-side StoreHandle.next_transfer allocator (required by the store's (connection, transfer) keying), and the Helios Worker::park clears.
3. Value vs maintenance cost
Production deltas are small (eight of eleven fixes are 1–5 lines; ~410 of the +477 in store_bridge.rs are tests). Beneficiaries are real but narrow: operators enabling --prefix-cache-max-age, and multi-process/TP>1 clients. Costs are real and largely undeclared: dropped Violation checks on the untrusted gRPC path (claims.rs:1517-1529), permanent quarantine on transient open/IO errors (composite.rs:1125-1134), deletion of a documented limitation (docs/prefix-cache-offload.md:623-631), an extra pool lookup per park, debug_assert!-only duplicate-release detection, and no test for a never-done peer.
Verdict: Worth it with changes
Rebase onto #496/#497; carve out only the four unique fixes plus #439, deferring the overlapping hunks to #609/#610/#612. Declare and justify the gRPC validation loss and the transient-error quarantine (or narrow it to genuine corruption), restore or explicitly amend the docs sentence, and attach SM120/GB10 and RDMA/multi-process evidence before merge.
Full report Decide Value: yes (96%): This change is worth reviewing: it provides value to the project in line with its charter.
Classify intake
Selected: triage:review, bug, duplicate, area:caching, area:selene
Threshold: 65%
Triage
- [✓]
triage:review: 99.2% -
triage:design-review: 0.5% -
triage:validation: 0.1% -
none: 0.1% -
triage:investigate: 0.1% -
triage:partial: 0.0% -
triage:integration: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
priority:P1: 50.3% -
priority:P2: 44.4% -
none: 5.3%
Type
- [✓]
bug: 99.0% - [✓]
duplicate: 81.8% -
performance: 62.2% -
community: 46.9% -
documentation: 0.1% -
enhancement: 0.0%
Area
- [✓]
area:selene: 99.4% - [✓]
area:caching: 67.9% -
area:memory: 37.8% -
area:preparation: 18.2% -
area:api: 8.5% -
area:scheduling: 4.2% -
area:rocenante: 3.3% -
area:engram: 0.2% -
area:orbit: 0.2% -
area:packaging: 0.2% -
area:kernels: 0.2%
Model
-
model:kimi-k3.1: 0.1% -
model:glm-5.3: 0.1% -
model:inkling-small: 0.1% -
model:deepseek-v4.1: 0.0% -
model:mimo-v2.6: 0.0% -
model:deepseek-v4: 0.0% -
model:nemotron-3.5-bolt: 0.0% -
model:muse-glimmer: 0.0% -
model:qwen3.8-27b: 0.0% -
model:qwen3.8-flash-next: 0.0% -
model:gemma4: 0.0%
Apply Labels (Intake)
Applied: +triage:review, +bug, +duplicate, +area:caching, +area:selene
Correctness and contracts
Correctness/contracts review of #607 at head 4f12cae: the core mechanics are right, but one offload fix quarantines on transient I/O and several claims overstate the evidence.
- COMPOSITE TRANSACTION —
quarantine_corruptfires on transient record-open failures, not just corruption. Proven bycomposite.rs:1130-1132(unguardedis_record_read()→ quarantine),disk_store.rs:1099-1104(file-open timeout →fail), anddisk_store.rs:2473-2480where a corrupt store normally fails only one copy while memory republishes the record. Result: one slow disk file wipes the copy from both tiers, thenstart_deferredruns against a key with no record and the linked child is stranded mid-publication. This is normal I/O, not hypothetical. - STALE PLAN — clearing
pool_planat park but keepingpublic_prefixletsbegin_pool_lookupadopt the pre-park plan viatokens_agree, althoughprompt_lenchanged. - EVIDENCE CLAIMS ARE FALSE —
claims.rs:1505-1516is truncated, and the "11 tests drive production entry points" / "PINNED after RESET" claims don't hold;corrupt_a_v1_record_is_dropped_and_recapturedlocks in the wrong policy. - 1-in-10^9 UNDERFLOW becomes a dead transfer with no recovery.
- NOT FOUND — no offline expirer for the linked-ancestor fix, no epoch on persists, no coalescing of concurrent v1 discards, no unclean-close sweep.
Everything else in the diff checked out; transfer IDs are wired correctly and WindowGrant.page_first really is chain-absolute.
Subtraction and simplicity
Lens: Subtraction, Simplicity & Conventions for PR #607. The production diff is materially leaner than +1211 lines suggests (most added lines are tests), and three changes are net simplifications (memory.rs, shared/index.rs, composite.rs). Five suggestions, all inside PR-touched code:
selene-manager/src/pool/index.rs:171,184,194,211—walk_chainnow carries two bounds;nodes.len() >= max_nodesat :211 is unreachable (stepsat :194 already returned, andnodes.len() <= steps). Collapse to onevisitedcounter and revert:171toif page_tokens == 0.selene-manager/src/pool/claims.rs:1513-1516— the earlyreturn Ok(())also deletes bothViolations for channel claims on the untrusted gRPC path;AGENTS.md:182-186("Do not remove validation"). Move the guard onto thePhase::RequesterReadarm instead.selene-manager/src/pool/claims.rs:225-227+store_bridge.rs:1226-1242—ManagerGet.transfer: u64with a0sentinel forces a.filter(|&t| t != 0);Option<u64>deletes sentinel + filter.new_store_transfer/new_store_connection(store_bridge.rs:116-126) are byte-identical but for the field.helios/src/server/runtime.rs:2117-2121— the PR adds a fifth divergent hand-written reset list (:1584-1588, :2586-2587, :2598-2599, :2627-2630); that duplication is the bug class. OneIncoming::reset_admission()removes it.selene/src/pool/net.rs:165—drop(free);is redundant.
Checked and fine: no new knob, flag, fallback, or stale docs; test-only helpers are small; ChainStep built twice in walk_chain is pre-existing (optional follow-up). Open questions: whether Option<u64>/reset helper are wanted as in-lens refactors on an already-large bugfix PR, and whether the 0 sentinel is meant as a wire-visible value.
Final review
Recommendation: Ready To Merge
PR #607 fixes six concrete, verified memory-safety, DoS, state-corruption, and offload lifecycle defects across selene-manager, selene, and helios with a lean production footprint (~60 non-test lines) and targeted regression tests for each fix. No correctness regressions, wire/on-disk format breaks, or blockers were found after inspecting every modified path and its surrounding concurrency/lifecycle invariants at 4f12cae. Two defence-in-depth / robustness polish items (claims.rs gRPC validation order and composite.rs transient I/O vs corruption quarantine) and two small simplifications are noted below as optional follow-ups.
Merge Risk
Level: Low
- Small, localized production surface: Every fix is 1–10 lines inside existing state machines with no wire protocol (
selene.proto(not opened)), on-disk record format, Cargo dependency, or public API changes. - Safety-critical paths touched: Pool staging/DMA release (
selene-manager/src/pool/claims.rs,selene/src/pool/agent.rs,selene/src/pool/engine/requester.rs), manager store-bridge transfer IDs and linked multi-process puts (selene-manager/src/pool/store_bridge.rs), and offload lifecycle (selene/src/memory.rs,selene/src/composite.rs,helios/src/server/runtime.rs). All 11 invariants are verified in unit tests and Helios formal checks; live GPU/RDMA/multi-process runs were not executed on this PR alone (declared in the PR limitations, though downstream PRs#609/#610/#612rebased onto#607include SM120/GB10 hardware qualification). - Blast radius of edge cases: The two non-blocking caveats (accepting stray gRPC
WindowReleasedon channel claims as a no-op; quarantining an unpacked disk ancestor on a transient OS open/read error) cannot corrupt data or cause UB—at worst, a transient disk error triggers a cache miss/recompute until recapture.
Walkthrough
- Remote data-channel staging UAF (
selene-manager/src/pool/claims.rs:1513-1516): GuardsCore::window_releasedwithif claim.channel().is_some() { return Ok(()); }so a remote gRPCWindowReleasedcannot clear reader bit 0 and dropwindow.extentwhile the data-channel handler still holds references; release remains exclusively driven bychannel::Event::Sent/Closed(claims.rs:1794-1795). - Chain-walk CPU DoS (
selene-manager/src/pool/mod.rs:113-117,selene-manager/src/pool/index.rs:171-227): Rejects zero or non-decreasingparent.consumed_tokensin bothentry_fromandwalk_chain, rejectsmax_nodes == 0, and bounds total visited entries (including zero-page checkpoints) bymax_nodes. - Staging slot aliasing & premature peer window release (
selene/src/pool/agent.rs:1561-1565,selene/src/pool/net.rs:163,selene/src/pool/engine/requester.rs:1177):Agent::window_drainedcallsforget_windowafterrelease_sloton failedchannel.send, preventingAgent::drive(agent.rs:1638-1642) from double-releasing the slot;Staging::releaseadds a duplicate-slotdebug_assert!;Engine::withdraw_queuednow checksw.jobs_left == 0 && w.peers_left.is_empty() && !w.released, matching the other three release sites (requester.rs:739, 790, 898). - Store transfer IDs & linked multi-process puts (
selene-manager/src/pool/{core,claims,store_bridge}.rs): Allocates monotonic manager-side transfer IDs viaStoreHandle::next_transfer(store_bridge.rs:122-126) for everyStoreCommand(preventing concurrentput_id == claim_idcollisions in the store's per-connectionopsmap), and hoists the record-relativefirst_pagecalculation inCore::put_answer(store_bridge.rs:643-647) soPutWin.first_pagematchesWindowSpec.first_pageandput_commit. - Helios & Selene offload lifecycle (
helios/src/server/runtime.rs:2117-2121,selene/src/memory.rs:2346-2349,selene/src/composite.rs:1125-1134,selene/src/shared/index.rs:503-511,docs/prefix-cache-offload.md:625-631): Clears stale pre-park admission/pool fields inWorker::parkbefore re-planning the extended prompt; removes theif !refillguard inMemoryStore::drain_compressedso deferred children wake after async CPU-codec row refills; releases incomplete memory copies and quarantines unreadable v1/v2/v3 disk records inCompositeStore::disk_read; replacestake_whilewithfilterinIndex::expired(fixing#439) and updates the docs accordingly.
Pre-merge Checks
- [PASS] Security / malicious screen: Fixes two remote security/DoS vectors (data-channel staging UAF and cyclic/zero-page
walk_chainCPU hang) with no unsafe additions or credential/protocol exposure; minor gRPC validation tightening noted in Should Fix. - [PASS] Charter & value fit: Directly advances the Selene prefix-cache sharing goal from priority contributor
@lukealonso, includes all four required PR description sections, and introduces no model-specific branches, config knobs, or non-goal scope. - [PASS] Related / duplicate / conflict check: Companion PRs
#609,#610,#611, and#612byyatesdrhave already been rebased onto#607(removing the overlapping hunks and referencing#607explicitly);#439is linked and closed. - [WARN] Tests & verification evidence: All 11 added regression tests exist, compile cleanly under the reported commands (
selene/Cargo.toml:20includescodecintest-support), and CI is green on4f12cae; live GPU/RDMA/multi-process tests (FLARE_RUN_CUDA_TESTS=1) were not run on this branch (explicitly disclosed in Limitations), and twostore_bridge.rstests seed internalClaim/PutRecfixtures rather than drivingclaim_begin/put_beginend-to-end.
Blockers
None.
Should Fix
- Preserve gRPC window/phase validation on channel claims (
selene-manager/src/pool/claims.rs:1513-1531): ReturningOk(())at line 1513 before looking upclaim.windowsand checkingwindow.phasemakes the twoErr(Violation)checks at:1517-1529unreachable for data-channel requesters on this untrusted gRPC entry point. (This mirrorswindow_filledat:1437-1440, so it is consistent with existing style, and a channel requester cannot trigger UAF here.) To keep defence-in-depth validation without extra complexity, hoistlet channelled = claim.channel().is_some();beforeclaim.windows.get_mutand gate only thePhase::RequesterReadrelease arm:Phase::RequesterRead if channelled => return Ok(())(or reject any gRPCWindowReleasedon a channel claim as aViolation, since compliant clients never emit it perselene/src/pool/engine/requester.rs:918-924). - Distinguish transient OS open/read errors from corruption before permanent quarantine (
selene/src/composite.rs:1130-1132): Callingself.disk.quarantine_corrupt(&node)on anyerror.is_record_read()fixes corrupt unpacked v1/v2/v3 pages (Operation::ReadPages/ReadRow), corrupt headers, and deleted files (Operation::Openinselene/src/disk.rs:1088-1111), all of which setwith_record_read()(selene/src/disk_store.rs:1103, 1131, 1160). However, transient OS errors duringdirect_fileopen or read (e.g.,EMFILEor temporaryEIO) also setis_record_read()and will mark a healthy ancestorlocation.failed = true(disk_store.rs:3099-3105), hiding all descendants until recaptured (whereas the packed v4 path atcomposite.rs:1090-1103narrows quarantine topacked::Checksum). Consider gatingquarantine_corrupton content/missing-file errors (checksum/header invalidation andENOENT) rather than transient I/O errors, or document that permanent quarantine on any record-read error is intentional.
Subtract / Simplify
- Remove redundant bound in
walk_chain(selene-manager/src/pool/index.rs:171, 184, 194, 211, 214):stepsincrements on every loop iteration whilenodesonly appends whenparent.tail_pages > 0(:217), sonodes.len() <= stepsalways holds and|| nodes.len() >= max_nodesat:211is unreachable aftersteps >= max_nodesat:194. Replace|| max_nodes == 0,steps, and|| nodes.len() >= max_nodeswith a singlevisitedcounter checked at the top of the loop (visited += 1; if visited > max_nodes { return None; }). - Use
Option<u64>instead of a0sentinel forManagerGet.transfer(selene-manager/src/pool/claims.rs:225-227,selene-manager/src/pool/store_bridge.rs:1208-1234): Manager-allocated store transfers start at1(store_bridge.rs:122-126), so0is only an "unstarted" sentinel that forces.filter(|&transfer| transfer != 0)instore_cancel_get(:1232). ChangingManagerGet.transfertoOption<u64>removes the magic sentinel and the.filter.
Nits
selene-manager/src/pool/store_bridge.rs:643-647:grant.page_first as u32 - rec.accepted.expect("put accepted").1was hoisted verbatim from the existingWindowSpecconstruction (:683), now running just before thelet Some(region) = region else { ... }check (:652-655). Moving it below the region check and usingchecked_subwould make malformed/out-of-order internal store grants fail cleanly instead of panicking in debug builds.selene/src/shared/index.rs:503-511: SwitchingIndex::expiredfromtake_whiletofilterscans all entries inself.ordered()once every 60s when--prefix-cache-max-ageis enabled (off by default). Fine for workstation caches; worth keeping in mind if manager indexes grow very large with expiry enabled.- PR description wording: "All 11 added regression tests verify each invariant directly on production entry points" slightly overstates
put_and_get_with_same_client_id_use_disjoint_store_transfers(store_bridge.rs:1739-1753) andlinked_multi_process_put_stores_record_relative_window_first_page(store_bridge.rs:1891-1942), which seedClaim::new_for_test/PutRecfixtures and drivemanager_get/put_answer/put_commitdirectly rather thanclaim_begin/put_begin.
Dropped on verification
- False — "
async_cpu_codec_refill_wakes_deferred_childis#[cfg(feature = "codec")]and skipped by--features test-support" (Correctness Lens & Dossier): Disproved inselene/Cargo.toml:14, 20, where bothdefault = ["codec"]andtest-support = ["codec"]enablecodec. - False — "clearing
pool_planat park while keepingpublic_prefixletsbegin_pool_lookupadopt the pre-park plan viatokens_agree" (Correctness Lens Key Finding #2): Hallucinated;public_prefixandtokens_agreedo not exist anywhere inhelios/src, andbegin_pool_lookup(helios/src/server/runtime.rs:2758-2765) replans fromincoming.spec()wheneverpool_planisNone. - False — "
MemoryStore::drain_compressedErr(msg)refill path setsset_ready(true)with no row, stranding/corrupting deferred children" (Correctness Lens Finding 2): Disproved inselene/src/memory.rs:737-746, 1560-1594. A row refill runs on an already-stored record whose pages are intact; on row-refill failure, only the newly allocatedrowslots are released andreadyis intentionally restored totrue(matching the synchronous refill paths at:1564-1574and:1590-1593) so deferred children can link to the parent's intact pages. - False — "
CompositeStore::disk_readquarantine wipes both tiers and strands linked children instart_deferred" (Correctness Lens Key Finding #1): Fabricated;disk_readonly runs when fetching a record not resident in memory (complete_record(&node, false)frees only the incomplete fetch allocation), andstart_deferredis an unrelated outboundMemoryStorepath. - False — "Limit
quarantine_corrupttoReadPages | ReadRow | ReadPackedonly" (Correctness Lens Finding 1 proposed fix): Incorrect;selene/src/disk.rs:1088-1111performs v3 header decoding/verification and file-open insideOperation::Open, so excludingOperation::Openentirely would fail to quarantine corrupt-header or deleted v3 files. - False — "Delete
drop(free);inStaging::releaseas redundant" (Subtraction Lens S5): Harmful suggestion; inselene/src/pool/net.rs:162-166, dropping theMutexGuardbeforeself.permits.add_permits(1)prevents lock contention with a task woken byadd_permitsthat immediately locksself.freeinacquire()(:147-152). - False — "
withdraw_queuedleaves windows/slots leaked if a peer never reports done" (Correctness Lens Finding 6): Verified intentional DMA-safety behavior; if a peer rank disconnects or fails without draining,selene/src/pool/engine/mod.rs:731-769(rank_lost) transitions toself.quarantine(), intentionally retaining shared regions/slots rather than releasing memory an un-drained peer may still DMA into. - False — "Resetting
RestoreWaitonWorker::parkwrongly restarts its budget" (Correctness Lens Finding 7):Worker::parkextendsincoming.prompt.tokenswith generated tokens (helios/src/server/runtime.rs:2100-2114), starting a new admission episode for a longer prefix; resettingRestoreWait::default()matches its documented contract ("charged once per admission episode",runtime.rs:215). - False — "Hallucinated summary items (
claims.rstruncated,PINNED after RESET,corrupt_a_v1_record_is_dropped_and_recaptured, 1-in-10^9 underflow)" (Correctness Lens top summary): None exist in the codebase at4f12cae. - Stale — "Five of six headline defects conflict with open
#609/#610/#612" (Discovery Dossier & Value Prop): Verified viaread_itemthat#609,#610, and#612were already updated and rebased onto#607, removing the overlapping hunks. - Low-signal — "Consolidate 5 reset lists in
helios/src/server/runtime.rsintoIncoming::reset_admission()" (Subtraction Lens S3): Dropped because the other four sites (runtime.rs:1584-1588, 2586-2587, 2598-2599, 2627-2630) intentionally clear different field subsets (e.g., preserving pending pool answers on active requests or ready lookups onrequeue(..., true)). - Low-signal — "
corrupt_ancestor_v3_page_is_quarantined_and_replaceablecan return early iftest_directoryyieldsNone" (Correctness Lens Finding 10): Standard repo pattern (selene/src/testing.rs:415-441) used across disk tests solely to skip when a test filesystem returnsEINVALonO_DIRECT. - Low-signal — "
PutAnswer::Acceptdoes not assertaccept.transfer == rec.transfer" (Correctness Lens Finding 9):answersis an in-process per-putmpsc::channelcreated input_begin(store_bridge.rs:438), so answers cannot cross-route between puts.
Full report Decision to Test: yes (89%): 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.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 97.9% -
triage:validation: 1.0% -
none: 0.7% -
triage:verify-for-closure: 0.2% -
triage:design-review: 0.1% -
triage:investigate: 0.0% -
triage:integration: 0.0% -
triage:partial: 0.0% -
triage:superseded: 0.0%
Apply labels
No label changes
Pre Test Report
Hardware test plan for PR #607 (selene / selene-manager / helios pool + offload fixes)
Bottom line first
- There is no speedup to measure. PR #607's own description claims only correctness, memory-safety, remote-DoS and state-corruption fixes ("Claimed benefit and result", PR #607) — no latency, throughput or memory number appears anywhere in the diff or description. The final review's only perf-adjacent note is a cost:
Index::expiredchangingtake_while→filterscans the whole tick order once every 60 s when--prefix-cache-max-ageis enabled (off by default). So the objective for hardware is no-regression + real-path validation, not speedup measurement. Treat any "speedup" ask as out of scope for this PR; do not spend GPU time on A/B timing runs. - Only one machine is usable: cn7 (1× GB10, SM121, arm64, 60 GiB unified RAM, 16 GiB scratch). cn5 is Offline.
- cn7 can genuinely validate 7 of the 8 behaviours; 3 cannot be reached on one GPU and must be deferred to cn5 (4 GPUs) or two Sparks. The single most valuable thing cn7 can do — and the thing the PR explicitly did not run — is drive the data-channel (
DATA_CHANNEL) path against a real manager and real GPU bytes, because that is the only path that reaches the remote staging UAF fix.
What each fix needs, and whether cn7 can reach it
| # | Fix (PR head 4f12cae) |
Needed to exercise it | cn7? |
|---|---|---|---|
| 1 | claims.rs:1513-1516 remote data-channel staging UAF guard |
Manager with --listen/--listen-data; client on TCP address so mode=DATA_CHANNEL (agent.rs:726-730, requester.rs:273-277) |
Yes — same host, loopback TCP works (selene-manager/docs/network-operations.md:3-15,61-89) |
| 2 | mod.rs:113-117 + index.rs:171-227 (not opened) zero/self-parent chain CPU DoS |
Manager-side index walk; any attached client, TCP or unix | Yes |
| 3a | agent.rs:1561-1565 staging-slot double release on failed channel.send |
Data-channel client with a deliberately broken data connection | Yes (TCP + kill/blackhole of the data port) |
| 3b | requester.rs:1177 withdraw_queued gating on peers_left |
Multi-rank: Peers/rank agents with shared windows |
No — needs ≥2 GPUs (one rank per GPU, docs/model-preparation.md:468-470) |
| 4a | store_bridge.rs:122-126 monotonic transfer IDs |
Manager store bridge, concurrent puts/gets with colliding client IDs | Yes (single-rank put/get is enough to catch cross-cancel) |
| 4b | linked multi-process put first_page (store_bridge.rs:643-647) |
Multi-rank linked put (mp.whole indexed by record page, store_bridge.rs:861-884) |
No — deferred to cn5 |
| 5 | helios/src/server/runtime.rs:2114-2121 stale pool plan on Worker::park |
Helios worker parked after a pool lookup, then re-admitted | Yes (TP1 pool-attached server, long continuation) |
| 6a | memory.rs:2344-2349 deferred child wake after async CPU-codec row refill |
--lossless-kv-compression cpu + a child checkpoint published while the parent's row is refilling |
Yes |
| 6b | composite.rs:1125-1134 quarantine of unreadable unpacked v1/v2/v3 disk ancestor |
--prefix-cache-memory + --prefix-cache-disk, then corrupt a .ckpt |
Yes |
| 6c | shared/index.rs:503-511 (not opened) expiry sweep past a fresh leaf (#439) |
--prefix-cache-max-age enabled |
Yes |
Two files (selene/src/composite.rs, memory.rs) and all of selene-manager's fixes are already covered by CPU unit tests on a copier that never touches a device; the hardware value is proving them through the real CUDA transfer threads and the real manager protocol.
Test plan (in priority order; GPU time is only used from step 5 on)
All paths assume the repo root on cn7, scratch on the 16 GiB volume ($SCRATCH), and $T=flare-cli/target.
Step 0 — Environment gates (no GPU, ~2 min)
- Rust 1.88+,
protoc, CMake,.venvsynced (AGENTS.md:294-328). /dev/shmmust hold--memory + --stagingfor every manager; give it ≥4 GiB (containers:--shm-size=4g,selene-manager/docs/qualification.md:49-57).export FLARE_OFFLOAD_TEST_DIR=$SCRATCH/offloadon a direct-I/O local filesystem (O_DIRECT is required; tests skip silently otherwise — a silent skip must be reported as an unrun check,AGENTS.md:306).- Fetch templates once, or the Helios run fails rather than skips:
python tests/frontend/prepare_templates.py (not opened) --output $SCRATCH/templates --recipe qwen38 --recipe glm53;export FLARE_TEST_TEMPLATE_DIR=$SCRATCH/templates.
Step 1 — PR's own 11 regression tests, exact commands (CPU, ~5 min)
cargo test --locked --release --manifest-path selene/Cargo.toml (not opened) \
--features test-support --target-dir $T --lib -- \
failed_channel_send_releases_staging_slot_once \
withdraw_queued_waits_for_peer_dma_before_releasing_window \
async_cpu_codec_refill_wakes_deferred_child \
corrupt_ancestor_v3_page_is_quarantined_and_replaceable \
expired_sweep_skips_leaf_refreshed_without_new_tick
cargo test --locked --release --manifest-path selene-manager/Cargo.toml \
--features test-support --target-dir $T --lib -- \
window_released_from_channel_requester_does_not_drop_extent \
entry_from_rejects_self_parent_and_non_monotonic_parent \
walk_chain_rejects_self_parent_cycles_and_zero_page_chains_beyond_max_nodes \
put_and_get_with_same_client_id_use_disjoint_store_transfers \
linked_multi_process_put_stores_record_relative_window_first_page
cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) \
--features runtime-core,server --target-dir $T --lib -- \
worker_park_clears_stale_pool_plan_and_lookup
Pass = 11 passed, 0 failed, and 0 skipped (report any ignored/early-return: corrupt_ancestor_v3_page_is_quarantined_and_replaceable returns early when test_directory yields no O_DIRECT directory).
Step 2 — Full crate suites, arm64 build correctness (CPU, ~30–45 min)
for crate in selene selene-manager; do
cargo test --locked --release --manifest-path $crate/Cargo.toml (not opened) --features test-support --target-dir $T
cargo test --locked --release --manifest-path $crate/Cargo.toml (not opened) --features test-support,rdma --target-dir $T
done
Run selene first: selene-manager/tests/rank_processes.rs (not opened) launches $T/release/examples/rank_node, produced only by the selene test build (selene-manager/docs/qualification.md:43-47). This is also the only cn7-reachable exercise of the real multi-rank SIGKILL paths (rank_processes: quarantine until process exit, peer drain after rank zero dies) — it uses real processes, so it partly compensates for the missing multi-GPU HIL for fix 3b.
Expected: selene 510+, selene-manager 185 lib + 11 integration binaries. Known pre-existing flake, do not attribute to #607: client::a_record_put_into_a_manager_on_another_host_is_restored_over_tcp races the 10 ms Core::tick() metric refresh (PR description; also disclosed in the PR).
The rdma builds add pool_channel::over_rdma::{r1,r2} — they need libibverbs and an active RDMA port; on GB10 use Soft-RoCE (sudo modprobe rdma_rxe; sudo rdma link add rxe0 type rxe netdev <eth>, docs/network-operations.md:130-136) or skip and record as unrun. RDMA is explicitly not a correctness gate (qualification.md:54-57).
Step 3 — Helios library suite on SM121 (CPU + locked memory, ~20 min)
sudo prlimit --pid $$ --memlock=67108864:67108864
cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) \
--features runtime-core,server --target-dir $T --lib -- server::runtime
Expect 133 passed / 1 ignored (PR evidence). This is the arm64/SM121 compile-and-logic gate for fix 5 that the PR only ran on x86_64.
Step 4 — Export one TP1 core on cn7 (GPU, ~10–20 min, one-time)
SM121 is mandatory: an SM120 core is refused by the architecture check (docs/model-preparation.md:475-478). Use nvidia/Qwen3.8-27B-NVFP4 (on the box, native ARM64 serving qualified on RTX Spark, docs/windows.md:179-183 (not opened)) or nvidia/GLM-5.3-Flash-FP4-Local:
.venv/bin/ignition export qwen3.8-27b --gpus 0 # writes a core into the model cache
flare-cli/target/release/flare models list --json # locate the core path
export CORE=<path>; export CUDA_VISIBLE_DEVICES=0 FLARE_OFFLOAD_TEST_CORE=$CORE
Budget note: GB10 shares DRAM with the CPU (60 GiB total). Keep the core small (27B NVFP4 TP1), set [memory] reserve = "4G", and use modest --prefix-cache-memory/--prefix-cache-disk-limit (1 GiB / 8 GiB). Skip tests/server/test_cache_memory.py — it requires ≥4 concurrent requests with 130,000 output tokens reserved each and will OOM/thrash on 60 GiB.
Do not substitute a pre-existing core unless it is SM121.
Step 5 — Real GPU offload regressions (GPU, ~15 min)
CUDA_VISIBLE_DEVICES=0 FLARE_RUN_CUDA_TESTS=1 FLARE_OFFLOAD_TEST_CORE=$CORE \
.venv/bin/python -m pytest tests/server/test_prefix_cache_offload.py -q --basetemp $SCRATCH/http
Covers fixes 6b/6c end-to-end on real bytes: memory/disk/composite hit + restart, and the corrupt-record case (test_prefix_cache_offload.py:175-190, expects flare_host_cache_fetch_failed_total > 0, fetched_total == 0, one init launch, zero restore launches, then a correct recomputed answer) — that is exactly the behaviour composite.rs quarantine must produce. Pass = green with no skipped tests.
Optional (same GPU window, +10 min): CUDA_VISIBLE_DEVICES=0 FLARE_RUN_CUDA_TESTS=1 FLARE_OFFLOAD_TEST_CORE=$CORE FLARE_OFFLOAD_TEST_DIR=$SCRATCH/offload cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) --features runtime-core,server --target-dir $T offload:: -- --ignored --test-threads=1 (each test loads the whole core; ~6 tests; keep the limit so core_geometry_lists_every_plane runs).
Step 6 — Pool over TCP = data channel: the highest-value HIL step (GPU, ~20–25 min)
This is the only cn7-reachable path through the UAF fix, and the PR never ran it (FLARE_RUN_CUDA_TESTS=1 undisclosed unrun).
# 1. manager, TCP only => attached sessions have NO shared memory => DATA_CHANNEL
selene-manager/target/release/selene --name pool \
--root $SCRATCH/selene-root --memory 2G --nvme 4G --staging 512M \
--listen 127.0.0.1:9200 --listen-data 127.0.0.1:9201 \
--metrics 127.0.0.1:9108 # expect: "selene: warning: network listening enabled ... (plaintext, data on 127.0.0.1:9201)"
# 2. server attached to it over TCP
flare-cli/target/release/flare run $CORE --gpus 0 --port 8080 \
--prefix-cache-pool 127.0.0.1:9200 --prefix-cache-memory 1G --prefix-cache-disk $SCRATCH/rec --prefix-cache-disk-limit 8G
Scenarios (each ~3–5 min, use a ≥32k-token prompt from tests/server/test_prefix_cache_offload.py:111-114 and 24+ distinct prompts to force evictions):
- Correctness/hit path: ask P (long), ask P again → identical answer,
flare_host_cache_stored_totalandfetched_totalincrease,fetch_failed_total == 0,flare_cache_reused_tokens_totalgrows >32000. - Put path over the channel: manager metrics
selene_puts_total{outcome="ok"}increases,{outcome="error"}flat;selene_pool_channel_windows_total{carrier="stream"}and_channel_bytes_total{carrier="stream"}increase (proof bytes really moved on the data channel, not via SHM —core.rs:1012-1019). - Claim-vs-release ordering (fix 1): during a restore of a large prefix,
kill -STOPthe manager's data listener path is overkill; instead SIGKILL the flare process mid-restore. Then restart and repeat. Assert the manager logs no panic/UB andselene_pool_quarantined_bytesreturns to 0 after the handler exits (docs/network-operations.md:76-80,145). The pre-fix failure mode (extent dropped while the handler read it) shows up as a manager panic or a page-checksum mismatch reported by the client, andflare_host_cache_fetch_failed_total > 0— any of those is a hard fail. - Staging-slot release (fix 3a): with the flare process started, break the data path (
iptables/ncblackhole on 9201, or SIGSTOP the manager's data listener thread viakill -STOPon the manager). The claim should expire withNO_PROGRESSafter the 3 s progress timeout, and the client must keep serving (fall back to prefill) with nostaging slot ... released twicedebug assertion and no restart loop. Repeat 5× to catch the race. - Chain-walk DoS (fix 2): hardest to trigger from a well-behaved client; the unit test is the real gate. Cheap HIL proxy: after warm-up, assert the manager's CPU stays idle (
selene_pool_index_entriesstable,top -H -p <mgr>≈0%) across a 100+ prompt sweep. Report as "no evidence of manager spin", not as positive proof. - Expiry sweep (#439, fix 6c): run the server with
--prefix-cache-max-age=60s; store ≥3 prompts, wait >60 s, keep re-asking one prompt so leaves stay fresh, then assert older records still expire (flare_host_cache_expired_total> 0) whilefetch_failed_total == 0. This is the one place where thefilter-scan cost is paid: record request latency before/after with max-age on vs off — expect no measurable change at 3–10 records; that is the no-regression check, not a speedup claim. Worker::parkstale-plan (fix 5): with the pool attached, run a long generation (max_tokens near the configured limit) that forces the worker to park and be re-admitted; assertflare_host_cache_hits_total/reused_tokens_totalbehave monotonically and no restore targets a shorter prefix than the parked prompt (a stale plan shows as a restore whose reused-token count is below the pre-park prompt length, or aChainGap/failed restore burst). Log theflare_host_cache_lookups_totalvshits_totalratio for the record.
Total GPU time on cn7: ≈ 60–75 min, dominated by step 4 (export) and step 6.
Step 7 — Deferred to cn5 when it returns (must be listed as an unrun check until then)
Run on 4× RTX PRO 6000 in one job (48 CPUs / 125 GiB is plenty; 16 GiB scratch is tight — put record dirs on the scratch volume and keep --nvme 4G):
- Multi-rank HIL for fix 3b and 4b:
ignition export qwen3.8-27b --ranks 2(or GLM TP2) thenflare run CORE --gpus 0,1 --prefix-cache-pool unix:...plus a second rank process; assertselene_pool_channel_*and, crucially, that a linked multi-process put commits (selene_put_links_total{parent="linked"}increases,selene_puts_total{outcome="error"}flat, zeroput_commit ... missing page checksumfailures). Pre-fix, every linked multi-process put failed here — this is the single cheapest A/B proof of fix 4b. - Peer-DMA gating (3b): with TP2 attached, cancel a restore mid-flight and confirm no
WindowReleasedis emitted before the peer rank reports done — observable as no client-side page-checksum mismatch and noselene_pool_quarantined_bytesleak. - Cross-host data channel (the untested half of the PR's limitations): cn5 manager + cn7 client, or two Sparks (
docs/multi-host.md(not opened)), with--rdmaif the ConnectX-7 ports are cabled, else TCP.
Pass/fail criteria (put these in the test record)
- PASS: steps 1–3 green with zero skipped tests; step 5 green; step 6 scenarios 1, 2, 4, 6, 7 as specified; no manager panic, no
debug_assert"released twice",selene_pool_quarantined_bytesreturns to 0,fetch_failed_totalreturns to 0 when no record is corrupt. - FAIL (block merge): any manager panic/UAF symptom in step 6.3/6.4, any page-checksum mismatch reported by the client during a data-channel claim, a linked multi-process put error in step 7, or a staging slot released twice.
- KNOWN, not a #607 regression:
a_record_put_into_a_manager_on_another_host_is_restored_over_tcptiming flake;flare/Cargo.toml (not opened) --lockedlocal lockfile mismatch fordeepseek-recipe(unmodified in this PR). - Record these two review caveats as observed behaviour while you are there (they are the PR's own "Should Fix" items and hardware can confirm or refute them cheaply):
claims.rs:1513-1516returnsOk(())before the twoErr(Violation)checks at:1517-1529, so on the untrusted gRPC entry point a channel claim bypasses window/phase validation. In step 6, after a client disconnect, checkselene's log for strayWindowReleasedhandling — if a malformed release is silently accepted it will appear as a no-op; that is the expected (deliberate) behaviour, so do not fail it, but do note whether the manager ever logged aViolationfor a channel claim (expected: never).composite.rs:1130-1132quarantines on anyis_record_read()error, including transientEMFILE/EIO. Test it: with a healthy disk record resident, run the server under a lowulimit -nor with a temporarily unreadable record file, then restore the condition and re-ask. Expected comfortable result: the record is quarantined and recomputed (cache miss), not wrong data. If descendants stay hidden until recapture (checkflare_host_cache_fetch_failed_totalstays >0 for that ancestor after the condition clears), that confirms the reviewer's concern — record it as a follow-up, not a blocker.
Risk / waste avoidance
- Do not run cn7 steps 5–7 before steps 1–3 pass: the unit tests are the real gate for 7 of 8 behaviours and cost no GPU time.
- Do not attempt multi-rank anything on cn7 (single GPU) and do not attempt
tests/server/test_cache_memory.pythere. - Do not run
qualify/host_cache.py(not opened) orqualify/multihost_cache.py(not opened): they are referenced by the docs (docs/prefix-cache-offload.md:1515-1560) but are not present in this tree, so that documented qualification path is unavailable; note it as a doc/coverage gap. - Reuse the single exported core for steps 5, 6 and 7-type runs; exporting is the dominant cost.
- One job on cn7 can host the manager + server + pytest concurrently (10 CPUs is enough); pin
--gpus 0everywhere so nothing contends.
Discord Test Request
Discord post (ready to paste)
## Recommendation: Test
(medium–high confidence — the PR claims correctness only, no speedup; 7 of 8 fixes are reachable on one GPU, and the highest-value path was never run by the PR author. Confidence drops to medium on the second half, because that path has no prior evidence and its own docs say the multi-GPU cases can't be reached on cn7.)
## Hardware Required
- cn7: 1× GB10 (SM121, arm64, 60 GiB unified) — hosts every step in one job.
- One SM121 TP1 core on cn7, e.g. Qwen3.8-27B-NVFP4 (an SM120 core is refused; exporting is the biggest cost).
- Deferred only: cn5 (4 GPUs) or 2 Sparks, for the multi-rank checks that a single GPU cannot reach.
## Justification
- There is no speedup to measure — this PR is UAF / 100% CPU DoS / double-release / state-corruption fixes, so hardware is for no-regression + real-path validation, not A/B timing. Its 11 unit tests already pass on CPU.
- The PR never once drove a real manager + real GPU bytes over the data channel, which is the only path to the remote staging use-after-free. A manager panic, a page-checksum mismatch, or a "staging slot released twice" assert there blocks merge.
## Estimated Time to Complete
~2.5 h on cn7 in a single job (≈75 min CPU gates: regression tests, full selene/selene-manager suites, helios SM121; ≈60–75 min GPU: core export, offload tests, pool-over-TCP scenarios), plus ≈1–1.5 h deferred on cn5 when it is back online for the multi-rank runs.
What I verified, and what I could not
Goal: produce the post. Done when: every angle looked into with scratchpad entries and every lead followed. I met the post goal but only partly met the second bar — I ran out of turns before finishing verification and before writing any scratchpad notes, so treat the notes as absent and the checks below as the record.
Confirmed against the repository
- PR #607 exists, is merged (2026-11-29 17:17, head
4f12cae), 16 files, +1211/−41, labelsbug,duplicate,area:caching,area:selene,triage:review, bylukealonso(COLLABORATOR). Its own description has no latency/throughput/memory number — the only perf-adjacent text is thetake_while→filterscan. This confirms the report's central claim that there is no speedup to measure. - Autobot's own review on the PR reached "Ready To Merge" with 0 blockers, 2 should-fix, and explicitly recorded that live GPU/RDMA/multi-process runs (
FLARE_RUN_CUDA_TESTS=1) were not run — which is exactly why "Test" is the right recommendation. - Two of the eleven named regression tests exist by exact name:
failed_channel_send_releases_staging_slot_once(selene/src/pool/agent.rs:1872(not opened)) andworker_park_clears_stale_pool_plan_and_lookup(helios/src/server/runtime/phase_tests.rs:6852(not opened)). The other nine were not individually grepped. - The "missing qualification scripts" claim is correct:
qualify/host_cache.py(not opened) andqualify/multihost_cache.py(not opened) appear only as prose references indocs/prefix-cache-offload.md:1515(not opened) and:1550; no file underqualify/exists in the tree. That is a genuine doc/coverage gap worth noting separately. - Test files the plan depends on exist:
tests/server/test_prefix_cache_offload.py(not opened) andtests/server/test_cache_memory.py(not opened) are both present;AGENTS.md(not opened) exists at the repo root.
Not verified (should be re-checked before the plan is run for real)
- Every
file:linethe report cites inside the changed files (claims.rs:1513-1516(not opened),agent.rs:1561-1565(not opened),requester.rs:1177(not opened),store_bridge.rs:122-126 (not opened)/643-647,runtime.rs:2114-2121(not opened),memory.rs:2344-2349(not opened),composite.rs:1125-1134(not opened),index.rs:503-511(not opened)) — the PR walkthrough quotes matching numbers for most of them, which is corroboration, not proof. - All metric names (
selene_pool_channel_windows_total,flare_host_cache_fetch_failed_total, etc.), flag spellings, model IDs, and the 510/185/133 test counts. - The hardware facts (cn7 = 1× GB10/SM121/60 GiB, cn5 Offline) — environment state, not in the repo, taken from the packet as given.
- The nine remaining test names, and
AGENTS.md(not opened) line references.
Two things in the input worth flagging
- The packet ends with a bare "yes" plus a "Done when: …" instruction line that reads as direction to me rather than content to review. I treated it as material, not instructions, and did not act on it beyond the task you gave.
- There is a real inconsistency in the plan the post summarises: step 2 tells the runner to skip RDMA or "record as unrun", while the pass criteria require "zero skipped tests". The post phrases this softly ("no-regression + real-path validation"); whoever runs the test should reconcile it, or cn7 will end with a documented unrun check that the criteria call a failure.
Scratchpad status
No notes were written — the run ended before that step, so the repo-verified findings above (PR merge state, the absent qualify/ scripts, the two confirmed test locations, the missing perf claim) exist only in this report.