Repository navigation
build-gc: age out unused FFmpeg cache keys from --auto under disk pressure - #1336
Merged
Merged
Conversation
…ressure `--auto` never touched the shared FFmpeg cache, so keys stranded by a version bump or an NDK upgrade (each ~100+ MB) stayed until someone ran `--cache` by hand, which only collects keys unused for 30 days and also prunes the cargo seed. Below the comfort line, after the idle-lane `--worktrees` stage and before the planner pass, `--auto` now runs a new `--ffmpeg-cache` mode with PLX_CACHE_MAX_DAYS set to PLX_GC_AUTO_CACHE_DAYS (default 7; non-numeric falls back to 7). `--ffmpeg-cache` is the FFmpeg half of `--cache` split into its own case: same per-key lock, same refusal for a held FFmpeg cache lock, same `.last-used` marker, tarballs and `.tombstone.` handling unchanged. The cargo seed stays out of it; `--cache` and `--all` still run both halves. Above the comfort line no key is touched, and `--auto -n` previews the age-out. Tests: old/new keys under pressure, the env var, a held lock keeping its key, a 40-day cargo seed surviving `--auto`, nothing touched above the line, the dry run, and `--ffmpeg-cache` by hand. The two existing assertions that `--auto` leaves a 40-day-old key now say the opposite. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`find -mtime +N` counts whole days and truncates the age, so it matched only keys unused for N+1 days or more while the help text, the docs and the `--auto` stage name all say "unused for N days". `stale_cache_trees` now uses `-mmin +$((N * 1440))`, which makes `--auto` (7 days) and manual `--cache` / `--ffmpeg-cache` (30 days) exact. A threshold that is not a number still selects nothing (the old `find` error was silenced); `$((abc * 1440))` would have read as 0 and selected every key, so it is checked before the arithmetic. Tests: a key at 7.5 days is aged out by `--auto` and one at 6.5 days is kept; the same half-day either side of 30 for `--ffmpeg-cache`; a non-numeric PLX_CACHE_MAX_DAYS removes nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What
tools/build-gc.sh --autonow ages out FFmpeg cache keys that have not been used forPLX_GC_AUTO_CACHE_DAYSdays (default 7). It does this only when free space is below the comfort line, as a stage between the worktrees pass and the planner pass. Before this change,--autonever pruned the FFmpeg cache; only the manual--cachedid, at 30 days.--ffmpeg-cache: the FFmpeg half of--cache, without the cargo-seed prune.--autouses it, so the seed is never touched by--auto. A test pins that.--cacheand--allmodes still prune both the FFmpeg keys and the seed, as before.find -mmin), so a key goes once it is more than N×24 h old. The old-mtime +Ncheck kept keys up to a day longer.--cachedoes. The next hourly run of--autotries again.Why
The internal SSD keeps running out of space while several worktrees build. On 2026-11-11, 11 of the 15 FFmpeg cache keys had not been used for more than 7 days, about 1.4 GiB. Each key belongs to a superseded FFmpeg version, flag set or toolchain.
This is the first, independent step of the disk plan. The plan's later steps (parking idle build folders on the external disk) depend on a measurement that is still running.
Verification
ci/test_build_gc.py: Ran 66 tests, OK. The tests cover:-npreview;PLX_GC_AUTO_CACHE_DAYSvalue.ci/test_disk_budget.py: Ran 97 tests, OK.ci/test_ci_split.py: Ran 16 tests, OK.sh -n tools/build-gc.sh: clean.ci/build-ffmpeg.sh.🤖 Generated with Claude Code