Repository navigation
Collect what superseded releases leave on a host - #404
Merged
Merged
Conversation
Compute a keep set across all instances (current, prepared, previous, newest failed, unresolved operations) and remove asset trees, exited job containers and images outside it, by exact name or ID and never with a prune. Expose it as komizo-box gc with a dry run, run it once from the capacity gate before staging is refused, and run it after a ready deploy. Collection holds the staging lock and refuses live operations, and its failure is journalled without failing a deploy. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
CI requires the README to match its private publication source, so the gc usage note is withheld from this change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
Why
Komizo never removed what superseded releases left on a host: extracted asset trees, Podman images (referenced only by image ID, all untagged) and exited job containers. A host eventually filled and the capacity gate refused deploys with
staging_failed: disk reserve refuses artifact staging.What
src/deployment/retention.rscomputes a keep set across every installed instance and application: each instance's current release, a prepared (stopped) release, its previous release (most recent earlier successful deploy with a different release), its newest failed deploy, and any release named by a non-terminal or unresolved operation. Removed-instance tombstones contribute nothing physical; their records stay./var/lib/komizo-assets/<64 lowercase hex>only, renamed to a same-filesystem trash name and then removed; leftover trash is cleaned next run), exited job containers of releases outside the keep set (through a newjobs::remove_finishedthat reuses the existing ownership proof, cgroup retirement and non-forcedrm), and images that no kept release references and no container uses, by exact ID. Only images some stored release document names are candidates. No Podmanprune, no volumes, no running containers, neverassets/<hex>.jsonorreleases/<hex>.json.komizo-box gc [--dry-run]prints one JSON report (keep set with reasons, items, bytes, errors).stage()runs collection once when the disk check refuses, then measures again before returningstaging_failed.ready, collection runs under a 120 second budget.Locking
stage()now holds a host-wide staging lock (platform--retention) for its whole run.collectrequires aLeaseon that lock, so the owner command cannot run while anything is staging, and the gate path (which already holds it) and the post-deploy path (which takes it withtry_lease) never racestage(). Collection also refuses while another operation is live. The owner command accepts none. Inside the single effect worker only operations merely queued (admitted, their releases already kept) are allowed.Failure handling
Per-item failures are reported and do not stop collection. Gate and post-deploy runs write
journal/<op>/retention-<stage>.json(collected, partial or refused) and never change the deploy's result.Docs
The README is checked against a reviewed publication source, so the
komizo-box gcusage note is not part of this PR and needs that source updated first.Tests
Unit tests for the keep set (current, previous, redeploys and non-deploy operations, unresolved, shared digests, tombstones, prepared), name validation and trash cleanup, kept releases never removed per class, refusal while live or locked, dry run, and the job container proof. Full suite runs in CI.
Not covered locally: the real Podman JSON field names (
Id,Size,ImageID) andpodman image rm, which need a host.🤖 Generated with Claude Code