Case file — PR #612 fix(selene-manager): harden multi-rank packed handling, protocol validation, and resource reclamation
Author: yatesdr (COLLABORATOR). Branch fix/selene-manager-hardening → main, head 1f9ee76a0f65a219f51176534613a0064da838e2. +293 / −52 in 10 files. Opened 2026-11-29 17:08, merged 17:32 the same day as 3801ff1d. No reviews, no comments, no labels; CI on the head commit was still "pending" at packet time.
Key findings
- Merged with zero review in 24 minutes, with CI pending.
pr_commentsis empty, no labels, no reviewers; the only test evidence that exists is the author's own description text and a hardware run reported by the author (see Claims). Compare the direct predecessor #607, which got a flare-autobot case file (17:20) and an Autobot review "Ready To Merge" at 17:32 — four minutes after #612 had already merged. Human review channel named in the PR is off-repository: "Discord: D-Rock". - Undeclared behaviour change: rank-0 reconnect compatibility was widened. The description says "verify scope and rank secrets across rank-0 reconnect", but the effect is that a rank-0 process restarting on the same instance id with a different scope id or a regenerated rank secret no longer keeps its live agents (
selene-manager/src/pool/core.rs:658-670, now requires codec +old_sess.scope == scope.id+old_sess.ranks == ranks). That silently removes a capability PROTOCOL.md documents (selene-manager/PROTOCOL.md:1009-1010), not merely adds a check. - The multi-process packed refusal is broader than "multi-process packed". It keys on
descriptor.ranks.len() >= 2(the scope's world), not on the offer's rank coverage (store_bridge.rs:411-420,claims.rs:1170-1173), so it also refuses the world-record packed path that Selene's own rank agents are built around —selene/src/pool/engine/source.rs:252-256states rank agents "hold single-rank packed records rather than world-wide offers". CLI users appear protected byselene/src/offload.rs:96-103(validate_topologyrejects--rank+ pool + compression), so the affected class is directPoolClientcallers. - The panic the description says it removes is only half removed.
store.rs:1561-1585now useschecked_next_power_of_two, butStore::put_requirementatselene-manager/src/store.rs:1953-1956still callslength(..).max(4096).next_power_of_two()and is reached from the same child header (store.rs:1584,rootless_fallbackatstore.rs:1913). The description's "closes every crash, OOB, DoS, and leak vector" is therefore an absolute claim the code does not fully support. - "Bounds idle scope memory" is narrower than stated.
MAX_SCOPES = 64pruning runs only when a fresh scope opens at the cap, and keeps any scope with a non-emptyScopeState::index(core.rs:687-710); nothing ever clears that index for a dropped catalog (onlystore_bridge.rs:132-168populates it). It bounds the count of empty scopes, andMAX_SCOPESis a hard constant, not aLimitsfield — an undocumented operational ceiling on distinct (model, TP-layout) scopes per manager. - New refusals are not documented and reuse ambiguous reason codes. Multi-process packed PutBegin →
Reason::Invalid; multi-process packed PinAck →CopyError; undersized reservation →NoWindows, which is exactly the legitimate "reservation too small" code clients already send (selene/src/pool/engine/source.rs:260-278). No change toselene-manager/PROTOCOL.mdor docs/*, unlike #607 which updateddocs/prefix-cache-offload.md(not opened). - Test coverage gap: 11 of 14 hunks have no test. The three named unit tests exist (
index.rs:1447-1462,pool/mod.rs:303-333,pool/windows.rs:198-209), but nothing covers the packed refusals, thereserved_bytes/max_pagesbounds,evict_accounted'sreading()guard,session_claims_lostexport reclamation,MAX_SCOPES,agent_fence_by_id, reconnect compatibility,watch_pidEINTR/kill(0)fallback, the TLS cap, or the shutdown ordering. - No filed bug report exists for the defects this fixes. Searches for the rootless stale-parent-link, reader-eviction and multi-process-packed defects return only #612 itself (plus unrelated #607/#477/#554). These are the author's own findings, so there is no independent reproduction in the repository.
- Small doc regression in code:
reparent_to_rootis inserted betweendrop_row's doc comment (selene/src/shared/index.rs:205) anddrop_row(:240), so "Drop a node's row, keeping its pages" now documentsreparent_to_rootanddrop_rowlost its doc.
The change
Ten files, +293/−52, all in selene-manager/src (9) plus one in selene/src (1). Nothing touches .proto, selene/src/shared/record.rs (not opened) or Cargo.toml (not opened), so message shapes and on-disk formats are unchanged.
Verified hunks (head 1f9ee76):
- Multi-process packed refusal.
pool/store_bridge.rs:411-420:PutBeginwithm.packed.is_some()on a scope withdescriptor.ranks.len() >= 2→v2::Reason::Invalid"packed storage is not supported for multi-process puts".pool/claims.rs:1161-1188: ingrant(), resolve the requester's descriptor (RequesterLostif gone), reject multi-process packed (CopyError), checkpages*page_bytes(+row)againstclaim.reserved_bytes(NoWindows) andpages > consumed_tokens/page_tokens(CopyError) before thePlannedWindowvector loop at:1189. - Geometry bounds.
pool/mod.rs:213-222:validate_scopecapsranks.len() > 64andpage_record_bytes/row_record_bytes > 1<<40(1 TiB). New testpool/mod.rs:303-333. - Checked arithmetic.
store.rs:1561-1585checked_next_power_of_twowith an Oversize rejection;pool/windows.rs:51-92first_page.checked_add(pages), checked u32 offsets,u32::try_from(windows.len()); new testwindows.rs:198-209. - Tree topology. New
Index::reparent_to_root(selene/src/shared/index.rs:207-238) detaches from the old parent (ready_childrensaturating_sub), setsparent=None,tail_pages,chain_depth=1, and rewrites descendant depths via a stack; called fromstore.rs:2914-2922inpublish_put's Replace path when the new header is rootless but the node still has a parent/tail (rootless-fallback stale-link repair). Only call site. - Eviction safety.
store.rs:915and:924addnode.location.reading()to the eligibility and cascadekeeppredicates (Location::reading()atstore.rs:94-98= memory extentArc::strong_count > 1). - Reclamation.
pool/claims.rs:2256-2262session_claims_lostnow also ends/fails terminal claims whose export isPinnedand whosesource_channel().is_some()(:2277-2289), releasing the export slot counted byexports_outstanding/holds_export_slot(claims.rs:304-310,385-400). - Scope cap & pruning.
pool/core.rs:687-710MAX_SCOPES = 64, prune at cap thenInvalidScope. - Fencing.
pool/claims.rs:2130-2170agent_fence_by_id(Some(aid))resolves rank 0 by agent id first, falling back to the oldagents.values().find(proc)scan;pool/ranks.rs:230passes theaid. NoteRanksgainedPartialEq/Eq(ranks.rs:24). - PID watching.
local.rs:774-794watch_pidretriesEINTRand addspid_exited(pid)(kill(pid,0); pid 0 → false), used when no pidfd exists (local.rs:425-433,pool/core.rs:989-1000). - Listen TLS & shutdown.
control.rs:45964-permitSemaphore;:475-501each accept wrapped in a 5 stokio::time::timeout;:553-555hub.shutdown()beforepool_task.abort();:347channel.clone().
The why
The stated motivation: several selene-manager paths accepted unvalidated peer metadata or multi-process packed operations, risking OOB arena reads/writes, panics, and permanent slot/connection leaks — beyond what #607 had already landed. Concretely: arena extents sized to compressed bytes while uncompressed window lengths were passed to pass::run; unbounded rank counts and record sizes; next_power_of_two panics; planning vectors allocated before validation; first_page + pages overflow; stale parent links after rootless replacement; evicting page-only ancestors with active readers; leaked terminal remote Pinned exports on source disconnect; unbounded idle scopes; rank-0 misresolution; reconnect without secret checks; watch_pid missing EINTR/pidfd fallback; uncapped TLS handshakes; pool_task aborted before hub.shutdown().
No GitHub issue, bug report or user report was found asking for any of these (see Related work). The defects are the author's own review findings, stated as such in the description ("beyond the items already landed in #607"). The need is nonetheless recent and real: the packed put/pin paths themselves were only introduced by #504/#523/#607 within four days of this PR.
Related work
- #607 (Luke Alonso, merged 2026-11-29 17:17) — direct predecessor; #612 describes itself as "beyond the items already landed in #607", was rebased onto post-#607
main(5df8edd3c), and #607's own text lists #612 among its rebased companion PRs "overlapping hunks removed". Overlaps 5 files, notablypool/store_bridge.rsandpool/claims.rs. No conflict is visible in the diff, but #612'sclaims.rshunk at:1158-1188immediately follows #607'sgrantchanges. - Same-day cluster, two authors, same subsystems: #607 (selene/selene-manager/helios), #608 (helios/ignition/ci), #609 (DMA lifetimes), #610 (local storage tier), #611 (pool client fencing), #612 (manager hardening) — all merged 2026-11-29 between 17:17 and 17:32. #612 was opened 17:08, while #607 was still open, and merged 15 minutes after #607.
- Lineage #612 builds on (all yatesdr, all in these files): #356 "Store pool puts as roots when their published parent is absent" — created the rootless/absent-parent fallback whose stale parent links #612 now has to repair with
reparent_to_root; #376 "Watch pid-zero pool peers through SO_PEERPIDFD" — ancestor of thepid_exitedfallback; #402 (release a timed-out source export when its session ends), #413/#429 (ancestor linking,store_bridge.rs), #415 (rows by role, eviction, 7 files shared), #341, #339 — the same "release the slot/export when the peer is gone" theme. #504 (lossless KV compression) introduced the packed PutBegin/PinAck paths #612 restricts; #523 touched the samestore.rs. - Rebase bases cited in the evidence: #496 and #497 (PCCessna), both merged, both touching
selene/srconly. - Nothing competes or supersedes. No open PR or issue was found addressing these checks;
#614(open, test flakes) and#582/#586are unrelated. Net effect: #612 in part repairs invariants that #356 and #504/#607 introduced days earlier.
Recent activity
Commit timeline in the touched files: 3801ff1d #612 (this PR) → e2522eb0 #609 (yatesdr, selene/src + selene-manager/src) → 5df8edd3 #607 (Luke Alonso; it also changed selene/src/shared/index.rs, making #612's index edit the second same-day change there) → 3d8640c6 #523 and 716df00f #504 (yatesdr, packed/KV compression in store.rs/claims.rs) → 9710cadc #607-adjacent core acquisition (Luke Alonso) → 203d6c9f #476, 25b49519 #402, 436d6a9b #415, 204ecff0 #413, 09c2a4a4 #376, 5477a6ab #356 (all yatesdr, all in selene-manager/src/{store.rs,pool/claims.rs,pool/store_bridge.rs,local.rs,control.rs}). #496/#497 touched only selene/src. Nothing in the recent history reverses or conflicts with #612; the change is a continuation of the author's own series and repairs invariants from #356/#504.
People
yatesdr is the pool's principal author: #92 (the original "share prefix KV cache through a selene pool manager"), then #138/#139/#141/#142/#337/#401/#402/#413/#415/#429/#476/#504/#523/#527/#609/#610/#611/#612. 79 merged PRs in 180 days. Ownership: selene-manager/src 30 commits vs Luke Alonso 3; selene/src 36 vs Luke Alonso 5 and Martin Vit 2. Area co-workers: Luke Alonso (the #607 author), PCCessna (#496/#497). The charter's priority-contributor list names @voipmonitor, @original-el8, @lukealonso — yatesdr is not on it despite holding collaborator status. Nobody else engaged with #612 in any form.
Community
No comments, no reviews, no inline comments, no reactions — pr_comments for #612 returned "No comments", the discussion is empty, and there are no labels. Interest drawn: none observable. This is a marked contrast with #607 in the same hour (case file at 17:20, Autobot review at 17:32).
Project fit
- Charter goal (line 24), "Store prefix-cache checkpoints in host memory and share them across Flare instances via Selene": selene-manager is the broker of that sharing — squarely in scope.
- Charter goal (line 22), "Support single-host and cross-node serving… supervising serving ranks": the rank-agent, pidfd and reconnect hunks serve the cross-node/multi-process case; the
--listenTLS cap is the cross-node entry point. - Charter non-goal (line 29), "multi-model hosting/routing": the 64-scope cap is a limit on holding many model/layout scopes on one manager — consistent with the non-goal but an undeclared product ceiling.
- Charter review standard (line 42), "Check interactions across every supported model, cache scheme, parallel layout, multi-host setup": #612 changes the accepted inputs for parallel layouts (packed on TP≥2 scopes) and the reclamation path for every cache scheme (
evict_accounted), yet reports only CPU suites plus a combined-stack hardware run, not a per-layout matrix. - "Bring real evidence"/"address the root cause" (#397) and "Don't silently ignore API fields… implement or reject" (#417): the change takes the reject arm (charter-consistent), but is a defensive restriction rather than a root-cause fix for the packed extent sizing, and the new rejections are undocumented.
- The PR description meets the four-part requirement (why / what changed / claimed result / evidence) and honestly discloses that hardware qualification ran against a combined 4-PR stack before the rebase. No documentation is changed by #612.
Claims and evidence
| Claim | What backs it |
|---|---|
RUSTFLAGS="-D warnings" cargo check clean for selene (codec,rdma) and selene-manager (lib/bins/tests) |
Self-reported; CI "pending" at packet time; no CI conclusion recorded on the PR |
| selene lib 540/540; selene-manager 186/186 lib (1 ignored) + builder 3, offload 2, packed 9, pool_claims 36, pool_net 6, pool_store 11 | Self-reported; consistent with #607's counts plus #612's three new tests; note selene-manager/tests/packed.rs (not opened) has no multi-process case, so the headline refusal is untested |
Live flare run + manager qualification on SM120 (cn5: DeepSeek-V4.1-Flash-1017 TP4, GLM-5.3-Flash TP2/TP4 off/cpu/gpu, Qwen3.8-Flash-Next TP1/TP2 incl. wiped-disk pool-only cold restore) and GB10 (cn6–cn9: 3-node TP2, 4-node TP4 cross-host retirement & restore): 0 panics, 0 leaked pins/slots, 0 quarantined bytes, clean shutdowns |
Strongest evidence, but self-reported, against an unnamed combined 4-PR stack, and before the rebase onto #496/#497/#607 — i.e. not the merged commit. The PR discloses this |
| "Closes every crash, OOB, DoS, and leak vector" | Absolute; contradicted in part by the surviving next_power_of_two panic at store.rs:1953-1956, by the empty-scope-only pruning, and by 11/14 untested hunks |
| "without changing wire compatibility" | True for message shapes (no .proto, no record format change); not true for accepted inputs and reason-code reachability (see Reach) |
| "reclaims… shutdown resources cleanly" | hub.shutdown() before pool_task.abort() verified at control.rs:553-555; no test |
| Evidence channel "Discord: D-Rock" | Off-repository, not linkable |
Reach
- Operators >64 scopes: the 65th fresh scope gets
InvalidScope(core.rs:687-710); hard constant, not tunable viaLimits(selene/src/shared/config.rs(not opened)). - Operators on
--listenTLS: handshakes now capped at 64 concurrent with a 5 s timeout (control.rs:459,475-501); slow/busy clients now seeTimedOutrather than queuing. Limits undocumented. - TP≥2 pools using compression: packed PutBegin/PinAck refused (
store_bridge.rs:411-420,claims.rs:1170-1173). CLI users appear shielded byvalidate_topology(selene/src/offload.rs:96-103, called fromhelios/src/runtime_core/selection.rs:80(not opened) andoffload.rs:572); directPoolClientcallers relying on the single-rank packed path (selene/src/pool/engine/source.rs:252-256) are the exposed class. - Reconnect: a rank-0 restart with a changed scope id or rank secret loses live agents (
core.rs:658-670). - Eviction: records with a shared memory extent are no longer evictable (
store.rs:915,924), so under read pressure a put can be refused (Budget) where it was previously accepted — an availability trade for UAF safety. - Memory caps: 64 ranks and 1 TiB record sizes per scope (
pool/mod.rs:213-222). The 64-rank bound has precedent —selene-manager/PROTOCOL.md:1076bounds the packed directory to "2 MiB, 16,384 units and 64 ranks"; the 1 TiB record cap has no documented precedent. - Compatibility / deployment: no dependency, config or format change; existing pool records and cores still load. Documentation: nothing updated, so none of the new limits is discoverable by users.
Process
Not a draft; merged to main as 3801ff1d. Lifetime 24 minutes (17:08 → 17:32), zero reviews, zero comments, no labels, CI pending at packet time. The only human review channel is off-repo (Discord). Predecessor #607 got a bot case file and an Autobot review recommending merge — #612 got neither before merging.
Open questions / not found
- Which four PRs made up the "combined 4-PR stack" used for hardware qualification is not stated; presumably #609/#610/#611/#612, unverified.
- Whether any production
PoolClientcaller (outside thevalidate_topology-guarded CLI path) actually relies on packed puts/pins on a TP≥2 scope — not determinable from the repo; this is the decisive question for the breadth of the new refusal. - Whether rank-0 restart with regenerated rank secrets is a real deployment pattern (which would make the new reconnect check a regression for that path) — no evidence either way in the repo.
- No filed defects/issues, no review, no CI conclusion — so nothing independent exists to confirm the claimed fixes or the hardware results.