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.