fix(disk-monitor): stop the disk check from purging live build workspaces #1
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/disk-monitor-safe-cleanup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The
forgejo-runner-disk-monitorunit runsforgejo-runner cache clean --disk-check-only, whose "disk critical" branch (patches/forgejo-runner-fork.patch) purges the entire~/.cache. On a host-executor runner that deletes the active act job workspace mid-build — the checkout/CWD,CARGO_HOME(registry crate sources), and git worktrees — so long compiles fail withcould not parse/generate dep info … No such file or directoryandfailed to stat working directory …/hostexecutor.Observed on a macOS host runner: a ~10-min Rust build was killed when the 5-min disk-monitor read 85% and logged
Disk usage 85% is critical - clearing entire cache→Purged /Users/…/.cache (1.6 GB freed)at minute ~6.Fix (Linux)
Point the disk-monitor at the same safe orchestrator the daily cleanup service already uses —
forgejo-runner-cleanup --once: age-guarded cache (>CACHE_MAX_AGE_DAYS) and workspace (>WORKSPACE_MAX_AGE_DAYS, skips currently-running jobs) pruning plus threshold-based docker cleanup. No entire-cache purge. Unit timeout raised for the scan.macOS (separate follow-up)
scripts/install-macos.shgenerates an equivalent disk-monitor plist with the same destructive command. The mac cleanup path differs (inlinebash -cdaemon incom.forgejo.runner.cleanup.plist; noforgejo-runner-cleanupbinary is shipped), so it needs its own change. The one live mac runner has been remediated directly in the meantime (disk-monitor repointed to an age-guarded pruner;~/.cache/actrestored to the external-volume symlink).Root source (separate follow-up)
The destructive escalation itself lives in
patches/forgejo-runner-fork.patch("… is critical - clearing entire cache"→Purged %s). Making that branch age-guarded would fix every invoker, but the fork build is currently red (patches don't apply cleanly to upstream v12.13.x), so this unit-level change is what protects the deployed fleet now.set -eabort the cycle on a benign no-op