Explore scratchpad · NVIDIA/hyperflare-inference #612

Raw Markdown for agents: https://autobot.eidonix.com/p/ad557ce5-ef76-4a52-9584-9e639c1dddf2.md

#1 [high] The change: shape and size of #612

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. Opened 2026-11-29 17:08, merged 2026-11-29 17:32 (24 minutes later). +293/-52 across 10 files, no labels, no reviews, no comments (discussion empty).

Files/lines (from read_item #612):

Merge commit on main is 3801ff1d "Harden selene-manager against multi-rank packed OOB, DoS, and leaks (#612)" (see orientation packet recent-activity list). Description ends "Discord: D-Rock" (off-repo evidence channel).

#2 [high] Community: no reviews, no comments, merged in 24 minutes

pr_comments for #612 returned "No comments" - no review, no inline comment, no reaction thread anywhere on the PR. Opened 2026-11-29 17:08 and merged 2026-11-29 17:32 (read_item #612), i.e. 24 minutes, so effectively self-merged without review. Orientation packet: "Reviews: none yet", "CI on the head commit: pending" - the only evidence of testing is the author's own description text and a human hardware run reported in the description; the evidence channel named for review is "Discord: D-Rock", which is not in the repository.

Charter (read_charter) "Code Review Standards" asks reviewers to check the supported matrix, and "Bring real evidence" asks bug fixes to address the root cause; nothing in-repo records such a review for #612.

#3 [high] The change: what each hunk does (verified in code)

Verified against head 1f9ee76 (pr/612 files):

  1. selene-manager/src/pool/store_bridge.rs:411-420 - in put_begin, after resolving the scope descriptor, a PutBegin whose m.packed.is_some() on a scope with descriptor.ranks.len() >= 2 is refused with v2::Reason::Invalid "packed storage is not supported for multi-process puts".
  2. selene-manager/src/pool/claims.rs:1161-1188 - in grant() (PinAck handling): resolves the requester's scope descriptor (RequesterLost if gone); rejects any_packed && descriptor.ranks.len() >= 2 (CopyError); for non-packed retained claims checks pages*page_bytes (+row) against claim.reserved_bytes (NoWindows); and rejects pages > consumed_tokens/page_tokens as max_pages (CopyError) - all before the Vec<(PlannedWindow,..)> planning loop at :1189.
  3. selene-manager/src/pool/mod.rs:213-222 - validate_scope adds ranks.len() > 64 and page_record_bytes/row_record_bytes > 1<<40 (MAX_RECORD_BYTES). Plus new test at mod.rs:303-333 (65 ranks, 1<<62 record).
  4. selene-manager/src/store.rs:1561-1585 - next_power_of_two() replaced by checked_next_power_of_two() with an Oversize rejection; extent now computed once and reused at :1581. Note put_requirement at store.rs:1953-1956 still calls the panicking length(..).max(4096).next_power_of_two() - the panic was not removed there (it is reached from rootless_fallback and the charge path).
  5. selene-manager/src/pool/windows.rs:51-92 - plan() now does shape.first_page.checked_add(shape.pages)?, checked u32 offset math, u32::try_from(windows.len()).ok()?, checked length add; new test plan_rejects_first_page_u32_overflow at windows.rs:198-209.
  6. selene/src/shared/index.rs:207-238 - new Index::reparent_to_root(key, tail_pages): detaches from old parent (retain child, saturating_sub ready_children), sets parent=None, tail_pages, chain_depth=1, and rewrites chain_depth of descendants via a stack. Note this inserts the new method between drop_row's doc comment (:205 "Drop a node's row...") and drop_row (:240), so the doc comment now describes reparent_to_root and drop_row is undocumented.
  7. selene-manager/src/store.rs:2914-2922 - publish_put Replace path: if the tree node's parent/tail_pages differ from the new header and header.parent.is_none(), call reparent_to_root before swapping the location. This is the rootless-fallback stale-parent fix; the only call site.
  8. selene-manager/src/store.rs:915,924 - evict_accounted eligibility and the cascade keep predicate add node.location.reading() (Location::reading() at store.rs:94-98 = memory extent Arc::strong_count > 1) beside the existing disk_busy guard.
  9. selene-manager/src/pool/claims.rs:2256-2262 - session_claims_lost now also selects terminal claims whose export is Pinned and whose source_channel().is_some(), so a source disconnect ends and fails them (:2277-2289), releasing the export slot counted by exports_outstanding -> holds_export_slot (claims.rs:304-310, 385-400).
  10. selene-manager/src/pool/core.rs:658-670 - rank-0 reconnect compatibility now requires offered_codec equal, old_sess.scope == scope.id and old_sess.ranks == ranks (Ranks derives PartialEq/Eq, ranks.rs:24) before setting self.reconnecting.
  11. selene-manager/src/pool/core.rs:687-710 - MAX_SCOPES=64: on a fresh scope when at the cap, retain only scopes named by a live session, claim or put, or with a non-empty index (state.index.len() > 0), then refuse InvalidScope if still at the cap.
  12. selene-manager/src/pool/claims.rs:2130-2170 + ranks.rs:230 - agent_fence_by_id(Some(aid), ...) resolves rank 0 from the agent id first, falling back to the old agents.values().find(proc) scan; agent_fence kept for tests via #[cfg_attr(not(test), allow(dead_code))].
  13. selene-manager/src/local.rs:774-794 + core.rs:989-1000 - watch_pid retries EINTR, and on any other failure returns exited only for ESRCH or the new pid_exited(pid) (kill(pid,0) ESRCH, pid 0 → false); Prior::holders retain and Core's proc sweep use the fallback when no pidfd exists.
  14. selene-manager/src/control.rs:459, 475-501 - a 64-permit Semaphore gates TLS handshakes and each accept is wrapped in a 5 s tokio::time::timeout; control.rs:347 channel.clone(); control.rs:553-555 hub.shutdown() before pool_task.abort().

#4 [high] The change: things the description does not say / says differently

Findings that a reader could not get from the PR description:

a) Behaviour change not in the description: the reconnect rule was widened from "codec matches" to "codec + scope id + rank secret/world match" (core.rs:658-664). Consequence: a rank-0 process that restarts with the same instance id but a different scope (different TP width or geometry) or a new rank secret no longer keeps its live agents; it no longer sets reconnecting, so peer ranks are detached (the pool protocol's "same process reconnecting keeps its agents" path, PROTOCOL.md:1009-1010). This is a hardening choice, but it also silently drops the documented capability for the legitimate case where ranks legitimately re-attach after the scope's secret changes.

b) Idle-scope pruning is not really pruning of idle scopes: it runs only when a fresh scope opens at the cap (core.rs:688-710), and it keeps any scope whose index is non-empty. Nothing else ever removes a scope entry, and no code path clears ScopeState::index for a dropped catalog, so on a manager with one scope whose index fills, the cap behaves as a hard refusal of the 65th distinct scope rather than a bound on memory. The claim "bounds idle scope memory" is therefore narrower than stated: it bounds the number of empty scopes, not the memory of scopes with entries. Also MAX_SCOPES is a hard-coded constant, not a config/Limits field, so operators cannot tune it.

c) Error code choice for the new rejections: a multi-process packed PinAck/PutBegin is answered CopyError / Reason::Invalid, and oversized reserved_bytes is answered NoWindows (claims.rs:1174-1184). NoWindows is also the legitimate "reservation too small" signal the client already maps (selene/src/pool/engine/source.rs:260-278 sends NoWindows when bytes > run.reserved), so client-side diagnosis of the new refusal is ambiguous. Nothing in selene-manager/PROTOCOL.md documents the two new refusals; the description's "without changing wire compatibility" holds for message shapes but not for the set of situations in which existing reason codes appear.

d) The panic the description says it removes is only half removed: store.rs:1561 now uses checked_next_power_of_two, but Store::put_requirement (store.rs:1953-1956) still calls Header::length(row).max(4096).next_power_of_two() and is called right after, at store.rs:1584 and via rootless_fallback (store.rs:1913) for the same child header. So a header whose length rounds past u64::MAX still panics on the streamed path.

e) The packless-multiprocess capability reversal: selene's own engine comment (selene/src/pool/engine/source.rs:252-256) states multi-process rank agents "hold single-rank packed records rather than world-wide offers", i.e. rank agents already only handle world==1 packed. The new manager check keys on scope.geometry.ranks.len() >= 2, which is the scope's world, not the offer's rank coverage, so it rejects any packed PutBegin/PinAck on a TP>=2 scope - including the single-rank packed records the agent path was designed to carry. This is wider than "multi-process packed is unsupported" as described and is not verified by a test (see next entry).

f) Existing hard-coded 64 already existed in the packed directory format: PROTOCOL.md:1076 says the packed directory "is bounded to 2 MiB, 16,384 units and 64 ranks", so the new 64-rank scope cap matches an existing bound for packed records; the 1 TiB record cap has no documented precedent.

g) Doc slip introduced: in selene/src/shared/index.rs the new reparent_to_root is inserted at :207 between drop_row's doc comment (:205) and drop_row (:240), so "Drop a node's row, keeping its pages" is now attached to reparent_to_root and drop_row lost its doc.

h) The description mentions three unit tests (reparent, validate_scope, windows::plan). Those three exist. No test was added for: the multi-process packed refusals in store_bridge/claims, the reserved_bytes/max_pages bounds, the evict_accounted reading() guard, session_claims_lost PinAed reclamation, MAX_SCOPES pruning, agent_fence_by_id, reconnect scope/secret compatibility, watch_pid EINTR/kill(0) fallback, the TLS handshake cap/timeout, or the hub.shutdown ordering. The claimed 186 lib + integration runs are existing suites; selene-manager/tests/packed.rs (9 tests) has no multi-process case (grep of selene-manager/tests shows no packed+world>=2 test).

#5 [high] Related work: #607 predecessor and the same-day 6-PR cluster

PR #607 (lukealonso, merged 2026-11-29 17:17) is the direct predecessor and the frame #612 uses ("beyond the items already landed in #607"). It fixed six defects including linked multi-process puts (record-relative first_page in put_answer) and manager-side transfer IDs in selene-manager/src/pool/store_bridge.rs (+477 -24). #607's own text names #612 among the companion PRs "rebased onto #607 (overlapping hunks removed)", and its Autobot review says the same (duplicate-related labels on #607 include area:caching, area:selene, bug, duplicate, triage:review).

Same-day cluster by two authors on the same subsystems: #607 (Luke Alonso, selene/selene-manager/helios), #608 helios/ignition/ci, #609 DMA lifetimes, #610 local storage tier, #611 pool client fencing, #612 selene-manager hardening. All merged 2026-11-29 between 17:17 and 17:32; #612 was opened 17:08 (10 minutes after #607 opened, and while #607 was still open) and merged 17:32, i.e. stacked on #607's merge.

Described-by-author lineage that #612 depends on:

#9 [high] Claims and evidence: what is verified, what is self-reported, what is unbacked

What the PR claims (read_item #612 "Supporting evidence" and "Expected benefit"):

  1. RUSTFLAGS="-D warnings" cargo check --locked --all-targets --features codec,rdma for selene and --lib --bins --tests for selene-manager: passed with 0 warnings. Not independently reproducible from here; CI on the head commit was "pending" at packet time and no CI result is recorded on the PR.
  2. selene lib tests 540/540; selene-manager 186/186 lib (1 ignored) plus builder 3/3, offload 2/2, packed 9/9, pool_claims 36/36, pool_net 6/6, pool_store 11/11. Plausible and consistent with #607's numbers (185 lib, 11 integration binaries) plus #612's three new unit tests - but the run is self-reported, and #612's own three tests are the only ones covering new behaviour (see the gap list in the "description does not say" entry).
  3. "Combined 4-PR validation & SM120/SM121 hardware qualification": live flare run + selene-manager on cn5 (SM120: 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 pool retirement & restore), reporting 0 panics, 0 leaked pins/slots, 0 quarantined bytes, clean shutdowns. This is the strongest evidence but it is (i) self-reported, (ii) run against a combined 4-PR stack (which 4 is never enumerated - presumably #609/#610/#611/#612), and (iii) run before the rebase onto #496/#497/#607, i.e. not against the commit that was merged. The description discloses this.
  4. "Closes every crash, OOB, DoS, and leak vector" - an absolute claim. Facts that bear on it: the panicking next_power_of_two is still present at store.rs:1953-1956 (put_requirement, reachable from the streamed/rootless paths); no test covers 11 of the 14 hunks; the scope-pruning only bounds empty scopes (core.rs:687-710) and keeps every scope with a non-empty index forever, since nothing ever clears ScopeState::index for a discarded catalog (only watch_catalog at store_bridge.rs:132-168 populates it, and catalogs is never pruned).
  5. "without changing wire compatibility" - no proto change is in the diff (selene-manager/src/proto untouched; the 10 files contain no .proto), so the message shapes are unchanged. What does change is which inputs are accepted and which reason code a client receives (multi-process packed PutBegin -> Reason::Invalid "packed storage is not supported for multi-process puts"; multi-process packed PinAck -> CopyError; oversize reservation -> NoWindows), plus a new InvalidScope refusal at the 64-scope cap and new ClientHello timeouts at 5 s. Clients that today succeed (packed puts on a TP>=2 scope, per selene/src/pool/engine/source.rs:252-256 the rank-agent path) will newly be refused.
  6. Evidence channel named in the description: "Discord: D-Rock" - off-repository, not linkable from the case file.

#10 [high] Reach: who is affected by the new refusals, caps and timeouts

Who/what is affected:

#6 [medium] Recent activity: same-day edits by #607/#609 and the author's own series

Recent commits on main touching these files, newest first (search_history + items_touching):

#7 [medium] People: yatesdr is the selene-manager/pool owner

Author: yatesdr, GitHub association COLLABORATOR. 79 merged PRs, 9 closed, 4 open in the last 180 days (orientation packet). They are the originator/owner of the Selene pool: #92 "Share prefix KV cache between instances and hosts through a selene pool manager", then #138, #139, #141, #142, #337, #401, #402, #413, #415, #429, #476, #504, #523, #527, #609, #610, #611, #612 - i.e. essentially the whole of selene-manager plus a large share of selene/src (36 commits in selene/src, 30 in selene-manager/src over 180 days; next is Luke Alonso with 5 and 3). Area co-workers: Luke Alonso (the #607 author, 3 commits in selene-manager/src), Martin Vit (2 in selene/src), PCCessna (#496/#497). Nobody else engaged with #612: no reviewer, no commenter, no reaction (pr_comments empty; read_item #612 discussion empty). Compare #607, which drew a flare-autobot case file plus an Autobot review within the same hour (#607 discussion, 2 comments, 2026-11-29 17:20 and 17:32). #612 got neither, so the difference in process between the two PRs is stark: #607 had an automated review written and #612 (merged four minutes before that review landed, at 17:32) did not. Priority-contributor list in the charter names @voipmonitor, @original-el8, @lukealonso - yatesdr is not on it, although they hold collaborator status and are the pool's principal author.

#8 [medium] Project fit: charter lines on Selene sharing, multi-host, review evidence

Charter lines (read_charter) that bear on #612:

#11 [medium] Process: opened 17:08, merged 17:32, zero review, CI pending

Process facts for #612 (read_item #612, orientation packet):

#12 [medium] File map: ten files and which hunk lives where

File map for #612 (+293/-52), hunks verified at head 1f9ee76: