Opened by a workflow run, Dec 3, 2026 4:58 PM EST. decide malicious: all_clear (100%): No malicious content found
explore
Author: jcartu (CONTRIBUTOR; 6 merged / 3 closed / 11 open PRs in 180 days, mostly docs + helios; Discord: jcartu)
Motivation: On a 2×DGX Spark (GB10) box, page cache left behind by flare's own core-distribution reads makes orbit run plan a KV cache up to 38% smaller than a manual flare run, and sometimes makes CUDA context creation fail with 116 GiB "available". The PR tries to stop that page cache accumulating, and to make the failure mode legible when it still happens.
Scale: +779 / −48 lines in 11 files
Proposal:
- Serve Orbit peer cores with
O_DIRECT(direct_reopen/FileReadAt, 4 MiB aligned buffers), then evict each served range; falls back to buffered + eviction on unsupported/EINVAL. - Add
release_page_cache/release_page_cache_rangeat four previously-missed buffered I/O sites (controller upload, core_cache digest re-verify, agentget, helioswrite_stream/verify_file/hash_file/copy_file). - Make
flare orbit runinherit[memory] reserveas--memory-limit, without clobbering a persistent group's saved limit that a config-inherited value would overwrite. - Parse
/proc/meminfoand append MemFree/MemAvailable/Cached to the integrated-GPUPlan cacheline, with a >10 GiB reclaimable-gap warning. - Enrich
cuCtxCreate_v2/cuDevicePrimaryCtxRetainCUDA_ERROR_OUT_OF_MEMORYdescriptions with the meminfo triple plus adrop_cacheshint (>4 GiB gap). Touches: flare-cli/src/distribution.rs— peer-serving I/O path for every Orbit multi-host launchflare-cli/src/orbit/controller.rs+config.rs+main.rs— memory-limit precedence for persistent groupshelios/src/runtime_core/memory.rs+mod.rs— integrated-GPU plan output and CUDA context OOM text Related items:- #630 GB10 unified memory: KV budget and cuCtxCreate respond to page-cache-polluted MemFree, not MemAvailable (open): the issue this PR refs; answers asks 2 and 3, only partially ask 1
- #667 Harden Orbit payload integrity … GB10 page-cache release (merged): same campaign; #713 adds four more release sites to the call sites #667 introduced
- #646 Unify Orbit rank cache, fix GB10 page-cache KV sizing (merged): earlier, ineffective KV-sizing attempt under #630
- #323
--system-headroom(closed): closed on the premise that[memory] reservecovers the case — untrue fororbit runbefore this PR - #93 Warm multi-host start re-hashes each peer's cached rank (open): the counter-pressure; O_DIRECT gives up the warm page-cache reuse #93 wants
Link: https://github.com/NVIDIA/hyperflare-inference/pull/713
Autobot comments: No CI checks, no reviews, no comments, no labels. All verification is self-reported CPU-only; the PR itself admits live GB10 impact is unmeasured, so the performance claim behind it is unsupported.
docs/cli-design.md:1484already documented the reserve-inheritance behaviour this PR implements, and the new persistent-group precedence rule ships with no documentation. The PR's diff view in tooling is polluted by unrelated merged PRs (#690, #702, #707) because the branch is stale against an unreadable commit graph — the real scope is the 11 files listed. Design-review token is given but noDesign-Signed-Off-Byidentity.
Value Proposition
Value Proposition — PR #713 (release page cache with O_DIRECT peer serving, inherit orbit memory reserve, log integrated MemInfo)
Charter alignment: partly — and the charter's evidence clause binds. The problem is in scope: the vision names DGX Spark explicitly, and #630 is a GB10 report labelled bug/performance/priority:P2/triage:investigate with a reporter re-measuring across three releases; Orbit supervises serving ranks, which is a stated goal. But "Bring real evidence" (#210 for performance, #397 for root-cause fixes) is not met: verification is self-reported cargo test/clippy output on Linux x86_64 with no CI on head 4efd9fd, and the author's own Disclosures state "live GB10 impact remains unmeasured" and that GB10 CU_DEVICE_ATTRIBUTE_INTEGRATED / CUDA_ERROR_OUT_OF_MEMORY behaviour at context creation is "unconfirmed." #630's 2026-12-02 comment shows #667's existing release calls did not clear the ~9 GiB controller page cache by plan time — exactly where the four new release sites and O_DIRECT aim — with nothing showing they now succeed. Ask 1 of #630 (size the plan from MemFree, or flush before planning) is untouched: shared_available still delegates to flare_selene::offload::available_memory.
Novelty & status: genuinely additive. No commits on main since branch point cc0a49d touch these 11 files, and no open PR competes. It extends merged #667 rather than duplicating it. Note the dossier's warning: read the 11 files, not pr_diff — the diff is polluted with merged #690/#702/#707 content.
Value vs cost — three changes, three very different ratios.
- (2)
[memory] reserveinheritance fororbit run— best ratio. It makesdocs/cli-design.md:1484true, delivers the parity promised bydocs/orbit.md:182, and finally makes #323's closing advice ([memory] reserve = "4G") hold fororbit run. Costs: a silent KV-budget change for configs with[memory] reserveand no--memory-limit, plus an undocumented precedence rule (saved group limit beats config-inherited; explicit flag beats both) — and 0 of 11 files are docs. - (3) MemInfo diagnostics — cheap and useful. Directly answers #630 asks 2 and 3, gated to integrated GPUs, no new dependencies,
#[cfg(target_os = "linux")]-bounded. - (1)
O_DIRECTpeer serving — the costly one. It alters the read path for every Unix multi-hostorbit run, gives up kernel readahead, and pushes #667's trade against warm-start reuse (#93) into serving without quantifying either side.
Conditions. Split into three PRs: land (2) with docs and land (3) as-is; defer (1) until pfn's offered ~5-minute instrumented GB10 run shows the cache is actually cleared — otherwise the root cause is the sizing path and that is what should change.
Verdict: Worth it with changes — keep the reserve inheritance and MemInfo diagnostics; defer the O_DIRECT peer-serving change pending GB10 evidence.
Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.
Classify intake
Selected: triage:review, performance, enhancement, area:memory, area:orbit
Threshold: 65%
Triage
- [✓]
triage:review: 95.5% -
triage:validation: 3.7% -
triage:design-review: 0.5% -
triage:partial: 0.2% -
triage:investigate: 0.0% -
none: 0.0% -
triage:integration: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
priority:P2: 60.6% -
none: 36.7% -
priority:P1: 2.7%
Type
- [✓]
performance: 95.8% - [✓]
enhancement: 73.1% -
bug: 59.3% -
community: 46.9% -
duplicate: 32.1% -
documentation: 0.4%
Area
- [✓]
area:memory: 91.5% - [✓]
area:orbit: 81.8% -
area:caching: 59.3% -
area:api: 32.1% -
area:preparation: 29.4% -
area:packaging: 6.8% -
area:selene: 2.9% -
area:rocenante: 2.0% -
area:engram: 1.0% -
area:scheduling: 0.6% -
area:kernels: 0.2%
Model
-
model:glm-5.3: 2.3% -
model:qwen3.8-flash-next: 0.6% -
model:qwen3.8-27b: 0.3% -
model:inkling-small: 0.2% -
model:kimi-k3.1: 0.2% -
model:deepseek-v4: 0.2% -
model:deepseek-v4.1: 0.2% -
model:nemotron-3.5-bolt: 0.1% -
model:mimo-v2.6: 0.1% -
model:muse-glimmer: 0.0% -
model:gemma4: 0.0%
Apply Labels (Intake)
Applied: +triage:review, +performance, +enhancement, +area:memory, +area:orbit
Gates and contracts
Contracts, Charter & Verification Gates Audit — PR #713 (4efd9fd, 11 files, +779/−48)
Verdict
No contract or verification gate blockers. All four hard gates pass. I found no signed-format/wire/captured-graph change, no vendored-file fork, no unmerged-external dependency, no applicable mandatory formal/GPU gate that was skipped, and no reported failing test or failing CI check. Three non-blocking observations are recorded at the end (evidence gap on the claimed benefit, undocumented user-visible precedence rule, unverifiable design sign-off identity) — none of them is a repository-governance gate violation.
Gate 1 — Signed core-format / wire / captured-graph / public contract boundaries: PASS
- No new proto, core-format, wire kind, or captured-graph operation. The PR adds no Protobuf field/enum, no graph kind, no op contract, no prepared-metadata field. The changed files are
flare-cli/src/{config,core_cache,distribution,main}.rs,flare-cli/src/orbit/{agent,controller}.rs, andhelios/src/{lib.rs,core/cache.rs,runtime_core/{driver,memory,mod}}.rs.CUDA_ERROR_OUT_OF_MEMORY = 2(helios/src/runtime_core/driver.rs:94–95(not opened)) is a mirror of an existing CUDA driver status code, not a new wire or graph identifier; it is consumed only by comparison against the driver's returned status (helios/src/runtime_core/mod.rs:382,memory.rs:130). Thereforedocs/design-review.mdprinciple 1's "introducing a captured-graph operation family requires prior explicit approval from Luke Alonso" is not triggered, and no owner approval is owed. - Peer-distribution wire protocol is unchanged.
flare-cli/src/distribution.rs:38still readsconst VERSION: u32 = 4;andMAX_FRAME/TIMEOUT/IO_TIMEOUTat:39–41are untouched.serve_sourcestill answers the same request with the samecache::range_bytescount frame and the same payload bytes (distribution.rs:1201–1216); the only change is how the bytes are read from disk (copy_source_ranges→copy_ranges_direct,:1319–1336). Byte-for-byte parity withcache::RangeReaderis asserted against the buffered reader atdistribution.rs:1845–1850and:1928–1942. No wire contract change, so no cross-version compatibility question arises. - No contradiction of the normative scheduling/core-format documents. Nothing under
docs/scheduling-theory.md(not opened),docs/scheduling-runtime-design.md, ordocs/core-format-design.mddescribes the distribution read path or the kernel page cache — I searched all three forO_DIRECT,page cache,MemAvailable,readahead,reserveand found no governing statement. - The one normative memory statement is consistent, not contradicted.
docs/runtime-core-design.md:783–786states that on integrated GPUs the budget "is LinuxMemAvailable, capped by CUDA's device total … reclaimable page cache contributes to available memory". This PR deliberately does not change that budget:shared_availablestill delegates straight toflare_selene::offload::available_memory(helios/src/runtime_core/memory.rs:30–33), unmodified. The new code only describes the state (appendsMemFree / MemAvailable / Cachedto thePlan cachesummary atmemory.rs:1256–1268, and toCudaError.descriptionon context-creation OOM atmod.rs:375–388). Normative doc and implementation remain aligned, so no normative-doc update is owed by Gate 1. (That the documented model is empirically wrong on GB10 is a correctness-lens matter, outside this audit.) - The
[memory] reserveinheritance does not contradict any signed contract — it discharges a doc/implementation mismatch that the docs already state as normative.docs/cli-design.md:1484("Serving memory budget | Runtime--memory-limit, then configured[memory] reserve, then the core reserve"),docs/cli-design.md:759and:895already specify this ordering, anddocs/orbit.md:182states "flare orbit runtakes the serving flags offlare run".flare-cli/src/config.rs:152–161now makes that true fororbit run, matching theCommand::Runbranch at:76–80. This is a shipped default becoming documented behaviour, not an undocumented default contradicting a normative doc. docs/orbit.md:467("The planner does not set--memory-limit; groups on disjoint GPUs retain their own serving memory settings") also survives: the planner is untouched, and the new merge rule preserves a saved group's limit —merge_serving_optionsatflare-cli/src/orbit/controller.rs:1972–1997skips a config-inherited--memory-limit(both--memory-limit Xand--memory-limit=Xforms) wheneverhas_memory_limit(saved)is true, gated onmemory_limit_from_config(controller.rs:169,:695; set atflare-cli/src/main.rs:538–540fromvalue_source("memory_limit") != CommandLine). Explicit CLI still wins. This is the exact analogue of the already-documentedtransfer_streamsrule atdocs/orbit.md:632–634.
Gate 2 — Vendored upstream dependencies & cross-PR conflicts: PASS
- No vendored upstream file is modified or forked. The changed-file list contains no
helios/native/file (noroce_proxy.c(not opened)), no third-party tree, and no patch file. The only "native" looking work is Rust. - No new or unpinned external dependency.
helios/src/lib.rs:38–41re-exportsFileReadAt, allocate_aligned, direct_reopen, free_aligned, release_page_cache, release_page_cache_rangefromflare_eos, which is an in-workspace crate that already contains all of them onmain:eos/src/lib.rs:48(not opened) (allocate_aligned),eos/src/unix.rs:61(not opened) (direct_reopen),:68(release_page_cache),:74(release_page_cache_range). These were introduced by merged #667. The PR adds noCargo.toml(not opened) change (not in the file list), so no dependency, version, or commit pin is added. - No dependence on an unmerged external recipe or PR. All three sub-changes are self-contained Rust in this repository; nothing references an unmerged upstream patch, branch, or recipe revision, and no placeholder/
git-path dependency appears. - No conflict with newer
mainwork in these files (11 files untouched onmainsince branch pointcc0a49d, per the Discovery Dossier). The pollutedpr_diff(merged #690/#702/#707 content) is a stale-merge-base artifact; I audited the 11 files at the PR head, not the diff.
Gate 3 — Mandatory verification evidence (design-review Layer 3): PASS
TLA+ / Kani / mutation gates — not triggered. docs/design-review.md:209–228 mandates python3 verification/helios-lifecycle/check.py (not opened) only for changes to "admission, fences, generations, cancellation, speculation accounting, cache compaction, snapshot aliases, response buffering or ownership, offload aggregation, readiness, or rank coordination", and Kani only for completion-vector validation, prepared completion contracts, state-view extent arithmetic, or sequential validators. Checking each touched site against that list:
helios/src/runtime_core/mod.rs:375–388wrapscheck_ctxforcuDevicePrimaryCtxRetain/cuCtxCreate_v2— it only rewritesCudaError.descriptiontext; the status value, error variant (ExecutionError::Driver(CudaError { code: 2, .. }), asserted atmemory.rs:2367–2371), and control flow are identical (driver.checkresult is mapped, never swallowed). No readiness, fence, generation, cancellation, or rank-coordination transition changes.helios/src/runtime_core/memory.rs:1256–1268appends to thePlan cacheprogress summary; the phase name (helios/src/startup.rs:74(not opened)) and the sizing computation are untouched.helios/src/lib.rs:38–41is a re-export list — no behavior.helios/src/core/cache.rs:4398, 4441, 4511, 4772, 4774are in the payload store (write_stream,verify_file,hash_file,copy_file), not the prefix-checkpoint cache. The cache-ownership modelCacheOwnership.tlacoversPrefixCheckpointCache, which lives in a different file,helios/src/cache.rs:208(not opened) — not among the 11 changed files. So the "cache compaction"/"snapshot aliases" trigger is not met either.- No scheduler, admission, dispatch, or
helios/src/execution/{threaded,parallel,roce}*file is touched, so the cross-rank barrier test requirement (Layer 1) and the mandatory multi-GPU collective requirement are not engaged.
Layer 1 CPU checks — reported for every affected crate, at --release --locked. flare-cli (251 passed) and helios --features runtime-core,server (1948 passed) are exactly the two crates the PR changes, run with cargo test --locked --release as Layer 1 requires; flare (255 passed) was run too, and clippy --all-targets plus rustfmt --edition 2024 --check are reported. No Python file is touched, so no pytest suite is owed. These are self-reported, but they are not contradicted by anything in the description or the Discovery Dossier, which explicitly confirms "Everything the description claims is present in the tree; I found no claimed change that is missing."
No failing test and no failing CI check on 4efd9fd. The description reports 0 failed in all three crates; the Dossier states there are no CI checks at all on the head commit and no comments, reviews, or labels. Since nothing reports a failure or an explicit refusal to run tests on this non-trivial change, and my tooling cannot observe GitHub Actions check runs, I do not raise a CI finding — per the calibration rule against unobservable-CI false positives. I note only that the reported counts are unverified by any repository artifact.
Performance-benchmark gate — trigger not met. docs/design-review.md principle 12 / charter #210 require a main-vs-branch served-workload A/B when a speedup is claimed. This PR claims no speedup and publishes no performance number: it explicitly states the trade-off ("O_DIRECT peer serving drops kernel readahead in exchange for avoiding page-cache accumulation") and discloses "live GB10 impact remains unmeasured" and that GB10 CU_DEVICE_ATTRIBUTE_INTEGRATED / context-creation CUDA_ERROR_OUT_OF_MEMORY behaviour is "unconfirmed". Disclosure of unrun hardware checks is precisely what principle 12 asks for, and the non-substitution rule at docs/design-review.md:247–251 ("Disclosure does not excuse skipping runnable CPU checks") is satisfied because all runnable CPU layers were run. See observation (1) for the residual risk this leaves.
Gate 4 — Material scope / claim contradictions: PASS
- No fabricated artifact. There is no reference to a benchmark, TLA+ run, GPU run, or test file that is absent from the diff. Every described mechanism is present at the cited lines:
copy_ranges_direct(distribution.rs:1268–1317) withDIRECT_BLOCK 4096/DIRECT_CHUNK 4 MiB(:1221–1223), unconditional post-copy range release including the error path (:1330–1332, no?on the copy result), mid-streamEINVALfallback (:1305–1311), buffered fallback with release (:1255–1265, :1335), aligned-EOF/offset trimming (:1284–1303); the four new buffered sites (core_cache.rs:450, 455, 505, 562;agent.rs:2046 (not opened), 2068;controller.rs:1465;helios/src/core/cache.rs:4398, 4441, 4511, 4772, 4774); the reserve inheritance and merge rule (config.rs:152–161;controller.rs:169, 695, 1967–1997;main.rs:538–540) with tests atcontroller.rs:3794; and the meminfo diagnostics (memory.rs:35–140, 1256–1268, 2276–2409;mod.rs:375–388;driver.rs:94–95(not opened)). The descriptionRefs #630rather thanFixes #630, which is honest about the partially-addressed ask. - Not "bundling unrelated standalone tooling." +779/−48 across 11 files is three changes for one reported defect and its operator workflow, all inside the product crates; no tooling, no generated dumps, no audit artifacts. The three parts are independently reviewable (which the value lens already recommended splitting) but they are not unrelated scope expansion under
AGENTS.md#contribution-scope-and-rejection-criteria. - The
design-review=2e5bmention is not a contradiction.docs/design-review.md:294–299places theDesign-Signed-Off-By: <reviewer identity>; design-review=<hex>trailer in the commit message, not the PR description. The description reports that.githooks/commit-msgpassed; that hook validates the trailer against the staged checklist (:335–340). The commit message itself is not readable in this copy (search_historyfails on an unreadable commit, per the Dossier), so I can neither confirm nor refute the trailer and do not raise it as a finding.
Non-blocking observations (reported, not gate violations)
- The claimed benefit is unmeasured on every affected path, and #630's primary ask is untouched (evidence risk, not a gate breach). The PR's stated purpose is to stop the KV-plan loss that #630 measured at −37.8% (13.0 GiB / 1,961,984 tokens vs 20.5 GiB / 3,153,664). #630's 2026-12-02 comment records that merged #667's release calls did not clear the ~9 GiB controller page cache by plan time, and the sizing path is unchanged (
memory.rs:30–33still returnsflare_selene::offload::available_memory), so whether the four new sites plusO_DIRECTchange the observed plan is open. The reporter offered a ~5-minute instrumented reproduction on the hardware. I record this as the single largest weakness in the evidence chain, but it is disclosed, it is hardware-only (not a skipped CPU layer), and no speedup number is claimed — so it is an evidence-quality matter for the value lens rather than a Layer-3 gate violation. - A new user-visible precedence rule ships with no documentation, and no docs file is touched (0 of 11). The rule "saved persistent-group
--memory-limitbeats a config-inherited one; an explicit CLI flag beats both" (controller.rs:1972–1997) is exactly the shape of the documentedtransfer_streamsrule atdocs/orbit.md:632–634, but nothing analogous is written for--memory-limit; the newPlan cachefields, the stderr page-cache warning (memory.rs:106–114), and thedrop_cacheshint insideCudaError.description(memory.rs:133–137) also have no documented home (docs/cli-design.md:1436–1484is the natural one). This is a documentation gap underAGENTS.mdprose rules, not a contradicted normative invariant —docs/cli-design.md:1484,:759,:895anddocs/orbit.md:182already state the default the PR now implements. docs/orbit.md:467's "groups … retain their own serving memory settings" is now true only for groups that saved--memory-limit. Groups without a saved limit and a host[memory] reserveinherit the reserve. That is the documented budget order (docs/cli-design.md:1484) and each node reads its own host configuration (docs/cli-design.md:1381), so I read this as wanted behaviour, but it is a silent KV-budget change for existing configs and should be stated indocs/orbit.mdalongside the persistent-group section (docs/orbit.md:374–402).
What I checked and did not find
No docs/core-format-design.md, docs/scheduling-theory.md (not opened), or docs/scheduling-runtime-design.md invariant is contradicted; no Protobuf/enum/wire/graph addition; no helios/native/ or vendored third-party change; no new crate dependency or unpinned external reference; no touched scheduler, admission, dispatch, execution-transport, or PrefixCheckpointCache code that would trigger verification/helios-lifecycle/check.py (not opened), Kani, or mutation testing; no reported failing test or failing CI check on 4efd9fd; no fabricated benchmark or verification artifact.
Subtraction and simplicity
Subtraction & Simplicity audit — PR #713 (head 4efd9fd)
Scope note: the tooling pr_diff for helios/src/runtime_core/memory.rs and flare-cli/src/main.rs includes unrelated merged work (e.g. row_backing_bytes, largest_count, registration_context), so I audited only the 11 files listed in pr_files and, inside them, only the hunks that belong to this PR's three stated changes. Verdict up front: the change is not lean. The I/O copy path itself is tight, but there are five concrete duplications the PR either creates or knowingly extends, and two of them have correctness consequences beyond style.
High signal — duplication with a behavioural cost
1. A second, divergent /proc/meminfo parser, reading the same file twice on the same path
helios/src/runtime_core/memory.rs:50–76 adds a strict parser:
let kib = fields.next()?.parse::<u64>().ok()?;if fields.next()? != "kB" || fields.next().is_some() { return None; }
But the tree already parses MemAvailable: in selene/src/offload.rs:959–971 (available_memory, looser: accepts any trailing junk after kB), MemTotal: at selene/src/offload.rs:983–993, and a third in ignition/planning.py:128–131 (not opened). The PR leaves shared_available delegating to the old parser —
memory.rs:31–33 pub(super) fn shared_available(meminfo: &str, total: usize) -> Result<usize> { Ok(flare_selene::offload::available_memory(meminfo, total)?) }
— and then reads /proc/meminfo again, with the new parser, inside the same planning call:
memory.rs:343–345(memory_snapshot):let info = std::fs::read_to_string("/proc/meminfo")…; shared_available(&info, usize::MAX)?memory.rs:1257–1259(LinuxMemInfo::read()→append_integrated_meminfo)
So one plan invocation reads /proc/meminfo twice and parses MemAvailable with two parsers that disagree on malformed input. The Plan cache line can therefore print a MemAvailable that differs from the number the plan was actually sized from — on the exact diagnostic path #630 asked for. Fix: extend flare_selene::offload with one meminfo_value(name)/LinuxMemInfo type (it owns the other two parsers) and delete LinuxMemInfo::parse (−27 lines), or at minimum have append_integrated_meminfo consume the already-read MemorySnapshot instead of re-reading the file.
2. verify_file is hash_file with one extra line, and the PR edited both
helios/src/core/cache.rs:4428–4447 and helios/src/core/cache.rs:4498–4514 are the same function:
verify_file: open,DigestContext::new(&SHA256),vec![0; 1 << 20], loop withInterruptedretry,crate::os::release_page_cache(&file); read?;thenif PayloadId::from_digest(context.finish()) != declared { … }hash_file: identical, minus the comparison.
verify_file(path, declared) collapses to if hash_file(path)? != declared { Err(...) } else { Ok(()) } — about 14 lines removed, and the release call (which the PR adds at both :4441 and :4511) exists in one place instead of two, so a future change cannot update one and miss the other.
3. enrich_integrated_ctx_oom has two arguments that encode one fact, and the OOM test is written twice
memory.rs:118–128:
pub(super) fn enrich_integrated_ctx_oom(mut error: crate::Error, integrated: bool, meminfo: Option<LinuxMemInfo>) -> crate::Errorif !integrated { return error; } let Some(info) = meminfo else { return error; };if let … && cuda.code == super::driver::CUDA_ERROR_OUT_OF_MEMORY
integrated == true && meminfo.is_some() is the only meaningful state; the (bool, Option<T>) pair is exactly the invalid-state-you-can-represent shape. It also forces the caller to compute integrated != 0 twice, helios/src/runtime_core/mod.rs:379–385:
memory::enrich_integrated_ctx_oom(error, integrated != 0,(integrated != 0 && status == driver::CUDA_ERROR_OUT_OF_MEMORY).then(memory::LinuxMemInfo::read).flatten(),
and the "is this an OOM" decision then lives in two places: the .then(… status == CUDA_ERROR_OUT_OF_MEMORY) in mod.rs:382 and the re-check at memory.rs:130. Collapse to one Option<LinuxMemInfo> parameter (caller passes None unless integrated-and-OOM) and drop the integrated parameter and one of the two OOM tests.
High signal — pure subtraction
4. AlignedBuffer is now the third copy of the same unsafe allocator wrapper
flare-cli/src/distribution.rs:1226–1253 (new, +28 lines) is byte-for-byte the shape of selene/src/disk.rs:2253–2294:
distribution.rs |
selene/src/disk.rs |
|---|---|
struct AlignedBuffer { address: usize, bytes: usize } |
struct AlignedBuffer { address: usize, length: usize } |
flare_helios::allocate_aligned(bytes)? + unsafe { std::ptr::write_bytes(address as *mut u8, 0, bytes) } |
flare_eos::allocate_aligned(length) + identical write_bytes |
impl Drop { unsafe { flare_helios::free_aligned(self.address, self.bytes) } } |
impl Drop { unsafe { flare_eos::free_aligned(self.address, self.length) } } |
helios/src/engram/reader.rs:90 (not opened)/:414 is a third raw alloc/free pair on the same two functions. flare_eos exports allocate_aligned/free_aligned (eos/src/lib.rs:48–64) but no owning type, so every caller re-derives the Drop invariant. Adding pub struct AlignedBuffer to flare_eos (where the allocator lives) deletes 28 lines here and ~40 in selene/src/disk.rs, and removes two hand-written // SAFETY:-correct blocks from review surface.
5. The --memory-limit precedence rule is argv string-matching, three times over
flare-cli/src/orbit/controller.rs:1967–1997:
fn has_memory_limit(args: &[String]) -> bool { args.iter().any(|arg| arg == "--memory-limit" || arg.starts_with("--memory-limit=")) }let skip_config_limit = memory_limit_from_config && has_memory_limit(saved);if arg == "--memory-limit" { skip_next = true; continue; } if arg.starts_with("--memory-limit=") { continue; }
The same arg == "--flag" / starts_with("--flag=") + skip_next pair-strip loop already exists twice in this crate: controller.rs:2004–2022 (deduplicate_tensor_parallel) and flare-cli/src/orbit/agent.rs:2232–2251 (grant argv strip for --tensor-parallel). This PR adds a third hand-rolled copy, and the copy is already fragile: a trailing --memory-limit with no value sets skip_next that is never consumed, and the predicate is duplicated between has_memory_limit (:1968–1969) and the strip body (:1986, :1990).
The structural version deletes the whole mechanism: RunOptions already distinguishes the two cases, so carry the config reserve as a value instead of as argv — pub memory_limit_from_config: bool (controller.rs:167–169) becomes config_memory_limit: Option<MemoryLimit>, the config layer stops injecting --memory-limit into options.serving at all (flare-cli/src/main.rs:538–540, flare-cli/src/cli.rs:672–682), and merge_serving_options shrinks to "use saved, else CLI, else config" with no string matching. That removes has_memory_limit, skip_config_limit, skip_next, the memory_limit_from_config bool field, the bool parameter at controller.rs:1975, and the duplicated predicate — roughly 20 lines and one new cross-module contract (the undocumented precedence rule) in exchange for one enum field.
6. The from_config predicate the test asserts is copied, not called
flare-cli/src/main.rs:538–540:
memory_limit_from_config: run.serving.memory_limit.is_some() && run_matches.value_source("memory_limit") != Some(clap::parser::ValueSource::CommandLine),
flare-cli/src/config.rs:917–918 (new test) re-implements it verbatim:
let from_config = run.serving.memory_limit.is_some() && run_matches.value_source("memory_limit") != Some(ValueSource::CommandLine);
Because the test reconstructs the expression instead of calling production code, it cannot fail if main.rs:538 changes — it only tests itself. Extract one fn memory_limit_from_config(run: &OrbitRun, matches: &ArgMatches) -> bool and call it from both (net −2 lines, but it makes ~30 lines of test assertions meaningful).
7. Duplicated release loop and a redundant empty guard
flare-cli/src/distribution.rs:1261–1263 and :1330–1332 are the same three lines:
for &(offset, size) in ranges { flare_helios::release_page_cache_range(file, offset, size); }
The direct path already has this loop; the buffered path needs it too. Since the buffered fallback inside copy_ranges_direct (:1309) routes through copy_ranges_buffered (which releases), the only reason for the outer copy at :1330–1332 is the success path of the direct copy. Hoisting the loop into copy_source_ranges after the branch (release always, then return the result) removes one copy and makes "every served range is released" true by construction in one place rather than two. Relatedly, :1324 if ranges.is_empty() || ranges.iter().all(|&(_, size)| size == 0) { return Ok(0); } overlaps release_page_cache_range's own if len == 0 { return; } (eos/src/unix.rs:75); the guard is only there to skip a 4 MiB allocation for an all-zero request — worth one comment, or drop the is_empty() half.
8. Two unexplained thresholds for one condition
helios/src/runtime_core/memory.rs:36–38:
pub(super) const PAGE_CACHE_WARN_THRESHOLD: u64 = 10 << 30;pub(super) const CTX_OOM_DROP_CACHES_THRESHOLD: u64 = 4 << 30;
Both answer "is reclaimable page cache large enough to be the cause?", 2 GiB into the same reclaimable gap, differing only in where they are checked. #630 asked for one number (">10 GiB divergence"). Either collapse to one constant or state why context creation is more sensitive than KV sizing — as written, a reviewer cannot tell whether 4 << 30 is measured or guessed, and the PR's own disclosure says it is unmeasured on target hardware.
9. The memory-line prints the same triple twice in one startup
memory.rs:105 appends meminfo.summary() to the summary that already became the Plan cache line, and :108–111 embeds {} = meminfo.summary() again inside the warning that is printed immediately after at memory.rs:1264–1267. On a polluted GB10 controller, one startup prints MemFree 1.00 GiB / MemAvailable 11.20 GiB / Cached 10.60 GiB twice. Drop the parenthetical from the warning string.
10. append_integrated_meminfo mixes a mutation with a returned warning
memory.rs:100–115 takes &mut String, appends, and returns Option<String> for the caller to eprintln!. That is why the call site needs the let meminfo_warning = …; finish(summary); if let Some(w) = … contortion at memory.rs:1256–1268. Returning Option<String> (the full line, or (line, Option<warning>)) makes the call site four straight lines and keeps formatting in one place.
Low signal
flare-cli/src/config.rs:77–80and:154–157are the same three-linememory.reserveinheritance block. Two occurrences do not yet justify a helper, but they must not be allowed to drift (one isCommand::Run, one isOrbitCommand::Run) — afn inherit_memory_limit(&mut ServingOptions, reserve: &Option<String>) -> Result<()>would cover both and theorbit pushpath if that ever needs it.helios/src/lib.rs:38–41widens helios's public surface with four passthrough re-exports (FileReadAt, allocate_aligned, direct_reopen, free_aligned) purely soflare-clineed not depend onflare-eos(flare-cli/Cargo.toml:22–37has noflare-eos). A direct dependency would delete the re-export and theflare_helios::indirection atdistribution.rs:1234, 1251, 1262, 1268, 1328; a judgement call, not a defect.helios/src/core/cache.rs:4773–4775:if let Ok(input) = File::open(source) { crate::os::release_page_cache(&input); }swallows the open error only tofadvisea path it does not otherwise use. Arelease_page_cache_path(&Path)ineos(used by this and any future path-only site) removes the best-effort open.
What is already lean — do not "simplify" these
copy_ranges_direct(distribution.rs:1268–1317): 50 lines for aligned chunking with unaligned head/tail,EINTRretry, short-read trimming and mid-streamEINVALfallback. There is no flag, no mode, no second entry point; theif let Ok(direct) = flare_helios::direct_reopen(file)at:1328is a clean capability test with no configuration knob. This is the correct shape and should stay.- The release-on-error property at
:1329–1333(no?oncopy_ranges_direct, result returned after the release loop) is deliberate and should be preserved if the loop is hoisted per item 7. - No new CLI flag, no new config key, no new crate dependency.
driver.rs:95(not opened) (CUDA_ERROR_OUT_OF_MEMORY = 2) is a one-line constant and belongs next to its siblings. LinuxMemInfoand the enrichment are correctly#[cfg(any(target_os = "linux", test))]/#[cfg(target_os = "linux")], so no dead Windows/macOS arms and noallow(dead_code)on the new code.main.rsrestructuring (bindingrun_matchesonce,:521) is a net simplification, not a regression.
Test volume vs. change
Of the +779 lines, roughly 300 are tests. The memory.rs parser tests (:2266–2409) are thorough and mostly worth keeping, but flare-cli/src/config.rs:896–992 is 97 lines of assertions for a 6-line production change, three of whose assertions test a predicate the test itself re-declares (item 6). If item 5's structural change lands, most of controller.rs:3793–3839's four merge_serving_options cases collapse to two (saved wins / CLI wins) because the flag-parsing edge cases no longer exist.
Code correctness
Deep Code Correctness / Invariants / Hot-Path Audit — PR #713 @ 4efd9fd
Scope note (affects how the PR was partitioned): the supplied file list and pr_files report 11 files, but the actual diff also modifies helios/src/runtime_core/cache_memory.rs (+~180 lines: Layout.sentinel_granules, fixed_segments, pack_prefixes, plan_mapping_handles rewrite, new alias_plane third predicate). That makes this a >900-line, multi-crate PR, so it was partitioned into 3 concurrent slices (flare-cli distribution/config/orbit; helios runtime_core memory+planning; helios core/cache.rs+eos), each run through the full 4-part protocol, then synthesized and independently re-verified below.
Bottom line: the O_DIRECT peer-serving rewrite, the page-cache release sites, the /proc/meminfo diagnostics, enrich_integrated_ctx_oom, and the row_backing_bytes sentinel arithmetic are all correct under adversarial tracing (proofs below). There is one Major state-persistence defect in the new [memory] reserve propagation, plus three Minor performance/estimator issues. No Blocker.
MAJOR-1 — [memory] reserve is baked into the persisted --persistent group on first launch, so later config edits are silently ignored forever
Diff sites: flare-cli/src/orbit/controller.rs:692-696 (merge), :875-878 (persist), flare-cli/src/orbit/controller.rs:1967-1987 (merge_serving_options), flare-cli/src/orbit/store.rs:231-233 (GroupSpec.serving), flare-cli/src/config.rs:152-158.
memory_limit_from_config only protects an already-saved value; it does nothing to stop the config-derived value from being written into the saved spec when the group had no saved limit:
fn merge_serving_options(
saved: &[String],
current: &[String],
memory_limit_from_config: bool,
) -> Vec<String> {
let mut serving = saved.to_vec();
let skip_config_limit = memory_limit_from_config && has_memory_limit(saved);
...
if skip_config_limit { // <-- only true when `saved` ALREADY has a limit
and the merged list (which now contains the config-inherited --memory-limit=-12GiB emitted by ServingOptions::rank_options, flare-cli/src/cli.rs:1150-1152) is then written verbatim into the durable orbit file:
let saved = GroupSpec {
name: name.clone(),
core,
serving: serving.clone(), // controller.rs:878 — config-derived limit included
GroupSpec is serialized to ~/.config/flare/orbit.toml (not opened) via Orbit::save_group/save (store.rs:299-324) and re-read on every later attach/restart/controller relaunch.
Decision table (all four rows verified from the code):
memory_limit_from_config |
saved has --memory-limit |
outcome |
|---|---|---|
| true | yes | saved wins (intended) |
| true | no | config value appended → persisted into the spec ← defect |
| false (explicit CLI) | any | both appended; OrbitRun has #[command(args_override_self = true)] (cli.rs:571-573), so clap keeps the last → explicit wins ✔ |
| n/a | n/a | main.rs:531-537 sets the flag as is_some() && value_source != CommandLine, which is exactly "came from config" ✔ |
Concrete counterexample: orbit.toml (not opened) has memory = { reserve = "12 GiB" }. Operator runs flare orbit run --name g --persistent model/. The spec persists serving = ["--memory-limit=-12GiB", ...]. The host is later resized (or the reserve is corrected) to reserve = "7 GiB". On the next flare orbit run --name g (or after a controller reboot, which relaunches from the spec), saved now does contain --memory-limit, so skip_config_limit == true and the new group is launched with the stale 12 GiB — a config value the operator has already changed, with no warning, and the only escape is hand-editing orbit.toml (not opened) or passing an explicit --memory-limit. This is exactly the bug class the PR set out to fix ("without clobbering saved persistent-group overrides"), just inverted: config now clobbers nothing but poisons the saved state.
Fix: do not persist config-derived limits. Either (a) keep it out of serving entirely and store it as a separate GroupSpec field mirroring how transfer_streams/roce_ring are stored, e.g. pub memory_limit_from_config: Option<String> set in controller.rs:875 and re-applied at launch, or (b) strip it before save_group (serving.retain(..) on the config-derived entry when options.memory_limit_from_config), and (c) add a regression test that persists, changes [memory] reserve, and reloads — the new tests (controller.rs:3793-3837, config.rs:895-990) never round-trip through save_group/Orbit::load, which is why this is unobserved.
MINOR-1 — alias_plane's new largest_count clause makes plane eligibility non-monotone: adding a plane can disqualify already-eligible planes and shrink the snapshot alias budget
Diff sites: helios/src/runtime_core/cache_memory.rs:73-91 (and its duplicate consumer helios/src/runtime_core/memory.rs:654-680).
unit == largest
|| alignment.div_ceil(unit) <= row.div_ceil(page)
|| (largest == unit.saturating_mul(2)
&& row.div_ceil(largest_count.saturating_mul(alignment).max(1)) >= 2)
Only the third clause references largest_count, and it is anti-monotone in the number of densest planes: raising largest_count raises the divisor, shrinking row.div_ceil(largest_count * alignment) and turning the clause off for planes that previously qualified — i.e. adding a mixed-width plane can remove alias borrowing from unrelated planes.
Concrete counterexample: row = 4 MiB, alignment = 2 MiB, page = 4 MiB, one plane unit = 1 MiB with a densest plane largest = 2 MiB, largest_count = 1: clause 2 fails (div_ceil(1 MiB) = 2 > div_ceil(4 MiB) = 1) but clause 3 holds (row.div_ceil(1*2 MiB) = 2 >= 2). Now add a second densest plane (largest_count = 2): clause 3 becomes 4 MiB / 4 MiB = 1 >= 2 → false, so the 1 MiB plane loses eligibility and capacities() (memory.rs:654-680) computes a smaller cached/rows snapshot budget for the same total memory.
Why only Minor: eligibility is recomputed with the same eligible_planes(geometry, row_alignment) call inside Layout::grouped (cache_memory.rs:297), and the same rounding is used on both sides, so an accepted capacity is always buildable in Layout — this can never accept a plan that fails to allocate. The loss is a smaller alias budget, not corruption.
Fix: make the dense-plane test width-relative and monotone, e.g. alignment.div_ceil(unit) * largest_count.max(1) <= row.div_ceil(page), keeping the third clause additive rather than as a replacement.
MINOR-2 — hash_file evicts the page cache of a file that is immediately re-read in full by the same import path
Diff site: helios/src/core/cache.rs:4502-4513 + caller helios/src/core/cache.rs:1900-1906.
let read = loop { ... };
crate::os::release_page_cache(&file);
read?;
Ok(PayloadId::from_digest(context.finish()))
let digest = hash_file(&path)?;
let file = File::open(&path).map_err(failure)?;
let object = self.insert_legacy_container(digest, file)?;
hash_file's only caller (import_legacy_into) opens the identical inode on the next line and streams it again through write_stream, so the eviction converts a warm second pass into a guaranteed cold re-read.
Counterexample: flare cache import of a 70 GB legacy core set — ~70 GB of extra storage reads (import read volume roughly doubles on NVMe).
Fix: give hash_file a release: bool (or hoist the eviction to after insert_legacy_container returns) and pass false at cache.rs:1904.
MINOR-3 — plan accounting double-counts the sentinel rounding tail (pessimistic only)
Diff sites: helios/src/runtime_core/memory.rs:1361 and :589; callee cache_memory.rs:133-141/:291-304.
The row side now correctly becomes alignment + tail (fixed_segments), but the KV side keeps bytes(core,1,pages) = Σ round_up(pages*unit, align) while the bytes actually created per plane are (page_capacity*unit).div_ceil(a)*a, i.e. one granule less when the extent is already aligned. pages*unit = 4 MiB with a = 2 MiB → estimate 4 MiB, real 2 MiB. Effect: one skipped KV page and a slightly inflated "Allocate cache" total; never an over-accept. Fix: mirror remaining_prefix for the page side in both places.
Verified correct (with the counterexamples that were actually run through)
O_DIRECT peer serving — flare-cli/src/distribution.rs:1267-1336. read_len = (skip + take).next_multiple_of(4096) is provably <= chunk_bytes for every input (skip < 4096, take <= chunk_bytes - skip, chunk_bytes a 4096 multiple) → no OOB into AlignedBuffer, no position - skip underflow. count <= skip reproduces RangeReader's exact "file ended inside a requested range" error (core_cache.rs:599-601), so EOF-inside-range is byte-identical across both paths. The mid-stream EINVAL fallback reconstructs rest = [(position, remaining)] ++ ranges[index+1..] — resumption is byte-exact at every failure index (0/1/2/3), no duplication or loss, and total + copied is the true count. direct_reopen resolves /proc/self/fd/N (same inode, works for unlinked files) so there is no TOCTOU against the verified fd. Empty/zero-length ranges short-circuit to Ok(0). Note serve_source:1216 discards the return value, and the receiver enforces exactly range_bytes bytes, so a short copy surfaces as UnexpectedEof rather than silent corruption. Double release_page_cache_range on the fallback path (copy_ranges_buffered then copy_source_ranges:1330) is idempotent posix_fadvise on the same inode — harmless.
Windows build of the new re-exports — helios/src/lib.rs:38-41. All re-exported symbols exist on Windows (direct_reopen eos/src/windows.rs:126, release_page_cache* windows.rs:150-151 no-op stubs; FileReadAt/allocate_aligned/free_aligned are unconditional in eos/src/lib.rs:24-64), and every #[cfg(unix)] gate in distribution.rs is complete. No compile break.
copy_file durability — helios/src/core/cache.rs:4767-4777. The "lost directory fsync" hypothesis is false: the removed callee container::sync_file (container.rs:1176-1185) is, on non-Windows, exactly File::open(path)?.sync_all(); directory durability is still provided by synchronize→syncdir (cache.rs:4813, 4836-4842), and make_immutable still runs after it. No mmap of container files exists anywhere (only helios/src/engram/reader.rs memfds and an anonymous mapping), so POSIX_FADV_DONTNEED cannot unmap live pages.
verify_file/hash_file restructure — helios/src/core/cache.rs:4432-4446, 4502-4513. The let read = loop { break Ok/Err } form has no early return, so release_page_cache always runs; read? still precedes context.finish(), so a mid-read error still suppresses the digest comparison and propagates the identical failure(error).
row_backing_bytes — helios/src/runtime_core/memory.rs:492-509. Proved consistent with the real layout for all units >= 1, not just multiples: with n = row_bytes/alignment, round_up(u*row_bytes, a) - (n-1)*a = a + (fixed_bytes - n*a) = granule + tail, which is exactly fixed_segments() under fixed_bytes = round_up(execution*row_bytes, a) (cache_memory.rs:291, :410-414). Worked check: row=82_143_488, a=2 MiB (n=39), u=2 → span=158 MiB, saved=76 MiB, result 82 MiB = 2 MiB + 80 MiB, matching the new test's claim. Non-multiple case row=1_500_000, a=2 MiB: u=1 → 2 MiB, u=2 → 3_145_728 = a + 1 MiB. units == 0 returns span early, matching sentinel_granules = 0; no call site passes execution == 0 (memory.rs:581/605/618/1103/1361), and saved <= span - a, so no underflow is reachable. bytes(core, 0, …) is deliberately retained at memory.rs:676-680 (virtual extent vs physical); no site was missed.
meminfo + OOM enrichment — helios/src/runtime_core/memory.rs:41-146, mod.rs:375-388. parse matches only exact "MemFree:"/"MemAvailable:"/"Cached:" tokens, so SwapCached:/SReclaimable: cannot alias Cached:; every fields.next()? early-return is fail-closed (diagnostics skipped, never a wrong number); checked_mul(1024) covers overflow. reclaimable_gap() = available.saturating_sub(free) is correct (Linux guarantees available >= free). Thresholds use strict > and the tests pin 10 GiB/4 GiB exact-boundary behaviour. check_ctx passes the real status at both call sites (cuDevicePrimaryCtxRetain mod.rs:407-410, cuCtxCreate_v2 :413-416), only re-reads /proc when integrated != 0 && status == CUDA_ERROR_OUT_OF_MEMORY, and preserves the structured Error::Execution(ExecutionError::Driver(CudaError { code: 2, .. })) — the #[cfg]-shadowed let result is legal and warning-free on both platforms. CUDA_ERROR_OUT_OF_MEMORY = 2 is correct.
Persistent-group merge, explicit-CLI path. skip_config_limit == false appends both occurrences, and OrbitRun carries #[command(args_override_self = true)] (cli.rs:571-573), so clap keeps the last value → an explicit --memory-limit genuinely overrides a saved one. The defect above is confined to the config-inherited path.
Not verifiable in this environment (carried from the PR's own disclosures): live GB10 CU_DEVICE_ATTRIBUTE_INTEGRATED / CUDA_ERROR_OUT_OF_MEMORY-during-context-creation behaviour, whether cuDevSmResourceSplit accepts the three-group codec partition on driver 615.x, and whether codec-context VMM allocations remain usable from the compute/worker contexts. The 10 GiB / 4 GiB thresholds are heuristic by construction with no live MemFree/MemAvailable data.
Final review
Recommendation: Changes Requested
The O_DIRECT peer-serving rewrite, the four new page-cache release sites, the /proc/meminfo parser/enrichment, and the [memory] reserve inheritance are all correct on the read/write paths I traced at 4efd9fd — the aligned-chunk arithmetic cannot overrun its buffer, the mid-stream EINVAL fallback is byte-exact, the release calls are unconditional, and the Windows/macOS cfg gating is complete. Two verified, non-hardware defects remain: the config-derived --memory-limit is written into the persisted --persistent group and then locked in by the very rule that is supposed to protect saved values, and hash_file now evicts the page cache of a file the same import path immediately re-reads in full. Both are small, local fixes.
Merge Risk
Level: Medium
- The peer-serving read path changes for every Unix multi-host
orbit run/orbit push, and the whole benefit rests on an unmeasured GB10 effect (#630's 2026-12-02 data shows merged #667's release calls did not clear the ~9 GiB controller cache by plan time); the fallback keeps correctness but silently reverts behaviour on filesystems that rejectO_DIRECT. - The
[memory] reserveinheritance is a silent KV-budget change for anyorbit.toml(not opened) with a reserve and no--memory-limitonorbit run, and the new saved-vs-config precedence rule plus the newPlan cache/stderr/error text ship undocumented (0 of 11 files are docs). - Three independently reviewable changes in one PR; the sizing path itself (
helios/src/runtime_core/memory.rs:31-33→flare_selene::offload::available_memory) and therefore #630 ask 1 is untouched.
Walkthrough
flare-cli/src/distribution.rs:1319-1336replacesio::copy(RangeReader)inserve_sourcewithcopy_source_ranges:direct_reopen(:1328) →copy_ranges_direct(:1268-1317, 4 MiBAlignedBuffer, 4096 block, unaligned head/tail,EINTRretry,EINVAL→copy_ranges_bufferedon the remainder at:1305-1311), then an unconditional per-rangerelease_page_cache_rangeloop that runs even when the direct copy errored (:1330-1333).- New buffered-path releases:
flare-cli/src/orbit/controller.rs:1464-1466(controller uploadput, release beforeresult?),helios/src/core/cache.rs:4398(write_streampost-sync_all),:4441/:4511(verify_file/hash_filevialet read = loop {..}; release; read?),:4772/:4774(copy_filedestination and source),flare-cli/src/core_cache.rs:450/455/505/562,flare-cli/src/orbit/agent.rs:2068. flare-cli/src/config.rs:152-158givesOrbitCommand::Runthe same[memory] reserve→MemoryLimit::Reserveinheritance asCommand::Run(:76-80);flare-cli/src/main.rs:537-540recordsmemory_limit_from_configfromvalue_source != CommandLine;flare-cli/src/orbit/controller.rs:1967-1997skips the config-inherited--memory-limitwhen the saved group already has one.helios/src/runtime_core/memory.rs:35-140addsLinuxMemInfo(strictMemFree:/MemAvailable:/Cached:kB parse withchecked_mul),append_integrated_meminfo(appends the triple toPlan cache, returns a warning above a 10 GiB reclaimable gap) wired at:1256-1268for any integrated rank, andenrich_integrated_ctx_oom(4 GiBdrop_cacheshint) wired athelios/src/runtime_core/mod.rs:375-388around bothcuDevicePrimaryCtxRetainandcuCtxCreate_v2.
Pre-merge Checks
- [PASS] Security / malicious screen: No new dependency, no network or privilege change; the
drop_cachestext is only printed advice, andLinuxMemInfo::readis a bounded/procread gated on integrated + OOM status (mod.rs:379-385). - [WARN] Charter & value fit: In scope (DGX Spark is named in the charter, #630 is a P2 report, Orbit supervision is a goal), but the charter's "bring real evidence" clause is unmet for the headline benefit — impact is unmeasured on target hardware and #630's primary ask is untouched; ask to split into three PRs stands.
- [PASS] Related / duplicate / conflict check: Extends merged #667 rather than duplicating it; no open PR competes and no later
maincommit touches these 11 files. Merged #690/#702/#707 content inpr_diffis a stale-merge-base artifact and was excluded — includinghelios/src/runtime_core/cache_memory.rsand therow_backing_bytes/largest_count/codec-partition hunks, which are not inpr_filesand are absent frommain(main'salias_planeis still the 5-argument form atcache_memory.rs:67). - [WARN] Tests & verification evidence: Targeted tests are present and meaningful (
distribution.rs:1820-1944,config.rs:896-990,controller.rs:3794-3839,memory.rs:2266-2409), but the real-O_DIRECTassertions sit insideif let Ok(tempdir_in("/var/tmp"))+if let Ok(direct_reopen(...))(distribution.rs:1863-1897), so on filesystems withoutO_DIRECTthe direct path is silently never exercised; test counts are self-reported and there are no checks on4efd9fd.
Blockers
None.
Should Fix
- Config-derived
--memory-limitis frozen into a--persistentgroup, so later[memory] reserveedits are silently ignored forever.flare-cli/src/orbit/controller.rs:692-696mergessaved ++ current; when the saved group has no limit and the limit came from config, the config-derived--memory-limit=<v>(produced byflare-cli/src/cli.rs:1150-1152viaOrbitRun::rank_options,cli.rs:672-682) is appended and then persisted verbatim:GroupSpec { serving: serving.clone(), .. }atflare-cli/src/orbit/controller.rs:875-878→Orbit::save_group(flare-cli/src/orbit/store.rs:318-324) →~/.config/flare/orbit.toml(not opened). On the next launchspec.servingnow contains--memory-limit, soskip_config_limit = memory_limit_from_config && has_memory_limit(saved)(:1978) istrueand the new config value is skipped. Verified counterexample:[memory] reserve = "12 GiB",orbit run --name g --persistent model/→ saved--memory-limit=-12GiB; operator corrects config to7 GiB;orbit run --name gstill launches with 12 GiB, with no warning, and the only escapes are an explicit flag or hand-editingorbit.toml(not opened). This inverts the PR's own goal ("without clobbering saved persistent-group overrides") — the value the operator never typed becomes the saved override. Fix: do not persist a config-derived limit — strip it beforesave_group(retain-drop the config-inherited entry whenoptions.memory_limit_from_config), or carry it as its ownGroupSpecfield re-applied at launch, mirroringtransfer_streams/roce_ring. The four existing tests (controller.rs:3794-3839) never round-trip throughsave_group/Orbit::load, which is why this is unobserved; add one that persists, edits the reserve, and reloads. hash_fileevicts the page cache of the file the same import path immediately re-reads in full.helios/src/core/cache.rs:4511drops the cache after hashing, and its only caller opens the identical inode on the next line:let digest = hash_file(&path)?; let file = File::open(&path)...; self.insert_legacy_container(digest, file)?(:1904-1906), which streams the whole file again throughwrite_stream(:4386-4396) and evicts again (:4398). Net effect: the legacy-core import path now reads every payload from storage twice instead of once warm — roughly doubling read volume on a multi-GB core set (flare cache import-style flows throughimport_legacy_into,:1889). This is a regression introduced by this PR on the host-RAM reuse side of the #93/#630 trade. Fix: givehash_filearelease: bool(passfalseat:1904) or hoist the eviction to afterinsert_legacy_containerreturns.
Subtract / Simplify
helios/src/core/cache.rs:4428-4447ishash_file(:4498-4514) plus one comparison; collapse toif hash_file(path)? != declared { .. }so the newly addedrelease_page_cacheexists once instead of twice.helios/src/runtime_core/memory.rs:117-129:enrich_integrated_ctx_oom(error, integrated: bool, meminfo: Option<LinuxMemInfo>)encodes one fact twice (integrated == trueimpliesmeminfo.is_some()at the only call site,mod.rs:379-385) and re-tests the OOM code already tested by the caller's.then(..). OneOption<LinuxMemInfo>parameter removes the invalid state, the duplicate OOM test, and the duplicatedintegrated != 0.flare-cli/src/distribution.rs:1261-1263and:1330-1332are the same release loop; hoisting it intocopy_source_rangesafter the branch (release always, then return the copy result) makes "every served range is released" true in one place and preserves the release-on-error property.flare-cli/src/distribution.rs:1226-1253re-implements the sameallocate_aligned/free_alignedowning wrapper that exists atselene/src/disk.rs(not opened) (~2253-2294); a shared owningAlignedBufferineos(where the allocator lives) deletes it and one hand-writtenDrop.flare-cli/src/orbit/controller.rs:1967-1997is a third hand-rolled--flag/--flag=+skip_nextargv scanner in this crate (seededuplicate_tensor_parallel:2000-2028andorbit/agent.rs:2231-2251); carrying the reserve as a value (Option<MemoryLimit>) instead of argv removeshas_memory_limit,skip_config_limit,skip_next, the bool field and the duplicated predicate — and would make Should Fix 1 structurally impossible.
Nits
helios/src/runtime_core/memory.rs:105+:109-111: on a polluted GB10 controller the sameMemFree / MemAvailable / Cachedtriple is printed twice in one startup (once appended toPlan cache, once inside the warning). Drop the parenthetical from the warning string.helios/src/runtime_core/memory.rs:36-38: two constants (10 << 30,4 << 30) answer the same question with different answers and no stated rationale; collapse or justify.flare-cli/src/distribution.rs:1234-1238: the 4 MiBwrite_byteszero-fill is required for&mut [u8]soundness over fresh C memory, but it is fully unnecessary for correctness of the copy (onlyslice[..read_len]is read, andslice[skip..skip+available]is written) — a per-request 4 MiB memset on the serving path;MaybeUninitor a buffer hoisted out of the request loop avoids it.flare-cli/src/distribution.rs:1863-1897: the real-O_DIRECTassertions are skipped silently when/var/tmpor the FS rejectsO_DIRECT; assert (or at least report) that at least one environment exercised the direct branch so the fallback-only run is visible.- Documentation: 0 of 11 files are docs while three user-visible things are new — the saved-vs-config
--memory-limitprecedence (the documented analogue isdocs/orbit.md:632-634fortransfer_streams), the extraPlan cachefields/stderr warning (docs/cli-design.md:1436-1484), anddocs/orbit.md:467's "groups … retain their own serving memory settings", now true only for groups that saved a limit.
Dropped on verification
alias_plane'slargest_countmakes plane eligibility non-monotone (cache_memory.rs): out of scope —helios/src/runtime_core/cache_memory.rsis not inpr_files, andmainstill has the 5-argumentalias_planeatcache_memory.rs:67, so this hunk belongs to already-merged work behind the stale merge base.row_backing_bytessentinel rounding double-count: same reason — absent frommainentirely, and the PR'smemory.rsdelta is exactly+266= the meminfo block (~107) + wiring (~12) + meminfo tests (~147);row_backing_bytes/largest_count/sentinel tests are branch-point work, not this PR.copy_filelost a directory fsync / durability regression: false. The removedcontainer::sync_fileis, on non-Windows, exactlyFile::open(path)?.sync_all()(helios/src/core/container.rs:1179-1185), which is whatcache.rs:4770-4771now does inline.release_page_cachecan be skipped on read error inverify_file/hash_file: false. Both uselet read = loop { .. break Ok/Err .. };with no earlyreturn, sorelease_page_cachealways runs andread?still precedescontext.finish().- Double
release_page_cache_rangeon theEINVALfallback corrupts/duplicates work: false —posix_fadvise(POSIX_FADV_DONTNEED)on the same inode twice is idempotent (eos/src/unix.rs:68-85), and the fallback writes exactly the remaining bytes (distribution.rs:1306-1310), proven byte-exact for fail-on-call 0..3 bydistribution.rs:1933-1943. O_DIRECTbuffer overrun /position - skipunderflow / EOF divergence fromRangeReader: false.take <= chunk_bytes - skip⇒read_len = (skip+take).next_multiple_of(4096) <= chunk_bytes(chunk is a 4096 multiple);skip < 4096 ≤ chunk_bytes; andcount <= skipreturns the same"file ended inside a requested range"error asRangeReader(core_cache.rs:599-601).- Two divergent
/proc/meminfoparsers make the printed number disagree with the sizing number: not a bug — sizing still goes throughshared_available→flare_selene::offload::available_memory(memory.rs:31-33,:344), the new parser only formats a diagnostic, and the parsers differ only on malformed input the kernel never emits. Kept only as the dedup item above. enrich_integrated_ctx_oom's(bool, Option<_>)is a defect: style only (moved to Subtract/Simplify), and the#[cfg(target_os = "linux")]-shadowedlet resultatmod.rs:376-387compiles warning-free becauseintegratedis also used at:435.serve_sourcediscardscopy_source_ranges' byte count (distribution.rs:1216): pre-existing shape, and the receiver enforces exactlyrange_bytes, so a short copy surfaces asUnexpectedEofrather than silent corruption.- No CI checks on
4efd9fd/design-review=2e5bnames no sign-off identity: not raised as findings — CI is not observable with these tools, anddocs/design-review.md:294-299(not opened) puts the trailer in the commit message, which is unreadable in this copy. Plan cacheextra fields break log scrapers: speculative; no test or tool in the tree asserts that line.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 99.6% -
triage:design-review: 0.3% -
triage:validation: 0.1% -
none: 0.0% -
triage:partial: 0.0% -
triage:investigate: 0.0% -
triage:integration: 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.