Repository navigation
Unify Orbit rank cache, fix GB10 page-cache KV sizing, consolidate NVML, and harden flare-agent - #646
Merged
Merged
Conversation
…ML, and harden flare-agent Why this change is needed: Four classes of operational defects affect multi-host Orbit clusters and unified-memory GPUs (such as DGX Spark GB10): 1. Orbit rank-cache collision, eviction data loss, and duplicate staging (#119, #361, #629, #147): `flare agent` hardcoded its cache root to `~/.cache/flare` instead of honoring `--core-cache` / `[paths].core_cache`, stored flat core directories inside `~/.cache/flare/cores` (the default managed `helios::core::cache::Root` directory), and called `core_cache::evict` on that directory during `PUT` and `TRANSFER`. That eviction sweep deleted Helios's managed `blobs/`, `models/`, `refs/`, `sources/`, `origins/`, `staging/`, and `locks/` subdirectories without consulting Helios leases (#119). Meanwhile, `agent::run` passed `--core-cache ~/.cache/flare` to spawned `flare run` peers, so peer ranks opened a second model cache outside `~/.cache/flare/cores` and could not reuse peer rank shards staged by `orbit push` (#629). In addition, controller-local `PUT` uploads to `nodes[0]` skipped verification and left `.verified` absent; `OrbitRun::rank_options` and `launch::Peers::start` duplicated `--roce-ring` / `--roce-chain` into `spec.serving` and `Grant.serving` alongside `Grant`'s booleans (breaking overrides on saved persistent groups); and `flare run CORE --hosts` built `Grant.core` from the cached entry directory instead of `model.safetensors` while failing peer `core_cache::component_valid` on `+` in multi-deployment names and failing to infer `tensor_parallel = hosts.len() + 1`. 2. GB10 KV collapse and integrated-memory over-reservation (#630): `PayloadSource::release_page_cache()` was an empty no-op (unlike `Archive::release_page_cache()`), leaving tens of GiB of SHA-256-verified payload pages resident in Linux page cache through CUDA initialization and KV sizing. In `helios/src/runtime_core/memory.rs`, `NativeModel::allocate_caches` added `input_window` into both `offload_host` and `host_future`, charging it twice whenever prefix-cache offload was enabled. In `selene/src/offload.rs`, `target_intake_slots` bounded integrated-GPU intake to `intake_slots(layout, 1)` only when `memory_bytes == 0 && disk_enabled()`, allowing nonzero warm memory on unified-memory GPUs to reserve concurrency-scaled burst intake slots. Finally, `VerifiedCore::authorize_metadata` returned the same loadable `AuthorizedCore` type accepted by GPU loaders even though supporting payloads were not verified upfront. 3. `flare-agent` authentication, lifecycle, and LAN resilience gaps: `Agent::grant()` verified signatures without checking `grant.current(now())`, allowing expired grants to work indefinitely for `TRANSFER`, `FETCH`, and `FETCH_FABRIC`. `serve_on()` spawned unbounded pre-auth OS threads and `Session::accept` cleared read timeouts before `HELLO` or authorization while waiting for 44 bytes before checking the 8-byte `FLAREFLT` magic. `Key::load_or_create`, `AgentDir::private_write`, and `Orbit::save` wrote secret files with default umask before `chmod 0600`. The rank reaper joined stdout/stderr forwarders before calling `Group::finish()`, allowing a grandchild holding stdio open to lock GPUs and pins indefinitely and leaving a PID-reuse window in `agent::stop`; ranks were spawned without process-group isolation or `PR_SET_PDEATHSIG`; `Controller::stop_group` waited on rank zero without a timeout; and stray LAN probes on the rendezvous or wildcard fabric relay listeners aborted active launches. 4. Duplicated NVML loaders, FD leak, and ordinal visibility mismatch: Five files across `helios`, `flare`, `heliopause`, and `flare-cli` duplicated dynamic NVML loading, and six call sites invoked `nvmlInit_v2()` / `nvmlShutdown()` per query—causing `HardwareMonitor`'s 2-second polling loop to leak ~1,800 NVML event file descriptors per hour. In `flare/src/hardware.rs`, `assign_visibility()` matched numeric `CUDA_VISIBLE_DEVICES` entries against the filtered vector slice index instead of `device.ordinal`, misbinding GPUs whenever a non-CUDA device was skipped. What exactly changed: - Orbit rank cache unification and CLI/Grant fixes (`flare-cli/src/{cli,config,core_cache,distribution,launch,main,trust}.rs`, `flare-cli/src/orbit/{agent,controller}.rs`, `helios/src/core/cache.rs`, `docs/orbit.md`): - Before: `flare agent` ignored `--core-cache` and `[paths].core_cache`, stored flat directories in `~/.cache/flare/cores`, evicted unpinned entries there, passed `--core-cache ~/.cache/flare` to ranks, left `nodes[0]` unverified after `PUT`, duplicated RoCE flags in `serving`, and wrote cached directory paths into `--hosts` `Grant.core`. - After: `Command::Agent` and `AgentCommand::Install` accept `--core-cache` and inherit `[paths].core_cache` (default `~/.cache/flare/cores`). In-flight `PUT`/`TRANSFER` files stage under `<core-cache>/staging/orbit`, never calling `core_cache::evict` on core caches (`evict` also skips Helios's seven managed directories as defense-in-depth). Verified transfers—including `nodes[0]` after controller `PUT`—commit into `helios::core::cache::Root` with `.verified` and `.flare-verified.json` markers and publish `orbit:<dir>`, `<export>-rank<R>`, and `<export>-complete` source refs shared with `distribution::receive_rank`, `Agent::cores()`, and placement. `agent::run` passes `--core-cache <agent.core_cache>`, holds `Entry` leases on active local cores, and skips `cache::entry` for remote-bootstrap peers. RoCE shape flags are stripped from `serving` and emitted once from `Grant`'s booleans. `--hosts` resolves `model.safetensors` inside cached entry directories and infers `tensor_parallel = hosts.len() + 1`. - GB10 page-cache release, memory sizing, Selene intake, and metadata-only guard (`helios/src/runtime_core/{protection,memory,mod,model}.rs`, `selene/src/offload.rs`, `docs/prefix-cache-offload.md`): - Before: `PayloadSource::release_page_cache()` was empty; `memory.rs` counted `input_window` in both `offload_host` and `host_future`; `selene::offload::target_intake_slots` only capped integrated GPUs when `disk_only`; and metadata-only `AuthorizedCore` could enter GPU loaders. - After: `PayloadSource::release_page_cache()` invokes `crate::os::release_page_cache` once per unique `Arc<File>` across `primary` and all opened payload containers; `planned_host_future` counts `input_window` once; `target_intake_slots` and `sized_concurrency` bound all integrated-GPU local offload tiers to `intake_slots(layout, 1)`; and `AuthorizedCore` tracks `loadable` so `NativeResources::load`, `NativeModel::load_agreeing`, and `PayloadAuthorizedCore::load` reject metadata-only authorizations before touching CUDA. - `flare-agent` hardening and stray LAN probe handling (`flare-cli/src/orbit/{agent,controller,identity,session,store}.rs`, `flare-cli/src/{distribution,fabric_transport}.rs`): - Before: `Agent::grant()` ignored expiry; `serve_on()` had no session or pre-auth cap; `Session::accept` read 44 bytes before checking magic and cleared timeouts before authorization; secret files were written before `chmod 0600`; the reaper blocked `finish()` on forwarder joins with no process-group isolation or `PR_SET_PDEATHSIG`; `stop_group` looped unboundedly on rank zero; and stray TCP connections aborted rendezvous and fabric relay listeners. - After: `Agent::grant()` rejects expired grants across all RPCs; `serve_on()` bounds concurrent sessions (`1024`) and pre-auth sessions (`256`); `Session::accept` checks the 8-byte `FLAREFLT` magic first and keeps read/write handshake timeouts armed until peer authorization; `atomic_write_private` creates secrets with `O_CREAT | O_EXCL` mode `0600` + `fsync` + `rename`; rank processes run in isolated process groups (`setpgid(0, 0)`) with Linux `PR_SET_PDEATHSIG(SIGTERM)`, PID-reuse-guarded process-group `SIGTERM`, and a 2-second bounded forwarder drain before `finished.finish(code)`; `stop_group` bounds rank zero drain to 120s; and `distribution::root` and `fabric_transport::serve` drop stray LAN probes without aborting active transfers. - Consolidated NVML `OnceLock` loader and ordinal fix (`helios/src/{nvml,lib}.rs`, `helios/src/runtime_core/device_memory.rs`, `flare/src/hardware.rs`, `heliopause/src/export/capture.rs`, `flare-cli/src/{doctor.rs,orbit/gpu.rs}`): - Before: five crates duplicated NVML FFI structs and per-call `nvmlInit_v2` / `nvmlShutdown`, leaking ~1,800 FDs/hr in `HardwareMonitor`, and `assign_visibility()` compared numeric `CUDA_VISIBLE_DEVICES` entries to slice index instead of `device.ordinal`. - After: added `flare_helios::nvml::Nvml` backed by a process-wide `OnceLock` (using `LOAD_LIBRARY_SEARCH_SYSTEM32` on Windows and never calling `nvmlShutdown`), migrated all seven Rust call sites across five files with zero `Cargo.toml`/`Cargo.lock` changes, and matched numeric `CUDA_VISIBLE_DEVICES` entries against `device.ordinal`. Claimed benefit or result: - Expected on multi-host Orbit clusters: eliminates silent deletion of managed Helios cache trees during `PUT`/`TRANSFER` (#119), eliminates duplicate peer rank staging between `orbit push` and `orbit run` (#361, #629), preserves `.verified` status on `nodes[0]`, fixes persistent-group RoCE shape overrides and `--hosts` cached/multi-deployment launches, and hardens `flare-agent` against expired-grant replay, pre-auth thread exhaustion, secret permission races, stuck reapers, and stray LAN probes. - Expected on GB10 and integrated-memory GPUs: reclaims verified weight page cache before CUDA init and KV sizing, stops double-charging `input_window`, and bounds local-tier offload intake when warm memory is nonzero (#630). - Expected on long-lived polling processes (`HardwareMonitor`, `flare agent`): eliminates the ~1,800 FDs/hr NVML event-descriptor leak and fixes numeric `CUDA_VISIBLE_DEVICES` matching when non-CUDA NVML devices are skipped. - These are CPU-verified behavioral guarantees; live GB10 KV token recovery and live 4-Spark transfer latency have not yet been measured on hardware. Supporting evidence and limitations: All Rust test suites ran with `--locked --release` in this worktree on Linux x86_64: - `eos`: 2 passed, 0 failed. - `selene` (`--features test-support`): 548 unit + 1 integration passed, 0 failed (updated integrated-GPU `memory_bytes > 0` intake assertions). - `selene-manager` (`--features test-support`): all passed, 0 failed. - `helios` (`--features runtime-core,server`, `core::`, `runtime_core::`, `nvml`): 504 passed, 0 failed, 12 ignored (GPU/checkpoint-gated), including `authorize_metadata_is_not_loadable`, `payload_source_release_page_cache_deduplicates_unique_files`, `planned_host_future_counts_input_window_once`, and `integrated_offload_host_budget_matches_small_soc_scaling_and_explicit_limits`. - `flare`: all unit and integration tests passed, 0 failed, including `gpu_inventory_visibility_matches_nvml_ordinal_when_non_cuda_devices_skipped`. - `flare-cli`: 208 unit tests passed (0 failed, 3 ignored) + 26 integration tests passed (`cache_commands` 9, `cli` 6, `inspect` 4, `unverified_payload` 7), including new tests for managed-cache eviction protection, shared `Root` rank refs, `nodes[0]` verification after `orbit push`, expired-grant rejection across all RPCs, RoCE deduplication, `Command::Agent` `--core-cache` precedence, atomic `0600` secret creation, immediate short-probe rejection, stray LAN probe tolerance on `fabric_transport`, and reaper completion with leaked grandchild stdio. (`actual_load_core_leases_managed_local_entries_and_releases_on_failure` exhibits a pre-existing parallel `fork`-vs-`flock` race in concurrent runs and passed standalone.) - `heliopause`: 216 passed, 0 failed, 6 ignored (CUDA). - Unrun checks: live GB10 KV capacity measurement, live multi-host 4-Spark `orbit push`/`orbit run`, Windows `nvml.dll` compilation, and `FLARE_TEST_TEMPLATE_DIR` chat-template tests. Design-Signed-Off-By: Antigravity (Gemini); design-review=2e5b
Collaborator
|
A case file has been opened for 646. Future reviews will auto-run 90 minutes after code updates are pushed.
|
Collaborator
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedFour real operational defects are addressed and the core fixes are clean and well-tested, but verification surfaced one blocker (permanently leaked Orbit staging cores with no reclamation path) plus several concrete correctness gaps, including a marker-ordering bug that defeats
Walkthrough
Merge Risk: High · up to
|
…t reaper Interrupted `PUT` or `TRANSFER` operations left unleased directories under `<core-cache>/staging/orbit/cores/` (and companion hardlinks under `staging/orbit/blobs/`) without reclamation. In addition, multi-file `.flare-verified.json` matching zipped `Plan.files` positionally against unsorted `read_dir` output from `move_staged_tree`, `agent::stop` raced `child.wait()` before setting `exited`, `flare agent install` ignored `[paths].core_cache` and top-level `--core-cache` and wrote unquoted systemd `ExecStart=` arguments, `distribution::root` swallowed valid version/rank-mismatch `Join` frames, and `publish_orbit_entry` ignored marker-write failures. Changes: - Reclaim unleased `<core-cache>/staging/orbit/cores/` entries on agent startup, after core `PUT` and `TRANSFER`, and in `helios::core::cache::Root::collect()` (along with unreachable `staging/orbit/blobs/` files); hold shared `flock` leases on staged directories across live controller sessions (`PUT` -> `TRANSFER`), `FETCH`, and staging-backed `RUN` so concurrent GC preserves active staging. - Sort `move_staged_tree` and `write_verified_marker_for` file lists and match `verified_marker_matches` by filename instead of position. - Coordinate Linux child reaping with `stop()` via `waitid(P_PID, ..., WEXITED | WNOWAIT)` and `Group::reap` so `kill()` never targets a reused PID. - Propagate `[paths].core_cache` and top-level `flare agent --core-cache` into `flare agent install` (preserving subcommand precedence) and quote `--core-cache` for systemd `ExecStart=`. - Raise `MAX_PREAUTH_SESSIONS` to 1024 and `MAX_SESSIONS` to 1152 for 16-rank × 64-stream bursts and log when connections are shed; avoid redundant pre-`read_header` controller checks once authorized. - Fail fast in `distribution::root` on valid `Join` frames with an incompatible version or invalid/duplicate rank while still ignoring malformed TCP probes; propagate `.verified`/`.flare-verified.json` write errors in `publish_orbit_entry` and roll back the unpublished entry. - Share `helios::core::cache::ROOT_DIRECTORIES` with `core_cache::evict`, remove redundant `AuthorizedCore::is_loadable` and NVML `check(..)` wrappers, and document manual cleanup of legacy flat rank directories in `docs/orbit.md`. Verified with `--locked --release` tests: `helios` `core::`/`runtime_core::`/ `nvml` (505 passed, 12 ignored), `flare` (238 unit + 8 integration passed, 4 ignored), `flare-cli` (212 unit + 26 integration passed, 3 ignored), and `heliopause` (216 passed, 6 ignored). Design-Signed-Off-By: Antigravity (Gemini); design-review=2e5b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this change is needed
Four concrete operational defects affect multi-host Orbit clusters, unified-memory GPUs (such as DGX Spark GB10), and long-lived polling processes:
Orbit rank-cache collision, eviction data loss, and duplicate staging (closes Orbit agent eviction removes
flare download's default model store in~/.cache/flare/packages#119, Store Orbit rank files in the shared model cache #361, orbit run ignores --core-cache and paths.core_cache for rank-core staging: peer rank cores duplicated into ~/.cache/flare/cores on the controller host #629, fix(orbit): preserve the prepared model cache during eviction #147):flare-cli/src/main.rshardcodedflare agent's cache root toorbit::cache::default_root()(~/.cache/flare) and ignored--core-cacheand[paths].core_cache.agent::putandagent::transferstored flat core directories inside~/.cache/flare/cores—the exact default directory ofhelios::core::cache::Root—and rancore_cache::evict()over it, deleting Helios's managedblobs/,models/,refs/,sources/,origins/,staging/, andlocks/subdirectories without consulting Helios entry leases (Orbit agent eviction removesflare download's default model store in~/.cache/flare/packages#119).agent::runpassed--core-cache ~/.cache/flare(instead of~/.cache/flare/cores) to spawnedflare runpeers, sodistribution::receive_rankopened a separatehelios::core::cache::Rootand could not see peer rank slices staged byorbit push, forcing duplicate transfers onorbit run(orbit run ignores --core-cache and paths.core_cache for rank-core staging: peer rank cores duplicated into ~/.cache/flare/cores on the controller host #629).PUTuploads tonodes[0]cleared.verifiedand skippedTRANSFERverification, leavingnodes[0]unverified inSTATUS,flare orbit cores, and placement (plan::Pool::holds).OrbitRun::rank_optionsandlaunch::Peers::startemitted--roce-ring/--roce-chainintospec.servingandGrant.servingwhileGrantalso storedroce_ring/roce_chainbooleans thatagent::runappended again, breaking--roce-ring↔--roce-chainoverrides on saved persistent groups.flare run CORE --hostsbuiltGrant.coredirectly from the managed cache entry directory rather thanmodel.safetensors, failed peercore_cache::component_validon+in multi-deployment entry names even whenlocal_core == false, and did not infertensor_parallel = hosts.len() + 1.GB10 KV collapse,
input_windowdouble-counting, integrated intake over-reservation, and metadata-only loading (Addresses GB10 unified memory: KV budget and cuCtxCreate respond to page-cache-polluted MemFree, not MemAvailable — same core+reserve gives 2.08M vs 3.43M KV tokens and spurious CUDA_ERROR_OUT_OF_MEMORY #630):PayloadSource::release_page_cache()inhelios/src/runtime_core/protection.rswas an empty no-op (unlikeArchive::release_page_cache()), leaving tens of GiB of SHA-256-verified payload pages resident in Linux page cache through CUDA initialization and unified-memory KV sizing on GB10.NativeModel::allocate_cachesinhelios/src/runtime_core/memory.rsaddedstaging(input_window) intooffload_hostand then addedinput_windowa second time intohost_futurewhenever prefix-cache offload was enabled.selene/src/offload.rsbounded integrated-GPU intake (target_intake_slots/sized_concurrency) tointake_slots(layout, 1)only whenmemory_bytes == 0 && disk_enabled(), allowing nonzero warm memory on integrated GPUs to reserve concurrency-scaled burst intake slots from unified RAM.VerifiedCore::authorize_metadatareturned the sameAuthorizedCoretype accepted by GPU loaders even though supporting payloads were not verified upfront.input_window, and Selene intake causes described in GB10 unified memory: KV budget and cuCtxCreate respond to page-cache-polluted MemFree, not MemAvailable — same core+reserve gives 2.08M vs 3.43M KV tokens and spurious CUDA_ERROR_OUT_OF_MEMORY #630; it does not add the optional low-KV-budget warning orcuCtxCreateMemFree/MemAvailable/Cached diagnostics also suggested there.flare-agentsecurity, process-lifecycle, and LAN probe resilience gaps:Agent::grant()verified controller signatures without callinggrant.current(now()), allowing expired grants to remain valid indefinitely forTRANSFER,FETCH, andFETCH_FABRIC.serve_on()spawned unbounded pre-auth OS threads, andSession::acceptread 44 bytes before checking the 8-byteFLAREFLTmagic and cleared read timeouts toNonebeforeHELLOor peer authorization.Key::load_or_create,AgentDir::private_write, andOrbit::savewrote secret files under default umask before callingchmod 0600.Group::finish(), allowing any grandchild holding stdio FDs open to lock GPUs and cache pins indefinitely and leaving a PID-reuse signal window inagent::stop; ranks lacked process-group isolation and LinuxPR_SET_PDEATHSIG(SIGTERM);Controller::stop_grouplooped unboundedly waiting on rank zero.distribution::rootrendezvous andfabric_transport::serverelays.Duplicate NVML FFI loaders,
HardwareMonitorFD leak, and GPU ordinal visibility bug:libnvidia-ml.so.1FFI bindings existed acrosshelios,flare,heliopause, andflare-cli.flare/src/hardware_monitor.rspolledflare/src/hardware.rs::inventory()every 2 seconds, callingnvmlInit_v2()+nvmlShutdown()each cycle (~1,800 FDs/hr leak).flare/src/hardware.rs::assign_visibility()matched numericCUDA_VISIBLE_DEVICESentries against slice position instead ofdevice.ordinal, mis-mapping GPUs when non-CUDA NVML devices were skipped.What changed
Unified Orbit rank cache onto
helios::core::cache::Rootand fixed--hosts/ RoCE flag bugs (helios/src/core/cache.rs,flare-cli/src/{cli,config,core_cache,distribution,launch,main,trust}.rs,flare-cli/src/orbit/{agent,controller}.rs,docs/orbit.md):Command::Agentignored--core-cacheand[paths].core_cache, stored flat directories under~/.cache/flare/cores, rancore_cache::evictoncores/, passed--core-cache ~/.cache/flareto spawned ranks, skippednodes[0]verification afterPUT, duplicated RoCE flags intoserving, and passed cached entry directories into--hostsGrant.core.Command::AgentandAgentCommand::Installaccept--core-cache(aliases--model-cache,--package-cache) and apply[paths].core_cache(default~/.cache/flare/coresforserve;installpropagates[paths].core_cacheand top-levelflare agent --core-cachewith subcommand precedence and systemd-quotes--core-cacheinExecStart=). In-flightPUT/TRANSFERfiles assemble under<core-cache>/staging/orbit/cores/on the same filesystem without ever callingcore_cache::evicton published core caches (core_cache::evictalso skipshelios::core::cache::ROOT_DIRECTORIESas defense-in-depth). Abandoned unleased entries understaging/orbit/cores/(and unreachablestaging/orbit/blobs/hardlinks) are reclaimed on agent startup, after corePUT/TRANSFER, and byhelios::core::cache::Root::collect(), while livePUT->TRANSFERsessions,FETCH, and staging-backedRUNhold sharedflockleases on the staged directory. Verified transfers—includingnodes[0]after controller-localPUTuploads—commit intohelios::core::cache::Root(models/<model>/<entry>/), write.verifiedand filename-sorted.flare-verified.jsonmarkers (propagating write failures and rolling back unpublished entries), and publishorbit:<dir>,<export>-rank<R>, and<export>-completesource refs discovered bydistribution::receive_rank,Agent::cores(), and placement.distribution::verified_marker_matchesmatches marker files by filename instead of position.agent::runpasses--core-cache <agent.core_cache>, holdsflockEntryleases on active local cores for the lifetime of theGroup, and skipscache::entryvalidation on peers (local_core == false). RoCE shape flags are stripped fromservingand emitted once fromGrant.roce_ring/Grant.roce_chain.--hostsresolvesmodel.safetensorsinside cached directories and inferstensor_parallel = hosts.len() + 1. Updateddocs/orbit.mdto document the unified layout, staging reclamation, and manual cleanup of legacy flat directories.GB10 page-cache eviction, KV/host sizing, Selene intake cap, and metadata-only guard (
helios/src/runtime_core/{protection,memory,mod,model}.rs,selene/src/offload.rs,selene/src/offload/tests.rs,docs/prefix-cache-offload.md):PayloadSource::release_page_cache()was an empty no-op;NativeModel::allocate_cacheschargedinput_windowin bothoffload_hostandhost_future;target_intake_slotsandsized_concurrencycapped integrated-GPU intake only whendisk_only; and metadata-onlyAuthorizedCorevalues were accepted by GPU loaders.PayloadSource::release_page_cache()callscrate::os::release_page_cache(POSIX_FADV_DONTNEEDon Unix) once per deduplicatedArc<File>acrossprimaryand all opened payload containers.NativeModel::allocate_cachescomputeshost_futureviaplanned_host_futuresoinput_windowis charged once whether offload is enabled or disabled.target_intake_slotsandsized_concurrencybound all integrated-GPU local offload tiers (memory_bytes == 0or> 0) tointake_slots(layout, 1)(updateddocs/prefix-cache-offload.md).AuthorizedCoretracksloadable: boolandNativeResources::load,NativeModel::load_agreeing, andPayloadAuthorizedCore::loadreject metadata-only authorizations before touching CUDA.flare-agenthardening and stray LAN probe handling (flare-cli/src/orbit/{agent,controller,identity,session,store}.rs,flare-cli/src/{distribution,fabric_transport}.rs):Agent::grant()did not check expiry;serve_on()had no session limits;Session::acceptread 44 bytes before validating magic and cleared timeouts before authorization; secret files were written beforechmod 0600; the reaper blockedfinish()on forwarder joins with noPR_SET_PDEATHSIGor process-group isolation;stop_grouplooped unboundedly waiting on rank zero; and stray LAN probes aborted rendezvous and fabric relay listeners.Agent::grant()enforcesgrant.current(now())acrossTRANSFER,FETCH,FETCH_FABRIC, andRUN.serve_on()bounds concurrent sessions (1152) and pre-auth sessions (1024, accommodating 16-rank × 64-stream bursts) and logs shed connections;Session::acceptvalidates the 8-byteFLAREFLTmagic before reading the remaining handshake bytes and keeps read/write timeouts armed until peer authorization.atomic_write_privatecreates node/controller keys,controllers.toml,join-code,accept-first, andorbit.tomlwithO_CREAT | O_EXCLmode0600,fsync, and atomicrename. Rank processes spawn in isolated process groups (setpgid(0, 0)) with LinuxPR_SET_PDEATHSIG(SIGTERM)and parent-PID verification; on Linux, the reaper waits without reaping viawaitid(P_PID, ..., WEXITED | WNOWAIT)and then setsexitedand callschild.wait()underGroup::reap, whichagent::stopalso holds while signaling-group.pidsokill()cannot target a reused PID; forwarder drain is bounded to2sandfinished.finish(code)always runs to release GPUs and leases;Controller::stop_groupcaps rank-zero drain wait at120s;distribution::rootdrops malformed TCP probes while failing fast on valid version- or rank-mismatchJoinframes; andfabric_transport::servedrops stray LAN probes without leaking relay worker slots.Consolidated NVML
OnceLockloader and ordinal fix (helios/src/{nvml,lib}.rs,helios/src/runtime_core/device_memory.rs,flare/src/hardware.rs,heliopause/src/export/capture.rs,flare-cli/src/{doctor.rs,orbit/gpu.rs}):nvmlInit_v2/nvmlShutdown, andassign_visibility()compared numericCUDA_VISIBLE_DEVICESentries to slice index.flare_helios::nvml::Nvmlloaded once per process viaOnceLock(libnvidia-ml.so.1on Unix,nvml.dllwithLOAD_LIBRARY_SEARCH_SYSTEM32on Windows, never callingnvmlShutdown), migrated all 7 sites with zeroCargo.toml/Cargo.lockchanges, and fixedassign_visibility()to match numeric entries againstdevice.ordinal.Claimed benefit
flare download's default model store in~/.cache/flare/packages#119), eliminates duplicate peer rank staging betweenorbit pushandorbit run(Store Orbit rank files in the shared model cache #361, orbit run ignores --core-cache and paths.core_cache for rank-core staging: peer rank cores duplicated into ~/.cache/flare/cores on the controller host #629), reclaims abandoned staging directories via both agent lifecycle hooks andflare models gc, marksnodes[0].verifiedafterorbit push, fixes persistent-group RoCE shape overrides and--hostscached/multi-deployment launches, and hardensflare-agentagainst expired-grant replay, pre-auth thread exhaustion, secret-creation races, PID-reuse signals, leaked-stdio reaper deadlocks, and stray LAN probes.input_window, and caps local-tier offload intake whenmemory_bytes > 0(GB10 unified memory: KV budget and cuCtxCreate respond to page-cache-polluted MemFree, not MemAvailable — same core+reserve gives 2.08M vs 3.43M KV tokens and spurious CUDA_ERROR_OUT_OF_MEMORY #630).HardwareMonitorand fixes numericCUDA_VISIBLE_DEVICESmatching when non-CUDA accelerators are skipped.Supporting evidence and limitations
All Rust crate test suites ran with
--locked --releaseon Linux x86_64:eos(cargo test --locked --release --manifest-path eos/Cargo.toml --target-dir flare-cli/target): 2 passed, 0 failed.selene(cargo test --locked --release --manifest-path selene/Cargo.toml --features test-support --target-dir flare-cli/target): 548 unit + 1 integration passed, 0 failed (updated integrated-GPUmemory_bytes > 0intake tests inselene/src/offload/tests.rs).selene-manager(cargo test --locked --release --manifest-path selene-manager/Cargo.toml --features test-support --target-dir flare-cli/target): all passed, 0 failed.helios(cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --target-dir flare-cli/target -- core:: runtime_core:: nvml): 505 passed, 0 failed, 12 ignored (GPU/checkpoint-gated), includingauthorize_metadata_is_not_loadable,payload_source_release_page_cache_deduplicates_unique_files,planned_host_future_counts_input_window_once,collect_reclaims_unleased_orbit_staging_and_preserves_leased, and updatedintegrated_offload_host_budget_matches_small_soc_scaling_and_explicit_limits.flare(cargo test --locked --release --manifest-path flare/Cargo.toml --target-dir flare-cli/target): 238 unit + 8 integration tests passed (0 failed, 4 ignored), includinggpu_inventory_visibility_matches_nvml_ordinal_when_non_cuda_devices_skipped.flare-cli(cargo test --locked --release --manifest-path flare-cli/Cargo.toml): 212 unit tests passed (0 failed, 3 ignored) and 26 integration tests passed (cache_commands9,cli6,inspect4,unverified_payload7), including new tests for#119managed-cache eviction protection,#361/#629sharedRootrank refs, abandoned staging reclamation (init_core_cache,PUT, andRoot::collect()), multi-file.flare-verified.jsonorder-independent matching,nodes[0].verifiedafterorbit push, expired-grant rejection acrossTRANSFER/FETCH/FETCH_FABRIC/RUN, RoCE flag deduplication,Command::Agent/AgentCommand::Install--core-cacheand[paths].core_cacheprecedence + systemdExecStart=quoting, atomic0600secret creation, immediate short-probe rejection inSession::accept, stray LAN probe tolerance onfabric_transport::serve, and reaper completion when a grandchild holds stdout/stderr open.heliopause(cargo test --locked --release --manifest-path heliopause/Cargo.toml --target-dir flare-cli/target): 216 passed, 0 failed, 6 ignored (CUDA).Unrun checks / limitations: Live GB10 KV token capacity measurement after
PayloadSource::release_page_cache(), live 4-Sparkorbit push+orbit runmulti-host verification, Windowsnvml.dllcompilation, andFLARE_TEST_TEMPLATE_DIRchat-template tests were not run in this CPU-only Linux environment.Discord: lukealonso