pub struct Disk {
pub min_free_bytes: u64,
pub reclaim_free_bytes: Option<u64>,
pub auto_fold: bool,
pub fold_grace_secs: u64,
pub cache_limit_bytes: u64,
pub worktree_limit_bytes: u64,
pub worktree_reclaim_bytes: u64,
pub retained_attempt_limit: usize,
}Expand description
Disk hygiene: how hard magi is allowed to press on the machine’s free space.
The numbers below come from one incident, not from theory: a machine with
951.8 GB free ran a few competitions and plans and best read 6.7 GB free.
Three multi-gigabyte classes of junk accumulated side by side - per-run
worktrees that end as Merged/Ready/Failed, a shared build cache whose
each verify round and each implementation wave recompiles the derived
section of the project into, and the outputs of runs that were removed but
whose folders nobody deleted.
Fields§
§min_free_bytes: u64Free space, in bytes, below which no new run may start: the daemon and
the magi run gate answer with “the disk is full” instead of letting
the graph fill it the rest of the way. 0 turns the gate off.
Default 8 GiB. The incident ran down to 6.7 GB free of 951.8 GB total before anybody noticed; 8 GiB is enough headroom for the compile a fresh competition triggers and small enough that a 1 TB disk with 100 GB free is nowhere near the threshold.
reclaim_free_bytes: Option<u64>Free space, in bytes, below which pressure collection runs: the shared
build cache and retained worktree outputs are collected (within their
own caps, locks and eligibility rules) toward having this much free.
This is the collection threshold;
min_free_bytes stays the admission floor
and nothing here moves a gate. The registered isolated-build pool is
not governed by it: it is collected to its cap and, below the
admission floor, by the deficit against min_free_bytes, as before.
A pass is estimated-deficit collection: it measures free space once, removes that many logical bytes oldest-first and does not re-measure in a loop. Hard links and other writers mean the space actually freed can differ; the next pass measures again and continues. A pass that removes nothing ends without error. While free space is at or above the admission floor and below this threshold, the shared build cache keeps a reserve of half its configured cap, so a disk whose free space other software controls does not empty it on every pass; elsewhere there is no reserve. Retained worktree outputs of finished runs get no reserve.
Unset means twice min_free_bytes. A value below min_free_bytes is
treated as min_free_bytes (collection never aims below the admission
floor; loading such a config logs a warning), so an explicit 0 is not
an off switch: the resolved value decides, and it is 0 (free space
never drives collection) only with min_free_bytes = 0 and this unset
or 0. An explicit positive value collects even with the gate off. The
retained-output sweep keeps its rule that a free-space measurement that
fails counts as pressure, whatever the resolved value. Read it only
through reclaim_threshold.
auto_fold: boolFold finished runs without being asked. Merged, Ready and Failed
runs older than fold_grace_secs have their
worktrees removed. 0 turns the janitor off.
Default true.
fold_grace_secs: u64How old a finished run must be before the janitor folds it, seconds.
Default 6 hours. A run that Ready at 8am is the operator’s answer; a
run that Ready a week ago is worktrees holding a compile each. Six
hours is long enough that nobody loses an answer in the gap between
reading the report and starting from it, and short enough that a backlog
cannot pile up across two nights.
cache_limit_bytes: u64Ceiling for the shared build cache (CARGO_TARGET_DIR in the rendered
verify commands), in bytes. When the janitor runs and the cache is over
it, files are dropped oldest-first until it is not. 0 turns pruning
off - the cache then only ever grows, which is the operator’s call.
Default 10 GiB. This is what the incident measured: 30.61 GB sat in the shared cache on top of ~16 GB in the primary target directory and 6.7- 11.15 GB in each of four per-worktree targets. 10 GiB holds a healthy stack of prebuilt dependencies (cargo’s per-file fingerprinting means pruning only costs the rebuild of the dropped files, not of the world) without letting one addled cache swallow the machine.
worktree_limit_bytes: u64Aggregate retained worktree Cargo output cap; 0 disables reclamation.
worktree_reclaim_bytes: u64Declared artifact byte budget per pass; 0 disables reclamation. The first deletion target may exceed a positive budget to ensure progress, increasing deletion volume and pass duration; no later target may exceed it.
retained_attempt_limit: usizeMaximum unretired attempts of one task before another run may be created. Resumes do not create worktrees and remain allowed. Automatic releases and upstream changes never reset this bound; 0 disables it.
Implementations§
Source§impl Disk
impl Disk
Sourcepub fn reclaim_threshold(&self) -> u64
pub fn reclaim_threshold(&self) -> u64
The free-space level pressure collection works toward: the one reader
of reclaim_free_bytes. Never below
min_free_bytes; twice it when unset (saturating, so a test’s
u64::MAX floor stays u64::MAX). 0 (only possible with
min_free_bytes = 0) means free space never drives collection.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Disk
impl<'de> Deserialize<'de> for Disk
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Disk
Auto Trait Implementations§
impl Forget for Disk
impl Freeze for Disk
impl Move for Disk
impl RefUnwindSafe for Disk
impl Send for Disk
impl Sync for Disk
impl Unpin for Disk
impl UnsafeUnpin for Disk
impl UnwindSafe for Disk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more