Final review report · NVIDIA/hyperflare-inference #713

Raw Markdown for agents: https://autobot.eidonix.com/p/eaff26b3-8555-4f1f-a6e4-eebcc2f4f15b.md

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

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. Config-derived --memory-limit is frozen into a --persistent group, so later [memory] reserve edits are silently ignored forever. flare-cli/src/orbit/controller.rs:692-696 merges saved ++ current; when the saved group has no limit and the limit came from config, the config-derived --memory-limit=<v> (produced by flare-cli/src/cli.rs:1150-1152 via OrbitRun::rank_options, cli.rs:672-682) is appended and then persisted verbatim: GroupSpec { serving: serving.clone(), .. } at flare-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 launch spec.serving now contains --memory-limit, so skip_config_limit = memory_limit_from_config && has_memory_limit(saved) (:1978) is true and 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 to 7 GiB; orbit run --name g still launches with 12 GiB, with no warning, and the only escapes are an explicit flag or hand-editing orbit.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 before save_group (retain-drop the config-inherited entry when options.memory_limit_from_config), or carry it as its own GroupSpec field re-applied at launch, mirroring transfer_streams/roce_ring. The four existing tests (controller.rs:3794-3839) never round-trip through save_group/Orbit::load, which is why this is unobserved; add one that persists, edits the reserve, and reloads.
  2. hash_file evicts the page cache of the file the same import path immediately re-reads in full. helios/src/core/cache.rs:4511 drops 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 through write_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 through import_legacy_into, :1889). This is a regression introduced by this PR on the host-RAM reuse side of the #93/#630 trade. Fix: give hash_file a release: bool (pass false at :1904) or hoist the eviction to after insert_legacy_container returns.

Subtract / Simplify

  1. helios/src/core/cache.rs:4428-4447 is hash_file (:4498-4514) plus one comparison; collapse to if hash_file(path)? != declared { .. } so the newly added release_page_cache exists once instead of twice.
  2. helios/src/runtime_core/memory.rs:117-129: enrich_integrated_ctx_oom(error, integrated: bool, meminfo: Option<LinuxMemInfo>) encodes one fact twice (integrated == true implies meminfo.is_some() at the only call site, mod.rs:379-385) and re-tests the OOM code already tested by the caller's .then(..). One Option<LinuxMemInfo> parameter removes the invalid state, the duplicate OOM test, and the duplicated integrated != 0.
  3. flare-cli/src/distribution.rs:1261-1263 and :1330-1332 are the same release loop; hoisting it into copy_source_ranges after 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.
  4. flare-cli/src/distribution.rs:1226-1253 re-implements the same allocate_aligned/free_aligned owning wrapper that exists at selene/src/disk.rs (not opened) (~2253-2294); a shared owning AlignedBuffer in eos (where the allocator lives) deletes it and one hand-written Drop.
  5. flare-cli/src/orbit/controller.rs:1967-1997 is a third hand-rolled --flag/--flag= + skip_next argv scanner in this crate (see deduplicate_tensor_parallel :2000-2028 and orbit/agent.rs:2231-2251); carrying the reserve as a value (Option<MemoryLimit>) instead of argv removes has_memory_limit, skip_config_limit, skip_next, the bool field and the duplicated predicate — and would make Should Fix 1 structurally impossible.

Nits

Dropped on verification