Opened by a workflow run, Dec 2, 2026 7:12 PM EST. decide malicious: all_clear (100%): No malicious content found
explore
Author: ebfio (first-time contributor; 0 merged PRs, 2 other open PRs #699, #682; Discord: ebfio)
Motivation: Serving a persistent-worker core with GPU lossless KV compression (--lossless-kv-compression gpu, GKV1) hangs forever at startup, because the persistent GPU worker kernel is launched before the offload codec tries to load its CUDA module, and cuModuleLoadData waits for a quiescent context that never comes. The PR opens the offload store first so the module loads while the GPU is idle.
Scale: +52 / −31 lines in 1 file (helios/src/server/runtime.rs)
Proposal:
- Move
crate::offload::open(prepared, gpu_cubins, copy_gate)ahead ofRankExecutor::new, readingmanifest.offloaddirectly instead of through the executor. - Add LIFO cleanup on the later early-error paths after the store opens: close the store on
RankExecutor::newfailure;executor.close()thenstore.close()if drained, elsestd::mem::forget(store)on scheduler failures. - Replace the old offload-open comment with a rationale for the ordering.
- Leaves the happy-path shutdown order (
executor.close()thenworker.close_store()) unchanged. Touches: helios/src/server/runtime.rs(ModelRuntime::startstartup/shutdown ordering, error paths)- indirectly
helios/src/offload/mod.rs+offload/transfer.rs(called earlier, unchanged) - indirectly
helios/src/execution/transport.rs/execution/ranks.rs(persistent-worker start now follows offload open) Related items: - #504 selene/helios: pure-CUDA GPU and CPU lossless KV compression (merged): introduced the hazard one week earlier; this PR moves the call it added.
- #607 / #579 fix offload lifecycle and TP startup drain hang (merged): same startup/drain region;
Worker::close_storeconvention mirrored here. - #628 gate offload Copy Engine batches during peer-copy graphs (merged): added
copy_gate(), used by the moved block. - #640 allow persistent workers on rank 0 of local multi-rank cores (open): same kernel-before-offload ordering class on the threaded path, not fixed here.
- #674 / #694 (open, yatesdr): touch the same files/region; no textual conflict.
Link: https://github.com/NVIDIA/hyperflare-inference/pull/698
Autobot comments: The cited validation cannot exercise the change:
--features runtime-coredoes not enable theserverfeature that gateshelios/src/server/runtime.rs(helios/src/lib.rs:30-31), and the suggested command names a non-existent package (helios; the crate isflare-helios). No test was added, no CI ran, and the GPU evidence is the reporter's own, not re-run. The error-path handling is not symmetric withWorker::close_store: theRankExecutor::newfailure branch ignoresstore.close()errors and always returnsdrained: true(runtime.rs:697-706) whereasclose_storesetsdrained = falseand preserves the error (runtime.rs:1354-1362);std::mem::forget(store)deliberately leaks the store on undrained shutdowns. The reorder affects every offload configuration, not only GKV1, and moves codec-placement metrics/intake warnings earlier in startup. One described cause (cubin load deferred inruntime_core/mod.rsduringPrepare kernels) could not be located in the tree, though the rest of the deadlock chain is verified link by link. The body itself leaves SM103 Green Context / cooperative decode-graph contention unfixed.
Classify intake
Selected: triage:review, bug
Threshold: 65%
Triage
- [✓]
triage:review: 99.4% -
triage:validation: 0.4% -
triage:design-review: 0.1% -
none: 0.0% -
triage:investigate: 0.0% -
triage:integration: 0.0% -
triage:partial: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
priority:P1: 48.0% -
priority:P2: 48.0% -
none: 3.9%
Type
- [✓]
bug: 95.8% -
performance: 50.0% -
community: 22.3% -
duplicate: 4.2% -
enhancement: 0.0% -
documentation: 0.0%
Area
-
area:selene: 46.9% -
area:caching: 29.4% -
area:kernels: 26.9% -
area:preparation: 18.2% -
area:memory: 11.9% -
area:orbit: 2.0% -
area:rocenante: 2.0% -
area:api: 1.6% -
area:scheduling: 1.1% -
area:packaging: 0.4% -
area:engram: 0.1%
Model
-
model:nemotron-3.5-bolt: 0.5% -
model:deepseek-v4.1: 0.4% -
model:glm-5.3: 0.4% -
model:kimi-k3.1: 0.3% -
model:deepseek-v4: 0.2% -
model:qwen3.8-flash-next: 0.2% -
model:qwen3.8-27b: 0.2% -
model:inkling-small: 0.2% -
model:muse-glimmer: 0.1% -
model:gemma4: 0.0% -
model:mimo-v2.6: 0.0%
Apply Labels (Intake)
Applied: +triage:review, +bug
Value Proposition
Value Proposition — PR #698 ("Open host prefix store before RankExecutor::new()")
Novelty & status: genuinely additive. The hazard was created by merged PR #504 (2026-11-25, yatesdr), which added the very crate::offload::open(...) call inside ModelRuntime::start; #698 moves that call ~90 lines earlier and reverts none of #504's work. No commits on main since branching touch helios/src/server/runtime.rs, no open PR competes with it, and nothing supersedes or is superseded. It repairs a ~1-week-old regression with a single reporter (the author).
Charter alignment: strong. The dossier verifies the mechanism end-to-end (RankExecutor::new → finish_startup → control.start() persistent kernel; later offload::open → flare-offload-0 → GpuRankCodec::new → cuModuleLoadData on the same context). The fix corrects ordering/lifetime rather than retrying or swallowing the error, matching the #397 root-cause standard. Footprint is one file, +52/−31, no new flag, no per-model branch, no dependency or default change — consistent with "smallest footprint in shared code" and "keep the runtime small and model-agnostic." It repairs the host prefix-store/Selene path instead of widening scope.
Evidence: the weak point. The cited validation (cargo test -p flare-helios --features runtime-core, "1243 passed") does not enable the server feature that gates the changed file, so it compiles none of the diff; the suggested command names a non-existent package (helios); no test was added; there is no CI on the head commit; and the GB300 before/after numbers were explicitly not re-run for this submission, with no logs attached. One link of the stated cause chain (the prepare_kernels cubin deferral in runtime_core/mod.rs) is not locatable in the tree.
Maintenance risk. The new error paths are not symmetric as claimed: the RankExecutor::new failure branch discards store.close()'s error and returns drained: true, contradicting Worker::close_store and the in-file convention that startup errors retain owners conservatively; std::mem::forget(store) adds a second mechanism for an intent already handled by ManuallyDrop. The reordered block now runs for every offload configuration and emits metrics/warnings even when startup later aborts. The author's admitted SM103 Green Context / cooperative-decode contention remains open on a named charter target.
Verdict: Worth it with changes. The reorder is correct, small and worth review effort — but it should not land until it (1) is validated by a run that compiles the server feature (or adds a startup-ordering regression test), (2) aligns late-error-path drained/error semantics with close_store, and (3) justifies or removes the mem::forget leak. Author is a first-time contributor and not on the priority list; per #229 the review should state exactly these requirements rather than decline out of hand.
Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.
Subtraction and simplicity
PR #698's 12-line reorder is lean; the debt is in the cleanup code it piles on top.
- High — three hand-inlined copies of existing logic:
runtime.rs:697-706,:714-726,:784-796re-implementWorker::close_store(runtime.rs:1344-1364), which is already a free function over(Option<Box<dyn HostStore>>, &mut Shutdown)(field at:1164). Divergences from the helper: path (a) swallows the close error and drops the box anyway, against the contract atselene/src/store.rs:334-337; (b)/(c) introduce a second retention mechanism (std::mem::forgetat:722,:792) where the helper usesManuallyDrop, with no unwind guard — the caseshutdown_retains_the_store_when_its_drain_panicsasserts (phase_tests.rs:2340-2363). Fix: extractclose_store(store, &mut shutdown)as a module fn, haveWorker::close_storecall it, replace all three blocks with one call each → ~30 lines, bothforgets and the swallowed error gone, and the paths become testable with the existingFakeStore(phase_tests.rs:2262-2363). Minimal alternative: one-linemem::forget(store)per path, matchingruntime_core/model.rs:1123-1128. - Medium —
runtime.rs:673-678emits thecodec_placementmetric andintake_warninginline;crate::offload::openhas one caller (offload/mod.rs:135-144,runtime.rs:679), so move both insideopenand delete the block. - Low —
runtime.rs:663-691threadscopy_gatethrough a 3-tuple then.transpose()s;and_then+?returnsOption<Result<_>>in ~11 lines. Pre-existing shape moved verbatim, so optional. - The reorder itself adds no flag, knob, wrapper or fallback; reading
manifest.offloaddirectly is a net deletion; the 6-line comment earns its lines. No structural AGENTS.md violation. - Process: no test added, and the cited
--features runtime-corerun does not enableserver(lib.rs:30-31,Cargo.toml:25(not opened)), so none of the new branches were compiled; the suggested-p heliosnames a nonexistent package.
Open: no test guards this startup ordering; no CI on head; GPU numbers author-reported only; search_history unavailable due to git object errors.
Correctness and contracts
PR #698 moves crate::offload::open ahead of RankExecutor::new so GKV1's cuModuleLoadData no longer races a running persistent-worker kernel. The reorder itself is correct and safe; the new error-path cleanup it adds is not.
Findings:
- Major —
runtime.rs:697-706doeslet _ = store.close();thenreturn Shutdown { drained: true, … }, discarding the close error.selene/src/store.rs:334-337requires the caller to retain the store on close failure (transfer jobs may still reference registered buffers), and this file's ownWorker::close_store(runtime.rs:1354-1362) clearsdrainedand preserves the error.flare/src/controller.rs:2906copiesfailure.drainedonto the GPU lease, so a failed close can free the core while slabs are still registered. Same swallow at:717-723and:787-793. - Major — the open-failure path now returns unconditional
drained: true(runtime.rs:684-690); the removed hunk deriveddrainedfromexecutor.close(). Nothing is listening on whether a partially-spawnedTransferswas joined first. - Major (evidence) — the cited run
cargo test -p flare-helios --features runtime-corecannot compile the diff:helios/src/lib.rs:30gates the module onserver, whichhelios/Cargo.toml:25showsruntime-coredoes not enable. The "suggested"-p heliosnames no package (helios/Cargo.toml:2). No test added. - Minor — early
binding.take()makesBinding::sharded()(selene/src/offload.rs:539-545) false for the rest of startup; latent only. - Minor —
codec_placementgauge / intake warning now fire before executor construction (runtime.rs:672-679), for every offload config and on startups that later abort;codec_stateis a once-set cell (metrics.rs:558-560) gating decode stats (:566-568). - Claim accuracy — "exact LIFO-symmetric with the existing shutdown path" holds for the happy path (
:806,:829-830) but is false for:697-706.
Open: whether offload::open joins every transfer thread it spawned before returning Err; no startup-ordering regression test exists.
Final review
Recommendation: Changes Requested
The core startup reorder—opening the host prefix store before RankExecutor::new() launches persistent GPU workers—directly fixes a verified cuModuleLoadData deadlock with a minimal, model-agnostic footprint (helios/src/server/runtime.rs, +52/−31). However, the PR cannot merge as-is because (1) the three new post-open error-cleanup blocks violate the HostStore::close ownership contract by swallowing close errors, dropping the store on failure/unwind, and reporting drained: true anyway (duplicating the existing Worker::close_store helper that already handles all of this safely), and (2) the cited validation run omits the server feature and therefore never compiled or tested a single line of the diff.
Merge Risk
Level: Medium
- Blast radius:
ModelRuntime::start_retaining_drain(helios/src/server/runtime.rs:657-796) runs on every prefix-cache offload configuration (CPU/GPU compression, memory/disk/pool tiers, single-rank and multi-rank), not just--lossless-kv-compression gpu. - Happy-path / hot-path impact: Zero steady-state runtime cost and strictly less startup concurrency—
offload::opencompletes on theflare-modelthread beforeRankExecutor::newruns tuning graphs or launches persistent GPU workers. - Failure-path risk: Today, if
RankExecutor::newor scheduler setup fails andstore.close()fails or unwinds, the new ad-hoc cleanup reportsdrained: truetoflare/src/controller.rs:2905-2910and drops the store while transfer/pool/disk threads may still reference registered host slabs or GPU destinations.
Walkthrough
helios/src/server/runtime.rs:657-691: Movescrate::offload::open(prepared, gpu_cubins, copy_gate)ahead ofRankExecutor::new(manifest, peers), readingmanifest.offloaddirectly after the multi-process non-sharded guard (:644-656) soGpuRankCodec::new(helios/src/offload/transfer/gpu_codec.rs:268-283) loads the deferredkv_codec_gpucubin beforecontrol.start()?(helios/src/execution/transport.rs:793-808) launches persistent GPU workers.helios/src/server/runtime.rs:695-707: Adds early cleanup onRankExecutor::newfailure (let _ = store.close();), returningShutdown { drained: true, error: Some(error) }.helios/src/server/runtime.rs:714-726and:784-796: Adds cleanup on scheduler construction and scheduler configuration failures—callingexecutor.close(), thenlet _ = store.close()ifshutdown.drainedorstd::mem::forget(store)otherwise.helios/src/server/runtime.rs:806,:829-830: Preserves happy-pathworker.attach_store(store)and LIFO shutdown (executor.close()beforeworker.close_store(&mut shutdown)).
Pre-merge Checks
- [PASS] Security / malicious screen: Single-file startup reorder in
helios/src/server/runtime.rs; no newunsafeblocks, dependencies, flags, or external I/O. - [PASS] Charter & value fit: Addresses a real root-cause CUDA startup deadlock (introduced by #504) at the right layer with minimal shared-code footprint and no per-model branches.
- [PASS] Related / duplicate / conflict check: Additive follow-up to merged #504; no conflicts with
mainor competing open PRs. - [WARN] Tests & verification evidence: The cited
cargo test -p flare-helios --features runtime-corerun leaves#[cfg(feature = "server")]disabled (helios/src/lib.rs:30-31,helios/Cargo.toml:21,25), so none of the diff was compiled or executed; no CI checks ran on9ed34da.
Blockers
-
Post-open error paths violate
HostStore::closesafety contract and duplicateWorker::close_store(helios/src/server/runtime.rs:697-706,:714-726,:784-796)- Verified behavior & impact: All three new cleanup branches run
let _ = store.close();and dropstoreon scope exit while keepingdrained: true(hardcoded at:703; preserved fromexecutor.close()at:717and:787). This directly violatesselene/src/store.rs:334-337("On failure the caller must retain the store: transfer jobs may still reference its registered host buffers and GPU destinations"), causesflare/src/controller.rs:2905-2910to treat drain as confirmed and release the GPU/core lease while host slabs may still be in use, and dropsTransferson a failed close (whoseDropunconditionally callsthread.join(),helios/src/offload/transfer.rs:841-852). Furthermore, none of the three sites wrapsstoreinManuallyDropbefore callingstore.close(), so an unwind insidestore.close()dropsstore—the exact hazardWorker::close_store(runtime.rs:1344-1364) andshutdown_retains_the_store_when_its_drain_panics(helios/src/server/runtime/phase_tests.rs:2340-2363) prevent. Because of this, the PR's claim that startup cleanup is exact LIFO-symmetric withWorker::close_storedoes not currently hold. - Concrete fix: Extract the body of
Worker::close_store(runtime.rs:1344-1364, which only usesselftoself.store.take()) into a shared helperfn close_store(store: Option<Box<dyn flare_selene::HostStore>>, shutdown: &mut Shutdown)and call it fromWorker::close_storeand all three startup failure paths:
Then onfn close_store( store: Option<Box<dyn flare_selene::HostStore>>, shutdown: &mut Shutdown, ) { let Some(store) = store else { return; }; // Retain registered slabs if either drain fails, including an unwind // inside the store's close operation. let mut store = std::mem::ManuallyDrop::new(store); if !shutdown.drained { return; } shutdown.drained = false; match store.close() { Ok(()) => { shutdown.drained = true; drop(std::mem::ManuallyDrop::into_inner(store)); } Err(error) => { shutdown.error.get_or_insert(error.into()); } } }RankExecutor::newfailure (:697-706):
And on both scheduler failure paths (Err(error) => { let mut shutdown = Shutdown { drained: true, error: Some(error.clone()), }; let _ = ready_tx.send(Err(error)); close_store(store, &mut shutdown); return shutdown; }:714-726,:784-796):
This fixes drain reporting, error preservation, unwind retention, and deletes ~25 lines plus both ad-hocErr(error) => { let _ = ready_tx.send(Err(error.clone())); let mut shutdown = executor.close(); close_store(store, &mut shutdown); shutdown.error = Some(error); return shutdown; }std::mem::forget(store)calls in one change.
- Verified behavior & impact: All three new cleanup branches run
-
Mandatory
server-feature test suite was never compiled or run (helios/src/lib.rs:30-31,helios/Cargo.toml:2,21,25)- Verified behavior & impact:
helios/src/server/runtime.rsis gated behind#[cfg(feature = "server")](helios/src/lib.rs:30-31), andruntime-coredoes not enableserver(helios/Cargo.toml:21,25). The PR's Submission Validation (cargo test -p flare-helios --features runtime-core) therefore compiled zero lines of the diff, and the PR's Suggested test command (cargo test -p helios --features runtime-core) additionally names a nonexistent crate (helios/Cargo.toml:2isflare-helios). Perdocs/design-review.md:180-184,247-251and.github/workflows/native-serving.yml:63 (not opened),68, leaving the applicable CPU crate test unrun blocks merge. - Concrete fix: Run and report the repo's standard Helios test command (with
FLARE_TEST_TEMPLATE_DIR/ulimit -lperAGENTS.md:317-327):
and correct the suggested test command in the PR description.cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server
- Verified behavior & impact:
Should Fix
None.
Subtract / Simplify
- Deduplicate the three post-open cleanup paths into
close_store(helios/src/server/runtime.rs:697-706,:714-726,:784-796,:1344-1364): Covered in Blocker #1—extractingWorker::close_storeinto a module-level helper eliminates ~25 newly added lines, removes bothstd::mem::forget(store)calls, and unifies all four teardown paths under the existingManuallyDropcontract already tested byhelios/src/server/runtime/phase_tests.rs:2262-2363.
Nits
helios/src/server/runtime.rs:663-682: Pre-existing code moved verbatim, so optional—flattening the.and_then(...).map(...).transpose()3-tuple chain into a singleand_thenreturningOption<Result<_>>would make the store-open block a few lines shorter.
Dropped on verification
- Upstream Dossier #5 / Correctness table ("Cause #1:
kv_codec_gpudeferral inhelios/src/runtime_core/mod.rscould not be located in the tree"): Verified false.helios/src/runtime_core/mod.rs:755-792definesunsafe fn prepare_kernels(..., skip_module: Option<&str>)and skipsmodule.name == skip_module(:788-791), called withcodec_gpu_module.as_deref()athelios/src/runtime_core/model.rs:628,821. Cause #1 in the PR description is accurate. - Upstream Correctness A2 ("
drained: trueonoffload::openfailure atruntime.rs:684-690is an unverified assumption"): Verified safe / false alarm. No executor or GPU kernel exists yet at:684-690, and on mid-way failure insideflare_selene::offload::open(selene/src/offload.rs:802-891), already-started rank threads are joined byTransfers::drop(helios/src/offload/transfer.rs:653,841-852) and any started pool client is closed/joined byPoolClient::drop(selene/src/pool/client.rs:343-347). - Upstream Correctness B2 ("
worker_metrics.codec_placementnow leaves a metrics object advertising codec placement when startup aborts"): Verified false.metricsis a localArc<Metrics>constructed insideModelRuntime::start_retaining_drain(helios/src/server/runtime.rs:623-640) and is dropped without ever being returned or exposed when startup returnsErr(StartFailure)(:863-878). Printingintake_warning()slightly earlier to stderr on offload open is benign. - Upstream Subtraction #2 ("Move
codec_placementandintake_warninginsidecrate::offload::open"): Dropped as architecturally invalid / counterproductive.helios/src/offload/mod.rscompiles unconditionally (helios/src/lib.rs:19), whereascrate::server::metrics::Metricsonly exists under#[cfg(feature = "server")](helios/src/lib.rs:30-31). Threading callbacks and alog_to_stderrflag intooffload::openwould worsen coupling rather than simplify it. - Upstream Correctness B1 ("Early
binding.take()makesBinding::sharded()returnfalselater in startup"): Dropped as low-signal / no live issue. Verified the only caller (runtime.rs:645) executes beforebinding.take(), andRankExecutor::new/ThreadedExecutoronly readcopy_gate(),shares(), andrank()(helios/src/execution/ranks.rs:127,helios/src/execution/threaded.rs:1286-1290). - Upstream Correctness D2 ("Add a mock/test-double ordering regression test for
ModelRuntime::start"): Dropped as over-engineered.ModelRuntime::startconstructs a real CUDARankExecutor; introducing mock traits solely to test call ordering insideModelRuntime::startwould add abstraction overhead discouraged bydocs/design-review.md:187-189. Sharingclose_store(Blocker #1) plus running the realserver-feature test suite (Blocker #2) is the right bar. - Upstream Correctness D1 ("
exact LIFO-symmetricclaim inaccurate on error paths"): Folded into Blocker #1 as a direct corollary.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 99.9% -
triage:design-review: 0.1% -
triage:validation: 0.0% -
none: 0.0% -
triage:partial: 0.0% -
triage:integration: 0.0% -
triage:investigate: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Apply labels
No label changes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with. decide malicious: all_clear (100%): No malicious content found
explore
Author: ebfio (first-time contributor; 0 merged PRs, 2 other open PRs #699 and #682; Discord: ebfio)
Motivation: Serving a core that uses a persistent GPU worker with --lossless-kv-compression gpu hangs forever at startup, because the GPU codec's cuModuleLoadData call is made while a persistent worker kernel is already running on the same CUDA context. The PR moves the host prefix store open ahead of executor construction so the cubin loads on an idle GPU.
Scale: +65 / −53 in 1 file
Proposal:
- Move
crate::offload::open(prepared, gpu_cubins, copy_gate)beforeRankExecutor::new(...), readingmanifest.offloaddirectly. - Add one
close_store(...)helper that keeps registered slabs viaManuallyDropwhile undrained and preserves close errors. - Route all three early startup-failure paths (executor, scheduler construction, scheduler configuration) through it.
- Delegate
Worker::close_storeto the same helper so startup and shutdown share one contract. Touches: helios/src/server/runtime.rs— startup ordering, error paths, drain/ownership semantics for the host prefix store. Related items:- #709 Unblock lossless KV compression across Ignition, selene-manager, and Helios Green Contexts (merged): ships the identical reorder and helper; #698 is a duplicate of it.
- #504 add pure-CUDA GPU and CPU lossless KV compression (merged): introduced the hazard and the
offload::opencall being moved. - #701 GKV1 shares
rank.execution_context()on SM103 (open, priority:P1): post-fix contention issue filed by the same author, reproducing only after this deadlock is fixed. - #723 fleet-wide 2-way codec green contexts (open): extends the codec-context isolation that covers #701.
- #640 persistent workers on rank 0 of local multi-rank cores (open): same kernel-before-work ordering class in the threaded executor.
Link: https://github.com/NVIDIA/hyperflare-inference/pull/698
Autobot comments: Head
501bb0e9fixed the two error-path blockers I originally raised (asymmetricdrained, swallowed close errors,mem::forgetleak) — those findings are withdrawn. But the fix is already onmainvia merged #709, which states it "addresses #701 and #698" and contains every element of this one-file diff plus the docs line and five drain-contract tests, so #698 is behindmaininside its own moved block and after a rebase would differ only in comment wording and oneshutdown.error = Some(error)vsget_or_insertnit. Its evidence claim still does not hold: the cited-p flare-helios --features runtime-corerun cannot compile#[cfg(feature = "server")]code, and the suggested-p heliospackage does not exist. Zero human review and no CI on either head. Residual risk onmain, not here: the startup ordering is guarded only by an#[ignore]d SM120 CUDA test.
Classify intake
Selected: triage:superseded, bug, performance, duplicate
Threshold: 65%
Triage
- [✓]
triage:superseded: 99.8% -
triage:review: 0.1% -
triage:verify-for-closure: 0.0% -
triage:partial: 0.0% -
triage:design-review: 0.0% -
triage:validation: 0.0% -
triage:investigate: 0.0% -
triage:integration: 0.0% -
none: 0.0%
Priority
-
priority:P1: 51.5% -
none: 35.4% -
priority:P2: 13.0%
Type
- [✓]
duplicate: 99.9% - [✓]
bug: 81.8% - [✓]
performance: 73.1% -
community: 29.4% -
enhancement: 1.4% -
documentation: 0.2%
Area
-
area:selene: 59.3% -
area:caching: 32.1% -
area:kernels: 29.4% -
area:preparation: 26.9% -
area:scheduling: 13.3% -
area:memory: 5.3% -
area:packaging: 4.7% -
area:orbit: 3.3% -
area:rocenante: 1.4% -
area:api: 1.2% -
area:engram: 0.5%
Model
-
model:deepseek-v4.1: 1.8% -
model:deepseek-v4: 1.1% -
model:kimi-k3.1: 1.0% -
model:glm-5.3: 0.9% -
model:nemotron-3.5-bolt: 0.5% -
model:inkling-small: 0.3% -
model:qwen3.8-27b: 0.3% -
model:muse-glimmer: 0.2% -
model:qwen3.8-flash-next: 0.2% -
model:mimo-v2.6: 0.2% -
model:gemma4: 0.0%
Apply Labels (Intake)
Applied: +triage:superseded, +performance, +duplicate, -triage:review
Gates and contracts
Contracts, Charter & Verification Gates Audit — PR #698 @ 501bb0e
Scope of this lens: the 4 hard gates only (signed contract/core-format boundaries, vendored upstream deps / cross-PR conflicts, mandatory verification evidence, material scope/claim contradictions). Algorithm and lifecycle-correctness findings belong to the Code Correctness lens and are not repeated here.
Verdict
1 hard gate violated: Gate 3 (mandatory Layer‑1 verification for the affected crate). Everything else passes, with one material non-gate fact (the PR is fully superseded by merged #709) and one claim contradiction inside the same evidence line.
- Gate 1 — Signed contract / core-format / captured-graph / normative-doc boundaries: PASS
- Gate 2 — Vendored upstream dependencies & cross-PR conflicts: PASS (no vendored fork, no unpinned dependency); superseded status recorded separately
- Gate 3 — Mandatory verification evidence: FAIL (one blocker, cited below)
- Gate 4 — Material scope / claim contradictions: one material finding, no scope bundling
Gate 1 — Signed contract, core-format, wire, captured-graph, normative docs: PASS
The diff (pr_diff, result 1) is 1 file, helios/src/server/runtime.rs (+65/−53). It adds no Protobuf field, no core-format enum or version, no wire kind, no captured-graph operation family, no new CLI flag or knob:
- The moved block is the pre-existing
crate::offload::open(prepared, gpu_cubins, copy_gate)chain, relocated from afterRankExecutor::newto before it; the only semantic edit inside it isexecutor.manifest().offload→manifest.offload. close_store(helios/src/server/runtime.rs:1137-1157) is the verbatim body of the existingWorker::close_store, extracted to a free function;Worker::close_storenow delegates (:1353-1355). No contract changes.- Because no captured-graph operation contract is added, the owner-approval requirement in
docs/design-review.md:22-25("Introducing a captured-graph operation family requires prior explicit approval from project owner Luke Alonso … A new operation contract requires approval even if it reuses a graph kind or enum value") is not triggered — no sign-off is outstanding on that axis. - No contradiction of
docs/scheduling-theory.md(not opened),docs/scheduling-runtime-design.md(not opened), ordocs/core-format-design.md(not opened): the change affects neither graph selection, pricing, timing estimation, cohort policy, nor any core-format field.docs/core-format-design.md(not opened) is untouched by the diff and the PR alters no exported artifact. - The doc for this exact ordering already exists on
mainand is consistent with the PR, not contradicted by it:docs/runtime-core-design.md:684onmainrequires the store to be opened "before constructingRankExecutorsocuModuleLoadDatafor embedded GPU codec" does not race the worker, anddocs/prefix-cache-offload.md:63onmainsays the same ("cuModuleLoadData) before starting the persistent worker graph"). Neither sentence is present onpr/698(verified:search_codeonpr/698for "before starting the persistent worker graph" → no matches), but that is a docs gap inherited from the branch point, not a contradiction of a normative invariant. Since the PR does not contradict a normative doc and no shipped default behaviour is altered beyond call ordering, no Gate‑1 violation.
Gate 2 — Vendored upstream dependencies & cross-PR conflicts: PASS
- No vendored upstream fork. The diff touches no file under
helios/native/(e.g.roce_proxy.c(not opened)), nothird_party/, noTHIRD_PARTY_NOTICES.md(not opened), and no C/CUDA source. Nothing here mirrors an unmerged upstream PR. - No dependency or pin change.
helios/Cargo.tomlis unchanged by the diff; the existing git pins (helios/Cargo.toml:35-37,deepseek-recipeatrev = "70be62f30…") are untouched. No new external recipe dependency, no unlinked external PR dependency. - Cross-PR conflict — material, but a duplicate rather than a vendored/pin violation. #709 ("Unblock lossless KV compression across Ignition, selene-manager, and Helios Green Contexts", lukealonso) is merged (confirmed via
search_items, result 26) and has already landed this exact code onmain: the identical reorder block athelios/src/server/runtime.rs:760-794onmain(crate::offload::openat:782,RankExecutor::newat:798, with the same comment "open the host prefix store before …cuModuleLoadData") and the byte-identicalclose_storehelper atmain:1282-1302. So #698's one-file diff is already onmain, and #698 is behindmaininside the very hunk it edits. This blocks merging #698 (it is superseded), but it is not a Gate‑2 governance violation — no vendored upstream file is forked and no dependency is unpinned. Recommended disposition: close as superseded with credit to ebfio'scuModuleLoadDatadiagnosis (already credited onmainby PR number athelios/src/runtime_core/persistent_worker.rs:2939(not opened)).
Gate 3 — Mandatory verification evidence: FAIL (1 blocker)
Blocker 3.1 — The reported validation does not compile a single line of the diff
docs/design-review.md:180-184 makes Layer 1 mandatory for every affected Rust crate and names the exact form: "Run cargo test --locked --release on every affected Rust crate (… helios with --features runtime-core,server …)", and docs/design-review.md:247-251 removes the escape hatch: "Disclosure does not excuse skipping runnable CPU checks. … Leaving an applicable crate test … unrun blocks commit and PR acceptance; noting it as a limitation does not make the omission acceptable."
The PR's reported validation cannot satisfy this:
helios/src/server/runtime.rsis gated#[cfg(feature = "server")] pub mod server;(helios/src/lib.rs:30-31).runtime-coredoes not implyserver:helios/Cargo.toml:21(runtime-core = ["dep:serde", … "dep:zstd"]) vshelios/Cargo.toml:25(server = [ "dep:serde", "images", "grammar", … "dep:deepseek-recipe"]). They are disjoint feature lists.- Therefore the stated Submission Validation —
cargo test -p flare-helios --features runtime-core("1243 passed; 0 failed; 37 ignored") — never compileshelios/src/server/runtime.rs, i.e. none of the +65/−53 is type-checked, let alone tested. - The stated "Suggested test command" —
cargo test -p helios --features runtime-core— additionally names a package that does not exist:helios/Cargo.toml:2isname = "flare-helios", so that command fails outright.
This is not a "no CI observable" artifact of my tooling; it is an affirmative, checkable defect in the PR's own evidence claim. The authoritative command that would cover the diff is the one CI itself uses (native-serving.yml:63 and :68: cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server, with FLARE_TEST_TEMPLATE_DIR and ulimit -l/prlimit per .github/workflows/native-serving.yml:58-63 (not opened)).
No earlier-round evidence rescues this (per the Round‑2+ calibration): I checked ## Case File History and pr_comments (result 2, two flare-autobot comments). The only recorded run is the --features runtime-core one above; no --release run with server, no check.py output, and no A/B benchmark appears in any round. The Discovery Dossier states it explicitly: "No fresh GPU startup reproduction was run for this submission."
Concrete fix: run and report
cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server
(passing FLARE_TEST_TEMPLATE_DIR and raising memlock as in native-serving.yml:58-63), then correct both commands in the PR body.
Why this is a real gate for this change (not pedantry)
- The changed file is exactly the crate/feature pair Layer 1 names, so the gate is not a stretch.
- The change is on a CUDA-ordering path:
docs/verification.md:14assigns "CUDA ordering, captured state, inactive rows, allocation stability, or resource lifetimes" to "Real execution tests on assigned GPUs", anddocs/verification.md:143-144repeats "Changes to actual GPU execution or lifetime behavior require the real execution path." The PR's own property claim (module load must precede persistent-worker launch) is a CUDA-ordering property. Under principle 12 (docs/design-review.md:106-115) the disclosure that the GPU repro was not re-run is honest but does not substitute for the CPU layer — and the GPUbefore/after(>400 s→0.6 s,1.239–1.259×,3.6 sdrain) was captured on the previous head9ed34da, before theclose_storerefactor in501bb0e, so it does not describe the code under review. - The hardening obligation is real because the PR rewrites three failure paths whose discharge contract is already unit-tested:
helios/src/server/runtime/phase_tests.rs:2288(shutdown_retains_the_store_when_its_drain_fails),:2319(…without_closing_when_the_executor_did_not_drain),:2341(…when_its_drain_panics). Those tests exist and would catch a regression in the extractedclose_store— but they are inside theserver-gated module, so the reported run never executes them either.
Layer 3 (TLA+ / Kani) — correctly not triggered; recorded so the omission is not mistaken for a skip
docs/design-review.md:212-215 requires python3 verification/helios-lifecycle/check.py when changing "admission, fences, generations, cancellation, speculation accounting, cache compaction, snapshot aliases, response buffering or ownership, offload aggregation, readiness, or rank coordination." The PR changes none of these:
- No scheduler, admission, fence, generation, cancellation, speculation, cache-compaction, or snapshot-alias code is touched.
- No response buffering/ownership code is touched (
ResponseLifecyclemaps toModelRuntime::generate_many,Incoming,Generation— unchanged). - No rank-coordination code is touched:
helios/src/execution/threaded/protocol.rs(not opened),parallel.rs(not opened),threaded.rs(not opened) are untouched, so the mandatory multi-GPU collective gate atdocs/design-review.md:252-259does not apply. - "offload aggregation" in that list is the multi-rank offload reply aggregation protocol (
verification/helios-lifecycle/README.md:10,:218-230), notoffload::openstartup ordering. - No completion-vector validation, prepared completion contract, state-view extent arithmetic, or sequential validator is modified, so Kani (
docs/design-review.md:221-225) is not triggered. - No new or changed safety guard, so
--mutations(docs/design-review.md:226-228) is not triggered.
Note that verification/helios-lifecycle/check.py:318 itself builds with --features server, so that run would have recompiled the diff. It is not required by the trigger list, so I do not raise it as a blocker — but it is the cheapest available substitute if maintainers prefer it over the full crate run.
Failing tests / failing CI: not reported — not flagged
The description reports 1243 passed; 0 failed; 37 ignored, and the Dossier reports no failing check. Per the calibration rules I am not flagging "no CI run observable."
Gate 4 — Material scope & claim contradictions: one material finding
Finding 4.1 (material) — Two claims in the PR description are contradicted by its own diff
- Evidence claim. "Suggested test command:
cargo test -p helios --features runtime-core" and "cargo test -p flare-helios --features runtime-core … 1243 passed" present a green suite as validation of this change, but as shown in Blocker 3.1 that suite excludes the modified module and the suggested package does not exist. Underdocs/design-review.md:150-160the evidence part of the description must connect to the claim; here the stated evidence is provably disconnected from the diff. - "What changed" claim is stale versus the head. The Changes section describes "Add LIFO cleanup on all early-error paths after
storeopens (store.close()directly ifRankExecutor::newfails;executor.close()first, thenstore.close()only whenshutdown.drained…)". Those ad-hoc blocks and thestd::mem::forget(store)retention mechanism no longer exist at501bb0e: the diff replaces them with the singleclose_storehelper and routes all three sites through it (helios/src/server/runtime.rs:703,:716,:780), andWorker::close_storedelegates (:1353-1355). Principle 16 requires the description's "what exactly changed" to be accurate, and a reader "must not need the diff … to reconstruct the argument."
This is a description-accuracy defect with a real governance basis (principles 12 and 16), not a phrasing nuance: it misdescribes the code under review and mis-attributes the evidence. Fix: rewrite the Changes and Verification sections against 501bb0e, state that the diff is superseded by #709, and link #701 as the follow-on.
Not flagged (deliberate)
- No scope bundling. +65/−53 in one file; no unrelated tooling, no vendored blobs, no new standalone scripts.
- No
docs/TODO.txtbookkeeping requirement, and none flagged. - No unobservable-CI flag, as above.
- Discord contact present (
Discord: ebfio), satisfyingdocs/design-review.md:163-169— no nit. - No charter violation on root-causing. The change fixes call ordering rather than swallowing/retrying the failure, matching
docs/design-review.md:143-146and the Charter's "Bug fixes need to address the root cause; don't just swallow, skip, or retry an unexplained error" (#397). It is one file, no per-model branch, no new flag — consistent with "keep the runtime small and model-agnostic" and "smallest footprint in shared code." - Informational overlap with neighbouring work (open #723 extending codec Green Contexts, #729 editing other regions of
runtime.rs) touches different hunks and is noted only asInfo: neither is a Gate‑2 dependency or pin.
Required actions to clear this lens
- Gate 3 (blocking): run and report
cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server(withFLARE_TEST_TEMPLATE_DIRand the memlock setting from.github/workflows/native-serving.yml:58-63(not opened)); correct the Suggested command to drop the nonexistent-p heliospackage. Alternatively, re-run the GPU ordering observation against501bb0eand the CPUserver-feature suite, sincedocs/verification.md:14classifies this property as CUDA ordering. - Gate 4 (should fix): rewrite the Changes and Verification sections against head
501bb0e— drop the removed ad-hoc cleanup /store.close()-directly /mem::forgetdescription, describe the singleclose_storehelper and its three call sites, and attribute evidence honestly. - Disposition (governance, not a gate): since merged #709 already contains this diff on
main(helios/src/server/runtime.rs:760-794,:1282-1302), the soundest close is "superseded by #709," explicitly crediting ebfio'scuModuleLoadDatadiagnosis and linking the P1 follow-on #701. Landing #698 after a rebase would add no code beyond comment wording.
No vendored-file or signed contract/core-format gate violations. One mandatory verification gate violation (Blocker 3.1) and one material claim contradiction (Finding 4.1).
Subtraction and simplicity
Subtraction & Simplicity Lens — PR #698 (helios/src/server/runtime.rs, +65/−53, head 501bb0e9)
The diff is small and mostly in the right direction: it replaces three hand-copied cleanup blocks with one helper and deletes the old in-line store-open block. It is not free of redundancy, and the single largest subtraction available is the PR itself (already merged to main via #709). Concrete items below, highest value first.
1. The largest subtraction: the whole diff is already on main via merged #709
Verified on main:
- reorder block:
main helios/src/server/runtime.rs:760-794(crate::offload::open(prepared, gpu_cubins, copy_gate)at:782beforelet mut executor = match unsafe { RankExecutor::new(manifest, peers) }at:798), - helper:
main :1282-1302(fn close_store(store: Option<Box<dyn flare_selene::HostStore>>, shutdown: &mut Shutdown)), - call sites:
main :805,:818,:882, - delegation:
main :1465(fn close_store(&mut self, shutdown: &mut Shutdown)).
So #698 is 100% duplicated; the only deltas are comment wording and the get_or_insert nit in item 3. There is nothing here to "simplify into a merge" — subtract the PR (close as superseded), and if attribution matters, the reorder comment is the only artifact worth landing.
2. The new store-open block threads a tuple it immediately destructures (pr :663-691)
.and_then(|binding| {
let copy_gate = binding.copy_gate();
binding
.take()
.map(|(prepared, gpu_cubins)| (prepared, gpu_cubins, copy_gate))
})
.map(|(prepared, gpu_cubins, copy_gate)| {
binding.copy_gate() is hoisted out of take() only because take() (helios/src/offload/mod.rs:78-82) returns Option<(Prepared, Vec<Arc<Vec<u8>>>)> while copy_gate lives alongside it in the same Binding struct (offload/mod.rs:40-42: inner, gpu_cubins, copy_gate). The tuple-of-three exists purely to carry one field through a closure. Subtraction: have Binding hand back what open needs — e.g. pub fn take_open(&self) -> Option<(Prepared, Vec<Arc<Vec<u8>>>, Option<Arc<CopyEngineGate>>)>, or a crate::offload::open_binding(binding: &Binding) that owns the .and_then/.map/.transpose chain. That removes the three-element tuple, the let copy_gate = … line, and keeps the invariant "one binding yields exactly one open" in the module that owns Binding, instead of repeating the copy_gate()+take() pairing in a third call site (ranks.rs:127 and parallel.rs:569 already fetch copy_gate separately).
3. close_store's error channel is dead at every new startup call site
close_store records a close failure only through shutdown.error.get_or_insert(error.into()) (pr :1154). At the three new call sites:
:703fires only insideErr(error)ofRankExecutor::new, whereshutdownwas just built as{ drained: true, error: Some(error.clone()) }(:698-701) —get_or_insertcan never store anything.:716and:780are followed byshutdown.error = Some(error);(:717,:781), which overwrites whateverclose_storejust recorded.
So 1 of 3 call sites can report a store-close failure and 2 silently discard it. main writes shutdown.error.get_or_insert(error.clone()); at :819 and twice as get_or_insert at :883. Simplification: pick one — either get_or_insert everywhere (two-line fix, matches main), or give close_store no error parameter at all and have the startup paths rely on the primary error, so the "which error wins" question stops existing.
4. Five early-return Shutdown literals in 140 lines can collapse to one helper
Shutdown { drained: true, error: Some(error) } appears at :651-655, :686-689, :697-701 (with clone), and via executor.close() at :715, :779. A single
fn failed_start(store: Option<Box<dyn flare_selene::HostStore>>, error: Error) -> Shutdown
(≈8 lines: build {drained: true, error: Some(error)}, close_store(store, &mut shutdown), return) replaces :684-690, :697-705, :771-783's tail and :713-719 — roughly 29 diff lines down to ~10, and makes the "open → executor → scheduler" ladder read as three match … else return failed_start(store, error) rungs with identical LIFO semantics. This is the same ownership reduction the helper already achieved for store, applied one level up to the shutdown value.
5. Keeping Worker::close_store as a one-line delegate is correct — do not subtract it
fn close_store(&mut self, shutdown: &mut Shutdown) {
close_store(self.store.take(), shutdown);
}
(pr :1353-1355) looks like a removable indirection, but tests call it through Worker at helios/src/server/runtime/phase_tests.rs:1759 (not opened), :2275, :2281, :2305, :2331, :2355, and it keeps self.store.take() (the "only once" invariant) on the Worker side. Keep as-is.
6. Structural note (not this PR's to fix): close_store is a second implementation of the retain-unless-drained rule
helios/src/server/session.rs:110-133 already encodes exactly this rule as DrainGuard<T> (Drop → std::mem::forget(value) while !drained). close_store (pr :1137-1157) is a hand-rolled ManuallyDrop variant of the same idea with a close hook (shutdown.drained = false; store.close()). Not a #698 regression — but if a future PR wants one abstraction, DrainGuard growing a close_with(&mut self, f) is where the second copy should go. Do not do this in #698.
7. Evidence/scope subtraction (process, but it costs review time)
- The body's suggested command
cargo test -p helios --features runtime-corenames no such package; the crate isflare-helios(helios/Cargo.toml:2). - More importantly
runtime-core(helios/Cargo.toml:21) does not implyserver(:25), andhelios/src/server/runtime.rsisserver-gated, so the stated "1243 passed" run never compiles the changed file, and the diff adds no test. The#[ignore]d SM120 ordering test (helios/src/runtime_core/persistent_worker.rs:2500-2502) is the only guard on this ordering anywhere.
Verdict
Not lean enough to merge as-is, but the only substantive simplify items are #2 (drop the (prepared, gpu_cubins, copy_gate) tuple by giving Binding an open-shaped accessor), #3 (get_or_insert at :717/:781), and #4 (one failed_start helper). All three are ~15 lines of net deletion. Given #1, my recommendation is: close #698 as superseded by merged #709, crediting ebfio's cuModuleLoadData diagnosis (which main already credits by PR number at helios/src/runtime_core/persistent_worker.rs:2939), and land only the get_or_insert wording if anyone wants the error-preservation detail.
Code correctness
Deep Code Correctness Audit — PR #698 (helios/src/server/runtime.rs, +65/−53)
Verdict: no Blocker and no Major defect found. The reordering is semantically safe with respect to every callee I resolved, close_store is a faithful behaviour-preserving extraction, and the startup path is now LIFO-symmetric with the shutdown path as claimed. One Minor correctness divergence is reported below (new store teardown under a false drained: true claim), plus two informational notes. No hot-path code changed.
Because the PR is single-file / single-subsystem (1 file, 118 changed lines, helios/ only), it was audited directly rather than partitioned into sub-agents.
Diff sites audited
helios/src/server/runtime.rs at 501bb0e:
- 657–691 new early
crate::offload::open(...)block (beforeRankExecutor::new) - 692–706
RankExecutor::newfailure path (now also closes the store) - 713–719, 777–783 scheduler construction / configuration failure paths (now
close_storeafterexecutor.close()) - 1137–1157 new free function
close_store - 1353–1355
Worker::close_storenow delegates to the free function - 784–793 unchanged
Worker::new+worker.attach_store(store) - 816–817 unchanged shutdown order (
executor.close()thenworker.close_store())
1. Callee / design-invariant resolution — the reordering is safe
(a) manifest.offload still carries everything RankExecutor::new reads. The moved block calls binding.take() (line 669), which drains Shared::prepared:
// helios/src/offload/mod.rs:78-83
pub fn take(&self) -> Option<(Prepared, Vec<std::sync::Arc<Vec<u8>>>)> {
self.inner
.take()
.map(|prepared| (prepared, self.gpu_cubins.clone()))
}
RankExecutor::new reads only the gate, not the payload:
// helios/src/execution/ranks.rs:123-143
pub(crate) unsafe fn new(manifest: ExecutionManifest, peers: Option<RankPeers>) -> Result<Self> {
let copy_gate = manifest.offload.as_ref().and_then(|b| b.copy_gate());
...
Ok(Self { inner, leases: PeerGraphLeases::new(copy_gate, peer_copy_graphs) })
}
and copy_gate is a plain Arc field on the helios wrapper, unaffected by take() (helios/src/offload/mod.rs:42, 58-60). All three executor constructors (transport.rs:604-611, threaded.rs:625-644, parallel.rs:114-145) read only persistent_workers, graphs, peer_copy_graphs, completion_token_capacity, input_frame_bytes, buffers, tuning_graphs — never offload's taken payload. Contention check on the other manifest.offload readers: threaded.rs:1286-1290 (same_layout → a.shares(b)) and runtime.rs:645 (!binding.sharded()) both resolve against Shared, and selene/src/offload.rs:530-532 / 540-545 compare Arc::ptr_eq and prepared.shards; sharded() is evaluated at line 645, before the take() at 669, so the "requires every rank in one process" guard is not made dead code by the reordering. runtime.rs:609 binding.inputs() clones shared.inputs, also independent of prepared.
(b) offload::open has no dependency on RankExecutor having run. helios/src/offload/mod.rs:135-144 → selene/src/offload.rs:802-891 → Copiers::start (transfer.rs:2190-2210) → Transfers::start_parts → RankWorker::open (transfer.rs:395-421), which does its own Stream::open_lowest_priority(context, device); Stream::bind (cuda.rs:740-756) issues cuCtxSetCurrent itself, so it does not rely on the model thread's current context. The GKV1 module load happens inside RankCodec::new (transfer/codec.rs:102-132) → GpuRankCodec::new → stream.load_module(cubin) (transfer/gpu_codec.rs:282, cuda.rs:1152).
(c) The deadlock premise is confirmed in-tree. The codec module is deliberately skipped during kernel preparation (runtime_core/mod.rs:755-761, skip_module), documented normatively at docs/prefix-cache-offload.md:112-119 ("Helios skips loading that module when compression is off or cpu, and loads it lazily via cuModuleLoadData"), while the persistent worker is launched inside executor construction at transport.rs:793-805 (finish_startup → control.start()?) after tuning graphs have already run (transport.rs:604-611). So before this PR the module load really could be issued while the worker kernel was resident. The new order closes that window for all three peer modes (persistent workers are rejected for RankPeers::Threads/Processes, threaded.rs:632-638, parallel.rs:122-126, so the single-rank GraphExecutor path is the one that matters). The fix is effective.
(d) Reverse deadlock check (does opening first break the executor?) No. Post-open there is no further cuModuleLoadData on any path reachable after a worker launch: all CopierFactory::mapped/unmapped calls (transfer.rs:2213-2232) are reachable only from offload::open, and the multi-host peer path shard::join_peer (selene/src/offload/sharded.rs:477) runs before Server::start from the CLI (flare-cli/src/cluster.rs:254), i.e. before any worker launch. The store's transfer threads are idle at that point (no jobs queued), so control.start() at transport.rs:804 cannot be blocked by them.
(e) close_store extraction is exact. Original Worker::close_store and the new free function are character-identical apart from the Option source:
// helios/src/server/runtime.rs:1137-1157
fn close_store(store: Option<Box<dyn flare_selene::HostStore>>, shutdown: &mut Shutdown) {
let Some(store) = store else { return; };
let mut store = std::mem::ManuallyDrop::new(store);
if !shutdown.drained { return; }
shutdown.drained = false;
match store.close() {
Ok(()) => { shutdown.drained = true; drop(std::mem::ManuallyDrop::into_inner(store)); }
Err(error) => { shutdown.error.get_or_insert(error.into()); }
}
}
self.store.take() is evaluated before the call at 1354, identically to the old let Some(store) = self.store.take() else { return; }, so the "store removed even when not closed" invariant (exercised by phase_tests.rs:2311, 2334, 2359) is preserved. Worker::close_store still exists with the same signature, so phase_tests.rs:1759/2275/2281/2305/2331/2355 still compile and pass unchanged. The early-return-on-!drained leak of ManuallyDrop matches the normative rule at docs/prefix-cache-offload.md:879-883 ("If either drain fails, the store and its resource owners remain alive together with the model resources"). Hot-path cost: zero — close_store is reached only at startup-failure and shutdown, never in the request loop.
2. Order-of-operations / state-transition tracing
The new startup sequence is now store.open → RankExecutor::new → scheduler → attach_store and shutdown is executor.close() → close_store — exact LIFO as the comment at 657-662 claims. Per-branch drain-flag trace:
| path | line | drained before |
close_store behaviour |
result |
|---|---|---|---|---|
| store open fails | 683–690 | true (inlined) |
not called; store is None-transposed Err, nothing to leak |
drained: true, correct — open returns before any store object exists, and its partially started Transfers are joined by Drop for Transfers (transfer.rs:841-851) |
RankExecutor::new fails |
698–705 | true asserted |
store close() + drop |
see Minor finding 1 |
| scheduler construction fails | 713–719 | from executor.close() |
closes only if executor drained | matches doc invariant |
| scheduler configuration fails | 777–783 | from executor.close() |
as above | matches doc invariant |
ready_tx.send(...) now precedes close_store on the RankExecutor::new path; the caller's thread.join() at runtime.rs:851 still synchronizes on the store close, so the reported StartFailure.drained cannot be observed before teardown finishes, and a panic inside close_store still surfaces as drained: false through unwrap_or_else at 851-854. No stale-flag read: shutdown.drained is written at 1147 and re-set at 1150 within the same call, and no later statement in any caller reads it before returning.
3. Adversarial boundary checks
manifest.offload == None→store = Noneat 683,worker.attach_store(None)at 793 →scheduler.enable_publications()/enable_evictions()correctly not called (runtime.rs:1320-1328). Unchanged.offload == Somebut payload already taken (take()→None) → whole chain isNone→ startup proceeds with offload silently disabled. Pre-existing behaviour, not introduced here (identical chain existed pre-PR, just afterexecutor.manifest()); noted only as a latent trap, not counted as a defect of this diff.geometryempty →prepared.geometry.first()isNone,codec_placementskipped;Copiers::startwould reject the empty context/geometry pair attransfer.rs:542-548. Unchanged.log_to_stderrfalse → warning suppressed as before; only its position moved earlier, which cannot flip any metric gate (Metrics::storeatmetrics.rs:566only gains the placement earlier).
4. Hot-path complexity / allocations
No changed line lies on a per-step, per-request, or eviction path. The moved block is one-shot startup: a Vec<Arc<Vec<u8>>> clone of gpu_cubins (offload/mod.rs:81), an Arc clone for the gate, and one Box<dyn HostStore> move — no new per-iteration allocation, no new O(N) scan. close_store adds one indirect call plus a ManuallyDrop wrapper at shutdown only.
Findings
Minor 1 — RankExecutor::new failure now tears down the store under an unverified drained: true
Sites: helios/src/server/runtime.rs:697-705 (diff) vs helios/src/execution/transport.rs:1383-1387 and helios/src/execution/ranks.rs:129-140 (callee).
// helios/src/server/runtime.rs:695-706 (diff)
let mut executor = match unsafe { RankExecutor::new(manifest, peers) } {
Ok(executor) => executor,
Err(error) => {
let mut shutdown = Shutdown { drained: true, error: Some(error.clone()) };
let _ = ready_tx.send(Err(error));
close_store(store, &mut shutdown); // <-- closes + DROPS the store
return shutdown;
}
};
RankExecutor::new can return Err after GPU resources exist and were retained, because a constructed GraphExecutor on the error path is dropped and Drop→close() deliberately leaks on a failed drain:
// helios/src/execution/transport.rs:1383-1387
if drained { drop(resources); } else { std::mem::forget(resources); }
Reachable Err-with-retained-resources paths inside ranks.rs:129-140: GraphExecutor::new's tuning loop and finish_startup() → control.start()? (transport.rs:604-611, 793-805).
Counterexample: a core with a persistent worker whose green-context control.start() fails after partially launching the kernel, or whose tuning graph fails such that cuStreamSynchronize times out. RankExecutor::new returns Err with the resources mem::forget-ed; the new code reports drained: true, calls store.close() and then drop(store) at 1151, releasing the store's registered host slabs and pool device parts on the very contexts whose drain just failed. Pre-PR this was harmless because no store existed yet on that path; post-PR it is a new teardown under a false drain claim. The claim also propagates outward as StartFailure.drained (runtime.rs:864 → server.rs:443 → session.rs:76 → DrainGuard), which is exactly the signal telling the caller it may release the prepared core's CUDA contexts.
Concrete fix: do not assert drain on a constructor that cannot report it. Either (a) keep the store un-closed on this path (Shutdown { drained: false, error }, so close_store hits the !shutdown.drained early return and leaks via ManuallyDrop, matching docs/prefix-cache-offload.md:879-883), or (b) add a RankExecutor::try_new that returns Result<Self> plus the drop-time Shutdown so the true status can be threaded through. Option (a) is a two-line change and is strictly conservative.
Minor 2 — no test covers the new early-error store teardown
The three newly added close_store(store, &mut shutdown) call sites (703, 716, 780) have no counterpart in phase_tests.rs; only the Worker::close_store paths are covered (phase_tests.rs:2263-2363, four tests). The riskiest new branch — RankExecutor::new failure (Minor 1) — is therefore unverified. Suggested test: a FakeStore (already present at phase_tests.rs:2122) attached through a start_retaining_drain failure injected after store opens, asserting close_calls == 0 and drops == 0 when the executor did not drain.
Informational — normative doc now contradicts the code
docs/prefix-cache-offload.md:840-842 states "ModelRuntime::start constructs the configured store on the model thread after the executor exists". That is the invariant this PR intentionally inverts (the doc's shutdown clause at 879-883 is still accurate). Flagged as an invariant-tracking note for the documentation lens, not counted as a code defect.
What I confirmed is not broken (checked, no finding)
binding.take()beforeRankExecutor::newdoes not starve any executor constructor orsame_layout/shardedcheck (all readSharedmetadata or the separatecopy_gate/gpu_cubinsfields).- Gate identity is preserved: the same
Arc<CopyEngineGate>reaches bothPeerGraphLeases::new(ranks.rs:127) and the store'sCopiers(offload/mod.rs:142), so per-graph copy coordination still works after the reordering. - The early paths' move of
storeinside a diverging match arm and its later use at line 793 is accepted by the borrow checker and correct. - Drain semantics of the two scheduler-failure paths match
Worker::close_storeexactly, including the panic-safety property tested atphase_tests.rs:2341-2363. - No hot-path change; no new allocation in any loop.
Full report Merge Risk: medium_high (100%): Medium or high merge risk (core runtime/scheduler/GPU/CUDA/VMM/RoCE/multi-rank/contracts/ABI, large multi-crate changes, or Blocker/Major findings) — route to Super Agent.
Re-review
Recommendation: Close
Commit 501bb0e cleanly resolved Round 1's ownership/drain blocker by extracting the shared close_store helper and routing all three early-error paths and Worker::close_store through it (with zero verified code bugs remaining). However, PR #698 is now 100% superseded by already-merged PR #709 (e899a4f, which explicitly states it addresses #698 and #701), and #709 already landed this exact helios/src/server/runtime.rs reorder and close_store helper on main together with close_store unit tests, updated docs, and explicit #698 credit in code (helios/src/runtime_core/persistent_worker.rs:2939). Recommend closing PR #698 as superseded by #709 with explicit credit to @ebfio for the GB300 cuModuleLoadData deadlock diagnosis, rather than asking for a rebase and server-feature test re-run that would produce zero functional diff.
Merge Risk
Level: Low
- Already landed & conflicting with
main: The single-file diff inhelios/src/server/runtime.rs(+65/−53) is completely duplicated by merged#709(main helios/src/server/runtime.rs:760-794,:798-886,:1282-1302,:1465-1467) and cannot merge as-is; rebasing ontomainleaves no functional change. - No code correctness or hot-path defects in
501bb0e: AllRankExecutor::newconstructors (GraphExecutor::new,ThreadedExecutor::new,TensorParallelExecutor::new) enforce drain-or-abort on failure, andclose_storepreserves theManuallyDropslab-retention and panic-safety contract with zero hot-path overhead. - Unresolved verification gap on this branch: The PR's reported validation (
cargo test -p flare-helios --features runtime-core) still does not compile#[cfg(feature = "server")]code, though the landed equivalent onmainpassed theruntime-core,serversuite and SM120 3-way Green Context CUDA test in#709.
Walkthrough
helios/src/server/runtime.rs:657-691: Movescrate::offload::open(prepared, gpu_cubins, copy_gate)ahead ofRankExecutor::new(manifest, peers)(after the multi-process non-sharded check at:644-656), readingmanifest.offloaddirectly soGpuRankCodec::newfinishescuModuleLoadDatabefore persistent GPU workers launch.helios/src/server/runtime.rs:695-706,:713-719,:777-783: Replaces Round 1's ad-hoclet _ = store.close()/std::mem::forgetblocks on all three post-open startup failure paths with calls to the sharedclose_store(store, &mut shutdown)helper.helios/src/server/runtime.rs:1137-1157,:1353-1355: Extractsfn close_store(store: Option<Box<dyn flare_selene::HostStore>>, shutdown: &mut Shutdown)preservingManuallyDropretention when!shutdown.drained, on close error, or on unwind, and delegatesWorker::close_storeto it.mainsupersession (#709):main helios/src/server/runtime.rs:760-794,:798-886,:1282-1302,:1465-1467already carry the identical reorder andclose_storehelper, plusphase_tests.rs:2399-2459,docs/prefix-cache-offload.md:59-63,docs/runtime-core-design.md:684(not opened), and credit atpersistent_worker.rs:2939.
Pre-merge Checks
- [PASS] Security / malicious screen: Single-file startup reorder and teardown helper extraction in
helios/src/server/runtime.rs; no newunsafeblocks, dependencies, flags, or external I/O. - [PASS] Charter & value fit: Root-cause startup-ordering fix for a real CUDA deadlock (
#397) with minimal model-agnostic footprint; contributor@ebfio's diagnosis directly informed#709and follow-on P1#701and should be credited on close (#229). - [WARN] Related / duplicate / conflict check: Fully superseded by merged
#709(same hunk inhelios/src/server/runtime.rsalready onmain, plus tests and docs); conflicts withmainas-is. - [WARN] Tests & verification evidence: Reported
cargo test -p flare-helios --features runtime-coreomitsserver(helios/src/lib.rs:30-31,helios/Cargo.toml:21,25) and suggested-p heliosdoes not exist (helios/Cargo.toml:2), so zero lines of501bb0ewere compiled or tested here.
Blockers
-
PR is fully superseded by merged PR #709 (
helios/src/server/runtime.rs:657-783, 1137-1157, 1353-1355vsmain helios/src/server/runtime.rs:760-886, 1282-1302, 1465-1467)- Verified behavior & impact: Merged PR
#709("Unblock lossless KV compression across Ignition, selene-manager, and Helios Green Contexts") explicitly addresses#698and already landed every element of this single-file diff onmain: the pre-RankExecutor::newcrate::offload::openreorder (main :760-794), the byte-identicalclose_storehelper (main :1282-1302), all three early-error call sites (main :805, :818, :882), andWorker::close_storedelegation (main :1465-1467).#709also landed the four-caseclose_storeunit test (main helios/src/server/runtime/phase_tests.rs:2399-2459), updated docs (main docs/prefix-cache-offload.md:59-63,docs/runtime-core-design.md:684(not opened)), and credited#698in code (main helios/src/runtime_core/persistent_worker.rs:2939). Rebasing#698ontomainleaves zero functional diff. - Concrete fix: Close PR
#698as superseded by#709, explicitly thanking and crediting@ebfiofor diagnosing the GB300cuModuleLoadDatastartup deadlock (and noting that their follow-on P1 report#701was addressed by#709's 3-way codec Green Context and extended in#723).
- Verified behavior & impact: Merged PR
-
Prior Blocker #2 (Gate 3) remains unresolved — mandatory
server-feature test suite was never compiled or run (helios/src/lib.rs:30-31,helios/Cargo.toml:2,21,25)- Verified behavior & impact:
helios/src/server/runtime.rsis gated on#[cfg(feature = "server")](helios/src/lib.rs:30-31), which is disjoint fromruntime-core(helios/Cargo.toml:21,25). The reported validation (cargo test -p flare-helios --features runtime-core) never compiled or tested any line of501bb0e, and the suggested command (cargo test -p helios --features runtime-core) names a nonexistent package (helios/Cargo.toml:2isflare-helios). Perdocs/design-review.md:180-184, 247-251, leaving the applicable Layer-1 crate test unrun blocks merge. - Concrete fix: Moot if closing as superseded by
#709(which already validated the landed code under--features runtime-core,server). Only if this branch were ever rebased and pursued for any remaining change would it require runningcargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server.
- Verified behavior & impact:
Should Fix
None.
Subtract / Simplify
- Close PR #698 as superseded by merged
#709(helios/src/server/runtime.rs): The cleanest subtraction is closing the PR rather than carrying a redundant rebase; every functional line is already onmain(main helios/src/server/runtime.rs:760-886, 1282-1302, 1465-1467).
Nits
helios/src/server/runtime.rs:716-717,:780-781:shutdown.error = Some(error);overwrites any error recorded byclose_store(store, &mut shutdown)on the previous line (main :819, :883usesshutdown.error.get_or_insert(error.clone());and signalsready_txafterclose_store). Benign in501bb0ebecauseready_tx.send(Err(error.clone()))already deliverederrorto the caller (:855-864), which only readsshutdown.drainedonOk(Err(error)).- The PR description still describes Round 1's removed ad-hoc cleanup (
store.close()directly /std::mem::forget) rather than501bb0e'sclose_storehelper; no rewrite needed if closing as superseded.
Dropped on verification
- Round 1 Blocker #1 (
HostStore::closeownership violation andstd::mem::forgetleak): Resolved in501bb0evia sharedfn close_store(helios/src/server/runtime.rs:1137-1157) andWorker::close_storedelegation (:1353-1355). - Code Correctness Audit Minor 1 ("
RankExecutor::newfailure tears down the store under an unverifieddrained: true"): Verified false against all threeRankExecutor::newcallees. Every constructor enforces"Constructor failure cannot return an undrained ownership lease"by callingstd::process::abort()whenever startup GPU drain cannot be confirmed (helios/src/execution/transport.rs:778-782,helios/src/execution/threaded.rs:711, 722, 739, 760, 794-821,helios/src/execution/parallel.rs:154, 168, 201-204). For persistent workers,finish_startup→control.start()(transport.rs:804,helios/src/runtime_core/persistent_worker.rs:410-430, 611-630) issues a singlecuGraphLaunch: on errorWorkerStateremainsIdle(nothing launched), and on successGraphExecutor::newreturnsOk. Thus anErrreturn fromRankExecutor::newis always drained (matchingmain helios/src/server/runtime.rs:801-807). - Code Correctness Audit Minor 2 ("No test covers early-error store teardown"): Moot —
#709already landedearly_startup_close_store_preserves_drain_and_slab_retention_contractonmain(main helios/src/server/runtime/phase_tests.rs:2399-2459). - Code Correctness Audit Informational ("
docs/prefix-cache-offload.md:840-842contradicts code"):#709already documented the new ordering onmain(docs/prefix-cache-offload.md:59-63,docs/runtime-core-design.md:684(not opened)); the older line in section 2.8 (main docs/prefix-cache-offload.md:889-890) is a minor doc cleanup onmain, not a reason to keep#698open. - Subtraction Audit #2, #4, #6 (
Binding::take_open/open_binding,failed_starthelper,DrainGuard::close_with): Dropped as out-of-scope refactoring churn for a minimal, already-superseded fix. - Subtraction Audit #3 & Gates Audit Finding 4.1 (
shutdown.error = Some(error)overwrite and stale PR description): Downgraded to Nits (non-blocking given theClosedisposition and the verifiedready_txflow athelios/src/server/runtime.rs:850-865).
Classify triage
Selected: triage:superseded
Threshold: 65%
Triage
- [✓]
triage:superseded: 99.9% -
triage:review: 0.1% -
triage:verify-for-closure: 0.0% -
triage:integration: 0.0% -
none: 0.0% -
triage:partial: 0.0% -
triage:validation: 0.0% -
triage:design-review: 0.0% -
triage:investigate: 0.0% Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.
Apply labels
No label changes