#1 [high] PR #698 correctness findings (verified at head 9ed34da)
FINDING A (Major) — swallowed store.close() error, drained reported true. helios/src/server/runtime.rs:697-706:
Err(error) => {
if let Some(mut store) = store {
let _ = store.close();
}
let _ = ready_tx.send(Err(error.clone()));
return Shutdown {
drained: true,
error: Some(error),
};
vs the file's own convention helios/src/server/runtime.rs:1354-1362 (Worker::close_store):
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()); }
}
selene/src/store.rs:334-337 trait contract: "On failure the caller must retain the store: transfer jobs may still reference its registered host buffers and GPU destinations."
Impact: on a close failure the store Box is dropped (only Transfers::drop joins threads, helios/src/offload/transfer.rs:841-852) and StartFailure.drained=true is handed to flare/src/controller.rs:2906 lease.drained = failure.drained; which then frees the core/GPU lease while registered slabs may still be referenced. Same swallow at :717-723 and :787-793 (there let _ = store.close() after drained check, error dropped, drained stays true).
Fix: fold these into one helper mirroring close_store: on close error set drained=false and shutdown.error.get_or_insert(error).
FINDING B (Minor/Major) — PR text claim "Startup is now exact LIFO-symmetric with the existing shutdown path" is false; see A. Also drained:true on the RankExecutor::new branch is pre-existing (context lines), but the new store close makes it a live swallow.
FINDING C (Minor) — early binding.take() makes Binding::sharded() lie. selene/src/offload.rs:539-545 sharded() returns is_some_and(|p| !p.shards.is_empty()) on the shared payload; after runtime.rs:663-671 takes it, every Binding::sharded() returns false for the remainder of startup. Guard at runtime.rs:644-656 still runs before, and today's only consumers during executor construction are ranks.rs:127 (copy_gate) and threaded.rs:1286-1290 (shares/rank), so no live break, but any future use inside RankExecutor::new silently sees "not sharded".
FINDING D (Minor) — metric/warning ordering shift. runtime.rs:673-678 now fires worker_metrics.codec_placement() and the intake_warning eprintln before executor construction, i.e. also on startups that fail afterwards, and for every offload config (cpu/gpu/disk), not just GKV1. metrics.rs:558-560 sets a once-gauge (set → error if set twice) and metrics.rs:566 gates publishing decode stats on codec_state != Off, so a failed startup now leaves codec_state set on the metrics object.
FINDING E (Major, evidence) — claimed validation compiles none of the diff. helios/src/lib.rs:30 #[cfg(feature = "server")] pub mod server;; helios/Cargo.toml:25 server = ["dep:serde", "images", "grammar", ...]; cargo test -p flare-helios --features runtime-core does not enable it. PR's "Suggested test command: cargo test -p helios ..." names a package that does not exist (helios/Cargo.toml:2 name = "flare-helios"). No test added/modified in the 1-file diff (+52/−31, helios/src/server/runtime.rs only).
FINDING F (Minor) — no ordering regression test exists: no test in helios/src/server/runtime/phase_tests.rs or elsewhere asserts offload::open precedes persistent-worker launch; the fix is unlocked by a comment only (runtime.rs:657-662).
POSITIVE: happy-path LIFO is right — attach_store at :806 after executor construction, shutdown executor.close() then worker.close_store() at :829-830; ordering vs the multi-rank guard (:644-656) preserved; CopyEngineGate cannot deadlock during this new window because no peer graph has been entered yet (copy_gate.rs:173-195 must_wait only on peer_graphs_active/waiting).
#2 [high] Research summary
Reviewed PR #698 (1 file, +52/−31, helios/src/server/runtime.rs) in context: the reordered crate::offload::open block, RankExecutor::new/GraphExecutor::finish_startup/control.start(), Worker::attach_store/close_store, the HostStore::close trait contract in selene/src/store.rs, selene::offload::open, Transfers::start_parts/Drop, GpuRankCodec::new/cuModuleLoadData, the CopyEngineGate, the sharded Binding, and the StartFailure.drained consumption in flare/src/controller.rs.
Findings (details and verbatim quotes in scratchpad note 1):
- Major: the new cleanup on the
RankExecutor::newerror path (runtime.rs:697-706) doeslet _ = store.close()and still returnsdrained: true, contradicting the trait contract (selene/src/store.rs:334-337) and this file's ownclose_storeconvention (runtime.rs:1354-1362), which clearsdrainedand preserves the error. The same swallow of a close error appears at:717-723and:787-793. Becauseflare/src/controller.rs:2906setslease.drained = failure.drained, a failed store close can free the core/GPU lease while registered slabs may still be referenced. - Major (evidence): the cited
cargo test -p flare-helios --features runtime-corecannot compile the changed module (helios/src/lib.rs:30,helios/Cargo.toml:25—serveroff), and the PR's "suggested"-p heliosnames a nonexistent package (helios/Cargo.toml:2). No test added; no ordering regression test exists for this fix. - Minor: taking
binding.take()beforeRankExecutor::newmakesBinding::sharded()(selene/src/offload.rs:539-545) return false for the rest of startup — no live break today only because the guard at:644-656runs first and executor construction only readscopy_gate/shares/rank. - Minor:
codec_placementgauge and theintake_warningstderr line now fire before executor construction (:673-678), for every offload configuration and on startup paths that then abort. - Claim accuracy: "exact LIFO-symmetric with the existing shutdown path" is true for the happy path (
:806,:829-830) but false for the error paths above. - Positive: ordering vs the multi-rank guard is preserved,
CopyEngineGatecannot deadlock in the newly widened window (no peer graph entered yet), andRankExecutor::newonly readsmanifest.offload…copy_gate()so the early take is safe there.
#3 [high] Verbatim quotes + citations backing findings C/D/E/F and the positive checks
All at PR head 9ed34da.
FINDING C — sharded() after early take. selene/src/offload.rs:539-545:
/// The store's records are mirrored onto peer rank processes; see [`shard`].
pub fn sharded(&self) -> bool {
self.shared
.lock()
.as_ref()
.is_some_and(|prepared| !prepared.shards.is_empty())
}
and selene/src/offload.rs:534-537 take() → self.shared.take() on the Mutex<Option> (Shared::take, :500-502). So once runtime.rs:663-671 takes the payload, sharded() is false everywhere. Only guard use today is runtime.rs:644-656, which runs before the take (verified: the if matches!(peers, Some(RankPeers::Processes(_))) && manifest.offload.as_ref().is_some_and(|binding| !binding.sharded()) check is at :644-650, the take at :663-671). Executor-side consumers are helios/src/execution/ranks.rs:127 manifest.offload.as_ref().and_then(|b| b.copy_gate()) and helios/src/execution/threaded.rs:1286-1290 (Some(a), Some(b)) if !a.shares(b) || a.rank() == b.rank() — neither reads prepared payload, so no live break; risk is latent.
FINDING D — metric/warning ordering. helios/src/server/runtime.rs:672-679:
.map(|(prepared, gpu_cubins, copy_gate)| {
if let Some(rank) = prepared.geometry.first() {
worker_metrics.codec_placement(rank.placement);
}
if let Some(warning) = prepared.intake_warning() {
if log_to_stderr { eprintln!("warning: {warning}"); }
}
crate::offload::open(prepared, gpu_cubins, copy_gate)
})
helios/src/server/metrics.rs:558-560 pub(super) fn codec_placement(...) { let _ = self.codec_state.set(placement); } — a OnceCell-style set; metrics.rs:566-568 if self.codec_state.get().is_some_and(|placement| *placement != KvCompression::Off) { *self.decode.lock().unwrap() = stats.decode; }. So a startup that fails at RankExecutor::new/scheduler now leaves codec_state set on a metrics object whose runtime never started. Reach: the block runs whenever manifest.offload is Some (any offload config), not just --lossless-kv-compression gpu.
FINDING E — feature gates. helios/src/lib.rs:30 #[cfg(feature = "server")] on the server module; helios/Cargo.toml:25 server = ["dep:serde", "images", "grammar", "dep:axum", ...]; helios/Cargo.toml:21 runtime-core = ["dep:serde", "dep:serde_json", "dep:prost", "dep:prost-build", "dep:ring", "dep:zstd"] — no server. helios/Cargo.toml:2 name = "flare-helios". Diff touches only helios/src/server/runtime.rs.
FINDING F — no ordering test: files under helios/src/server/runtime/ are phase_tests.rs, prompt_tests.rs, response_lifecycle_tests.rs; prompt_tests.rs:33 calls unsafe { ModelRuntime::start(manifest, config, 16, 256, frontend, ...) } — nothing asserts offload-open-before-persistent-worker.
POSITIVE checks (say so plainly):
- Happy path LIFO:
worker.attach_store(store);runtime.rs:806 (after executor + scheduler construction); shutdownlet mut shutdown = executor.close();:829 thenworker.close_store(&mut shutdown);:830. - Early take is safe for executor construction: helios/src/execution/ranks.rs:123-144 reads only
manifest.offload.as_ref().and_then(|b| b.copy_gate()); copy_gate is a separate cloned field (helios/src/offload/mod.rs:58-60, :78-83). - New window cannot deadlock the copy gate: helios/src/offload/copy_gate.rs:173-195
must_waitis true only whenpeer_graphs_active > 0or a waiting peer graph exists; nothing has entered a peer graph before RankExecutor::new, and Transfers::start_parts only blocks on each rank'sready.recv()(helios/src/offload/transfer.rs:642-652), i.e. cuModuleLoadData itself — which is the hazard the PR is ordering around. - Sharded/multi-host guard ordering preserved (guard :644-656 before take :663-671).
- Error paths that predate the change (:697-706's
drained: trueafter executor failure) are context lines, but the PR converts that path into a resource-owning one, which is what makes finding A live.
CLAIM-vs-CODE table additions for the report:
- "Startup is now exact LIFO-symmetric with the existing shutdown path" — true for happy path (:806, :829-830); FALSE for :697-706 (error ignored, drained forced true) and approximately true for :714-726 / :784-796 (close error dropped).
- "
manifest.offload...RankExecutor::newonly checksoffloadmetadata (not the taken payload)" — verified TRUE (ranks.rs:127; threaded.rs:1286-1290). - Mechanism chain verified end-to-end except the body's cause #1 (cubin load deferred in helios/src/runtime_core/mod.rs) which is not locatable in the tree; the same-context kernel-before-cuModuleLoadData ordering is nevertheless real: transport.rs:793-808
control.start()?, transfer.rs:602-636 thread spawn + :642-652 blocking wait, gpu_codec.rs:282let module = stream.load_module(cubin).map_err(io_err)?;, cuda.rs:1151self.driver.check("cuModuleLoadData", ...).
NO issue found (report should say so): no hot-path locking, buffering, or allocation change; the reordered call is startup-only and moves existing work by ~90 lines; no wire/proto/captured-graph/public contract or flag/default change; no per-model branch, so charter "keep runtime small/model-agnostic" is satisfied; unittest/no-cross-platform (Unix vs Windows) consequence because offload::open was already reached on the same thread on both platforms.