#1 [high] Research summary
Correctness / Contracts / System-Level review of PR #667 (head 7908ac3)
Everything below was verified by opening the diff and the surrounding code at the PR head. Line numbers are from the head commit.
F1 — transfer() silently loses the free-space admission check for every same-node transfer (Major)
flare-cli/src/orbit/controller.rs:2026-2050 (new code) wraps the whole probe-and-admit block in a source-identity test:
if source.public_key != node.public_key {
let mut needed = 0;
for file in files {
if !have(session, "core", &format!("{directory}/{}", file.name),
file.size, expected_envelope)? {
needed += cache::range_bytes(&file.ranges);
}
}
check_space(status, needed)?;
if needed > 0 { eprintln!("{}: fetching {} from {}, then verifying", ...); }
}
Before the PR this loop and check_space ran unconditionally (see the removed - lines in the same hunk). The PR changes the span the admission metric is computed over: from "every core transfer" to "cross-node core transfers only". Three call sites pass source.public_key == node.public_key: controller.rs:1478-1490 (rank 0, controller-held core), :1513-1524 (outside source prestaged onto rank 0 → source = nodes[0]), and :1545-1556 when the holder node is itself a member and rank > 0. On those paths no free-space accounting happens at all, even though the agent-side TRANSFER still reads and writes the full core (the --transfer-streams, CacheEntry staging, and check_space(&statuses[rank], needed)? at :1444 covers only files the controller itself puts, not the range bytes the agent fetches). The description does not mention this change, and there is no test for it.
Impact: a node can accept a core transfer that does not fit and fail mid-write instead of failing fast at admission; the "fetching N from X" progress line also disappears, so operators lose the pre-transfer byte estimate for controller-held single-host launches. Fix: keep check_space unconditional and only skip it when the probe proved needed == 0 (i.e. if needed > 0 || source.public_key != node.public_key { check_space(status, needed)?; }), and add a regression test asserting the check still fires when source == node and files are absent.
F2 — The single-host cache identity change invalidates every existing single-host payload cache entry, not just colliding ones (Major, claim accuracy)
flare-cli/src/orbit/controller.rs:2436-2454:
None => {
let stem: String = primary_name.trim_end_matches(".safetensors")...collect();
let digest_prefix = hex(&envelope_digest[..8]);
let export = if stem.is_empty() { digest_prefix }
else { format!("{stem}-{digest_prefix}") };
(1, export)
}
The digest suffix is applied unconditionally, so model.safetensors becomes model-1a2b3c4d5e6f7a8b for all single-host payload cores. Combined with the new fail-closed rule in flare-cli/src/orbit/agent.rs:1579-1586:
// Unverified staging files carry no authenticated envelope digest; do not treat them
// as cache hits when the caller binds the request to a specific signed envelope.
if expected_envelope.is_some() {
return Ok(vec![0]);
}
…every previously cached single-host core is now a HAVE miss on first launch after upgrade, so the full core is re-sent to rank 0 (controller.rs:1432-1443) even when the identical core is already verified in the cache under the old <export>-<len> directory name. The PR's Compatibility section says only "Existing cores load without re-export… legacy Orbit grants… deserialize cleanly" — it does not state that the cached directory identity changes for every single-host payload core, nor that the old <export>-<len> directories become unreachable garbage. Fix: mention the one-time re-transfer in the description/docs, and either migrate/alias the legacy <stem>-<len> source ref on a digest match or report the reclaimed/duplicated bytes; the new test single_host_describe_derives_distinct_exports_from_envelope_digest (controller.rs:3575+) asserts only that the two names differ, never that a pre-existing entry is reused.
F3 — The whole integrity binding is opt-out whenever the digest is all-zero, with no warning (Major, charter "no magic defaults")
flare-cli/src/orbit/grant.rs:86-98:
/// All zeros only on legacy grants signed before envelope binding existed.
#[serde(default)]
pub envelope_digest: [u8; 32],
...
pub fn expected_envelope(&self) -> Option<[u8; 32]> {
(self.envelope_digest != [0u8; 32]).then_some(self.envelope_digest)
}
and the mirror on the agent at flare-cli/src/orbit/agent.rs:1548-1556:
let digest: [u8; 32] = serde_json::from_value(value.clone())
.map_err(|_| "invalid envelope_digest")?;
Ok((digest != [0u8; 32]).then_some(digest))
A controller that omits the field (older binary, or a hostile/rolled-back one) re-enables exactly the stale-weights failure this PR claims to fix — resolve_orbit_entry_matching(dir, None) matches any record, have() falls back to the name+length staging probe, and the run() guard at :2177 is skipped. There is no log line, no status field, and no orbit status/ls indication that a launch ran unbound. Fix: keep the serde default for deserialization, but warn on the agent (and surface it in status) when a bindable kind (core/package) arrives with a zero digest, mirroring how --verify-weights is reported; the grant.rs:268-274 legacy test then also documents the degraded mode explicitly.
F4 — --hosts grants still swallow the tensor-parallel selection with .ok(), reproducing defect 2 (Major)
flare-cli/src/launch.rs:141-149:
source: None,
envelope_digest: core.envelope_digest(),
tensor_parallel: core
.identity()
.ok()
.map(|id| id.tensor_parallel)
.filter(|&tp| tp > 0),
This is the same anti-pattern (#397) the PR deletes from publish_orbit_entry (agent.rs:881-919, before: VerifiedCore::open(...).ok()): an identity error, or a zero tensor_parallel (legacy cores derive tp from legacy_identity, helios/src/runtime_core/model.rs:1464-1468, and can legitimately be 0 for a rank-less index), silently yields tensor_parallel: None. agent::run then emits no --tensor-parallel at all (agent.rs:2229-2252, strip_tp = grant.core.tensor_parallel.is_some()), and trust::load_with cannot infer the size on rank 0 because args.hosts is empty and args.rank == Some(0) (flare-cli/src/trust.rs:41-49) — the exact breakage the PR describes for agent::run. Fix: propagate the identity error (core.identity().map_err(...)?) instead of .ok(), so a --hosts launch of a multi-deployment core fails loudly rather than starting rank 0 without a deployment selection.
F5 — Production agent::run re-opens and re-verifies the sealed core on every rank launch, unmentioned (Minor)
flare-cli/src/orbit/agent.rs:2177-2194:
if agent.verify_envelope_on_run
&& let Some(expected) = expected_envelope
{
let complete = rank == 0 || grant.single_host;
let verified = open_verified_core(&path, &publisher,
(!complete).then_some(rank), grant.core.tensor_parallel)?;
if verified.envelope_digest() != expected { ... }
}
verify_envelope_on_run is set only by Agent::new (agent.rs:771-776), so this is the production path, not just tests; with_fakes leaves it false, which is why no test exercises it in the shipped configuration. open_verified_core (agent.rs:488-513) calls NativeResources::core_format and then VerifiedCore::open*, i.e. full metadata parse + signature verification per rank spawn, on top of the VerifiedCore the agent already opened in transfer()/publish_orbit_entry. It also has an asymmetry worth auditing: for a member whose key equals the source key at rank > 0 (local_core true, complete false) it opens the complete source file with rank selection Some(rank), while rank 0 opens the same file as a complete copy — if Archive::open(..., Some(rank)) is as strict as VerifiedCore::open's doc comment ("either an explicit rank or a core holding a single rank") implies for legacy cores, that launch now fails where it previously succeeded. Fix: cache the verified envelope digest obtained during transfer/publish (the VerifiedCoreMeta already carries envelope) and compare that, or at minimum add a production-path test with Agent::new; and confirm the legacy complete-core + Some(rank) combination is accepted.
F6 — Page-cache eviction is applied to hashing/hot-read paths with no accounting for the warm-restart cost (Minor, evidence + system consequence)
flare-cli/src/orbit/agent.rs:2044-2049:
let result = session.write_frame_from(frame::OK, cache::range_bytes(&ranges), &mut reader);
for &(offset, nbytes) in &ranges {
flare_helios::release_page_cache_range(&file, offset, nbytes);
}
result
and helios/src/runtime_core/protection.rs:1705-1709 / :2385-2389 drop page cache for each payload after hashing. The release in agent::fetch runs on the failure path too (before result?), which is correct, but the overall policy is now "evict everything we read", which directly works against the warm-start re-hash reported in #93 (a warm multi-host start already re-hashes each peer's cached rank for ~7 min on one thread — those reads will now be cold on every start). flare-cli/src/distribution.rs:1130-1139 also iterates all ranks' handles, not just peer shards as the comment claims ("Peer shard files are not opened by rank zero's model loader"), and the dedup key is Arc::as_ptr(file) as usize, which only collapses handles that are literally the same Arc — separate opens of one file are released once each. None of this is measured: the PR itself says the GB10 KV benefit is "not yet re-measured on GB10 hardware", so this is a global default change (model.rs:807-809 now fires for any integrated rank, not just GB10) on the strength of an unverified hypothesis. Fix: state the warm-restart trade-off in the description, and gate or at least comment the Source-teardown sweep to ranks > 0 so the comment matches the code.
F7 — Peer cache removal moves the --no-weights cold-cache failure to the coordinator and deletes the peer's warm cache (Minor)
ignition/preparation/host_ranks.py:676-697 now always captures into peer_cache = Path(native_stage.path) / "peer-cache" with remote_cache=True and drops core before native_stage.close(), and heliopause/src/export/transfer.rs:875-897 turns a missing blob into:
let object = root.payload(payload_id)?.ok_or_else(|| {
invalid(if no_weights {
"--no-weights requires the peer payload object in the coordinator cache"
} else { "reused payload object disappeared" })
})?;
So --no-weights no longer fails on a cold peer but still fails on a cold coordinator — the failure moved hosts rather than disappearing, and every subsequent export on a peer now re-reads and re-hashes its rank weights from the checkpoint because the warm core_cache is no longer used at all. The "zero orphan blobs" claim is argued from the tempdir lifetime, not measured, and no Python test covers peer_cache/remote_cache=True. Fix: say plainly in the description that coordinator-cache coldness is still fatal, and add a Python assertion on export_options(..., remote_cache=True) reaching the Rust options (the pytest filter listed only exercises existing tests).
Areas that look sound (checked, no finding)
open_verified_coredispatch (agent.rs:488-513) is correct for both formats and mapsrankinto theu32domain with an explicit overflow error;select_deployment_index(helios/src/runtime_core/protection.rs:385-412) rejects ambiguous/absent sizes rather than picking by position, so routing all payload launches throughopen_tensor_paralleldoes not change TP1 behaviour.- The fail-closed ordering in
verify_core(agent.rs:515-537) — envelope compare beforeverify_stored_data— and inhave()/transfer()/fetch()/run()means the collision in defect 1 now produces a verification error or a full re-transfer, never a silent hit; the two new adversarial tests build genuinely identical-length cores and assert on all three verbs. eos::release_page_cache_range(eos/src/unix.rs:74-86) falls back to whole-file release on offset overflow and is a no-op on Windows;protection.rspassesfile.start(the physical offset) consistently withread_exact_at(... file.start + offset).flare::file_lock::FileLockcentralizes the three hand-rolled Unix/Windows lock helpers without changing create/mode semantics (open_lock_filekeeps0o600,truncate(false),private_fileon Windows); Windows keeps handle-close semantics, which is correct because Windows has nofork();helios::core::cache::LockandCoreLockgain the Unix-onlyLOCK_UNdrop. Both new flock tests are honest about their limitation (try_clone, not a realfork()) — worth stating in the description rather than implying fork coverage.deduplicate_tensor_parallel(controller.rs:1960-1982) handles both--flag valueand--flag=valueforms and only overridesrun_argswhen the command line omitted the value, so saved groups keep their shape.
#2 [high] PR #667 review findings (correctness/contracts lens) with citations
PR #667 head 7908ac3, base main a3c80e19. All citations verified by opening files at PR head.
F1 (Major) — transfer() free-space admission silently dropped for same-node transfers.
flare-cli/src/orbit/controller.rs:2026-2050. New guard if source.public_key != node.public_key { ... have() ... check_space(status, needed)?; eprintln!("fetching ...") } wraps the whole probe+admit block; the diff's removed lines show it ran unconditionally before. Same-node paths passing source==node: controller.rs:1478-1490 (rank0 controller-held), :1513-1524 (outside source prestaged, source = nodes[0]), :1545-1556 (holder node is a member, rank>0). controller.rs:1444 check_space covers only files the controller puts, not agent-fetched range bytes. Metric-span shrink: admission scope cross-node-only. Description silent; no test. Fix: keep check_space unconditional when needed>0 regardless of source identity + regression test.
F2 (Major) — cache identity change invalidates ALL single-host payload entries, not just colliding ones.
controller.rs:2436-2454: digest prefix always appended (format!("{stem}-{digest_prefix}") from hex(&envelope_digest[..8])). agent.rs:1579-1586 fail-closed: if expected_envelope.is_some() { return Ok(vec![0]); } for staging hits. => every pre-existing single-host core is a HAVE miss; full core re-sent (controller.rs:1432-1443); old <export>-<len> dirs become unreachable garbage (docs/orbit.md:518-520: legacy flat dirs "not migrated automatically"). PR Compatibility section claims only cores/grants compat. Test controller.rs:3575+ asserts names differ only, never reuse of an existing entry. Fix: disclose one-time re-transfer; alias/migrate legacy stem- ref on digest match.
F3 (Major) — integrity binding opt-out by omission, no warning.
flare-cli/src/orbit/grant.rs:86-98 #[serde(default)] envelope_digest: [u8;32] + expected_envelope() returns None when all-zero. agent.rs:1548-1556 parse_expected_envelope mirrors it. Consequence: old/hostile controller disables resolve_orbit_entry_matching filter, have() staging probe, and run()-time guard (agent.rs:2177) with zero diagnostics. Charter "no magic defaults". Fix: warn on agent for bindable kinds with zero digest, surface in status.
F4 (Major) — --hosts grant still swallows TP via .ok(), reproducing defect 2.
flare-cli/src/launch.rs:141-149 tensor_parallel: core.identity().ok().map(|id| id.tensor_parallel).filter(|&tp| tp > 0). Same anti-pattern removed from publish_orbit_entry (agent.rs:881-919). legacy_identity can yield tp from cluster/rank count (helios/src/runtime_core/model.rs:1464-1468). Result: agent::run emits no --tensor-parallel (agent.rs:2229-2252 strip_tp = grant.core.tensor_parallel.is_some()), trust::load_with cannot infer (flare-cli/src/trust.rs:41-49: hosts empty + rank==Some(0)). Fix: propagate error.
F5 (Minor) — production agent::run re-verifies sealed core per launch, unmentioned.
agent.rs:2177-2194; verify_envelope_on_run set only by Agent::new (agent.rs:771-776), with_fakes false => untested in shipped config. open_verified_core (agent.rs:488-513) re-parses metadata + signatures. Asymmetry: rank>0 with own key complete=false opens the complete source with Some(rank) while rank0 opens as complete — needs confirmation vs VerifiedCore::open doc "either an explicit rank or a core holding a single rank". Fix: reuse VerifiedCoreMeta.envelope; add Agent::new-path test.
F6 (Minor) — page-cache eviction on hashing/hot paths, no warm-restart accounting.
agent.rs:2044-2049 releases per range even on the failing io::copy path (before result?). protection.rs:1705-1709, 2385-2389 release after hashing. distribution.rs:1130-1139 comment says "Peer shard files" but iterates ALL ranks; dedup by Arc::as_ptr(file) as usize only collapses identical Arcs. model.rs:807-809 now fires for any integrated rank (not just GB10). Works against #93 (warm re-hash ~7 min). GB10 KV benefit explicitly unmeasured. Fix: note trade-off; scope sweep to ranks>0 to match comment.
F7 (Minor) — peer cache removal moves --no-weights cold failure to coordinator; peer warm cache gone.
ignition/preparation/host_ranks.py:676-697 peer_cache inside NativeExportStage + remote_cache=True + core = None before close(). heliopause/src/export/transfer.rs:875-897 new message "--no-weights requires the peer payload object in the coordinator cache" => still fatal when coordinator cache cold. Peers re-hash rank weights every export. "Zero orphan blobs" unmeasured; no Python test for peer_cache/remote_cache=True.
Sound areas checked: open_verified_core dispatch (agent.rs:488-513) + select_deployment_index (helios/src/runtime_core/protection.rs:385-412) reject ambiguity; verify_core envelope-before-verify_stored_data ordering (agent.rs:515-537) and the fail-closed have() (agent.rs:1579-1586); release_page_cache_range (eos/src/unix.rs:74-86) falls back whole-file on overflow, no-op Windows, uses file.start like read_exact_at; FileLock centralizes three lock helpers preserving 0o600/truncate(false)/private_file (flare/src/file_lock.rs), Windows handle-close OK (no fork); Lock/CoreLock Unix-only LOCK_UN drops (helios/src/core/cache.rs:4246-4262, conversion.rs:2696-2703); deduplicate_tensor_parallel handles --flag v and --flag=v and only overrides when CLI omitted (controller.rs:1960-1982).