Add agent disk cleanup defaults#108
Merged
Merged
Conversation
techulus-agent
commented
Jul 7, 2026
techulus-agent
left a comment
Collaborator
Author
There was a problem hiding this comment.
Review — Add agent disk cleanup defaults
Reviewed against main. Solid, well-tested change. Ran the agent Go tests (internal/build, internal/agent) and the web suite — all pass.
Verified / liked
tempArtifactPathcorrectly confines archives to<dataDir>/tmpand rejects any non-base name (name != filepath.Base(name)), which blocks../traversal — nicely covered byTestTempArtifactPathRejectsNestedNames.- Agent
DataDirand BuilderdataDirare the same path (both wired fromdataDirincmd/agent/main.go), so archives written underDataDir/tmpare exactly whatcleanupManagedTempArtifactsscans underb.dataDir/tmp. The producer/consumer paths line up. Cleanup()now aggregates failures viaerrors.JoinandImagePrunesurfaces podman errors instead of swallowing them — good observability upgrade.os.IsNotExistis tolerated in both scanners, so a missing dir is a clean no-op.- Startup
go a.RunBuildCleanup()is safe alongside the hourly ticker: the build-dir cutoff is 1h and temp-artifact cutoff is 24h, so in-flight builds/backups won't be reaped, andpodman image prune --filter until=168hwon't touch freshly-pulled base images. - setup.sh changes are sensible (journald caps, Traefik logrotate with
copytruncate, BuildKit GC policies).bash -nstyle guards (erroron missing config) are in place.
Non-blocking notes
- Stacked on #107 — this PR's diff includes
web/lib/agent/expected-state.tsandweb/tests/expected-state.test.ts, i.e. the certificate-domains change from #107. Worth being intentional about merge order: merge #107 first and this diff shrinks cleanly; merge this first and #107 becomes a near-empty PR. Not a correctness issue, just a heads-up so the history stays tidy. managedTempArtifactPatternassumes a 36-char UUID backup ID ([0-9a-fA-F-]{36}). If a backup/restore ID is ever a different shape, its temp archive won't match the pattern and won't be reaped by the sweeper (the per-opdefer os.Removestill handles the happy path; this only affects orphaned leftovers from a crash). Minor, and safely conservative in the other direction — just flagging in case ID formats change later.
Result: No blocking issues. LGTM 👍
abd0831 to
a277a48
Compare
a277a48 to
a3e9d74
Compare
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.
Summary
Adds the first disk-cleanup slice for agent nodes:
Notes
Registry manifest retention and safe registry GC are intentionally left for a separate change because reclaiming registry bytes needs manifest deletion plus a controlled GC window.
Validation