The dagger-data Docker volume accumulates because Dagger maintains two kinds of cache:
Execution-cache snapshots — results of WithExec() steps (pub get, build_runner, flutter build, etc.). These are already pruned by the existing prune calls because they become unreferenced after a build completes.
Named cache volumes — gradle-cache, go-build-cache, go-mod-cache, pip-cache created via dag.CacheVolume(). The plain prune (no arguments) only removes unreferenced entries and never touches named volumes, so they grow without bound across CI runs.
Fix
The Dagger localCache.prune API accepts maxUsedSpace and targetSpace arguments (discovered in the generated dagger.gen.go). When maxUsedSpace is set, Dagger will also reclaim named cache volumes if the total exceeds the threshold.
CI prune steps (before and after check): prune(maxUsedSpace: "75gb", targetSpace: "50gb") — only reclaims named volumes when the total exceeds 75 GB, leaving frequently-used caches intact otherwise.
Disk-space emergency recovery in check-dagger: prune(targetSpace: "20gb") — aggressively prunes everything including named volumes when the runner is out of disk space.
New dagger-prune task for manual operator use.
Test plan
CI passes on this branch
task dagger-prune runs without error against a live Dagger engine
After several CI runs, docker volume inspect dagger-data shows size well below 200 GB
## Why the volume grows to 200 GB
The `dagger-data` Docker volume accumulates because Dagger maintains two kinds of cache:
1. **Execution-cache snapshots** — results of `WithExec()` steps (pub get, build_runner, flutter build, etc.). These are already pruned by the existing `prune` calls because they become unreferenced after a build completes.
2. **Named cache volumes** — `gradle-cache`, `go-build-cache`, `go-mod-cache`, `pip-cache` created via `dag.CacheVolume()`. The plain `prune` (no arguments) only removes *unreferenced* entries and never touches named volumes, so they grow without bound across CI runs.
## Fix
The Dagger `localCache.prune` API accepts `maxUsedSpace` and `targetSpace` arguments (discovered in the generated `dagger.gen.go`). When `maxUsedSpace` is set, Dagger will also reclaim named cache volumes if the total exceeds the threshold.
- **CI prune steps** (before and after check): `prune(maxUsedSpace: "75gb", targetSpace: "50gb")` — only reclaims named volumes when the total exceeds 75 GB, leaving frequently-used caches intact otherwise.
- **Disk-space emergency recovery** in `check-dagger`: `prune(targetSpace: "20gb")` — aggressively prunes everything including named volumes when the runner is out of disk space.
- **New `dagger-prune` task** for manual operator use.
## Test plan
- [ ] CI passes on this branch
- [ ] `task dagger-prune` runs without error against a live Dagger engine
- [ ] After several CI runs, `docker volume inspect dagger-data` shows size well below 200 GB
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Why the volume grows to 200 GB
The
dagger-dataDocker volume accumulates because Dagger maintains two kinds of cache:Execution-cache snapshots — results of
WithExec()steps (pub get, build_runner, flutter build, etc.). These are already pruned by the existingprunecalls because they become unreferenced after a build completes.Named cache volumes —
gradle-cache,go-build-cache,go-mod-cache,pip-cachecreated viadag.CacheVolume(). The plainprune(no arguments) only removes unreferenced entries and never touches named volumes, so they grow without bound across CI runs.Fix
The Dagger
localCache.pruneAPI acceptsmaxUsedSpaceandtargetSpacearguments (discovered in the generateddagger.gen.go). WhenmaxUsedSpaceis set, Dagger will also reclaim named cache volumes if the total exceeds the threshold.prune(maxUsedSpace: "75gb", targetSpace: "50gb")— only reclaims named volumes when the total exceeds 75 GB, leaving frequently-used caches intact otherwise.check-dagger:prune(targetSpace: "20gb")— aggressively prunes everything including named volumes when the runner is out of disk space.dagger-prunetask for manual operator use.Test plan
task dagger-pruneruns without error against a live Dagger enginedocker volume inspect dagger-datashows size well below 200 GB🤖 Generated with Claude Code