atelet: sweep crash-leftover temp files at startup - #685
Draft
Lorenzo Gironi (lorenzo85) wants to merge 3 commits into
Draft
atelet: sweep crash-leftover temp files at startup#685Lorenzo Gironi (lorenzo85) wants to merge 3 commits into
Lorenzo Gironi (lorenzo85) wants to merge 3 commits into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Introduce internal/startupsweep, a generic registry for cleanup tasks that run once at atelet startup before the gRPC server accepts traffic. Any package can register a (label, dir, glob, removeFn) tuple; a single Sweeper.Sweep(ctx) call in main.go removes all matches. Wire up two sources of crash-leftover files: - ategcs: substrate-upload-compress-* staging files in os.TempDir(), created by sendBufferedZstd for S3/rustfs uploads and never deleted if atelet is killed mid-upload. - imagecache: .tmp-* unpack dirs and .rm-* retired layer dirs under layers/sha256/, and dot-prefixed manifest temp files, all orphaned by a crash mid-operation. Fixes agent-substrate#615
Lorenzo Gironi (lorenzo85)
force-pushed
the
fix/startup-sweep-615
branch
from
August 1, 2026 17:24
b966d7a to
48a6f39
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.
Fixes #615
What
Introduces
internal/startupsweep, a small registry for startup cleanup tasks. Packages register a(label, dir, glob, removeFn)tuple;main.goruns a singlesweeper.Sweep(ctx)before the gRPC server starts.Two sources of crash-leftover files are wired up:
substrate-upload-compress-*staging files in/tmp, created bysendBufferedZstdfor S3/rustfs uploads and never removed if atelet is killed mid-upload..tmp-*unpack dirs,.rm-*retired layer dirs, and dot-prefixed manifest temp files left behind by a crash mid-operation.Testing
Unit tests added for
startupsweep:Addremoves matching files correctly.Sweeperdoes not panic.Existing
imagecachetests updated to use the new sweep interface.Validated on a local kind cluster by planting crash-leftover files and confirming the sweep removes them at atelet startup:
/tmp/substrate-upload-compress-crash-test— GCS upload staging filelayers/sha256/.tmp-crash-test— interrupted layer unpacklayers/sha256/.rm-deadbeef-crash-test— retired layer not yet removedmanifests/sha256/.deadbeef.json.tmp-crash-test— interrupted manifest write