pub async fn fold_due(
runs: &Path,
home: &Path,
_worktrees_root: &Path,
disk: &Disk,
now: Timestamp,
) -> Result<usize>Expand description
Fold every run that is finished, older than the grace period, and not being worked on; count them.
A run that magi can no longer read — a state file from another schema, a
half-written run.json — is left exactly as it is. Automatic housekeeping
cannot tell a mid-write file from one that will never parse again, and
<home>/runs/<id>/ is the evidence magi stats and the deck read; when
unsure whether it is safe to touch, the janitor keeps rather than deletes
(see the module docs). Discarding a record this unreadable is an explicit
operator action (magi fold, or the equivalent phone route), never
something that happens unattended.
Runnable statuses and runs newer than the grace period are also left
alone; folding them would throw away work that is still the answer to
somebody’s question. Merged runs forget their winner’s worktree (the
merge already landed it); Ready and Failed runs keep it.