fix(updater): prune stale build workspaces - #1410
Open
Fr4nzz wants to merge 1 commit into
Open
Conversation
ilysenko
requested changes
Aug 29, 2026
ilysenko
left a comment
Owner
There was a problem hiding this comment.
Thanks for restoring stale updater workspace pruning. I found three blockers:
- Please serialize workspace pruning with every updater entrypoint that can build, install, or roll back, and reload authoritative persisted state inside that boundary. Otherwise stale in-memory state can recursively delete another process's active workspace. Add a deterministic interleaving regression test.
- Please prune the configured
workspace_root/workspaces, not onlycache_dir/workspaces, and cover distinct package-cache and workspace roots in the test. - Please reject or safely skip a symlinked
workspacesroot. The currentis_dir/read_dirflow follows it and can recursively delete directories outside the updater-managed cache. Add a root-symlink regression test.
Finally, please run the complete updated base-to-head diff through your own code-review model, fix every blocker it finds, rerun the review, and repeat until that model reports no remaining blockers before requesting maintainer re-review.
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.
Problem
The update manager's cache cleanup only scans
packages/for obsolete.debfiles. It never scansworkspaces/, so each completed or failed rebuild can leave a full build workspace behind indefinitely. On an actively updated installation this accumulated 7.6 GB of unreferenced build data.Solution
Extend cache pruning to remove unreferenced directories under
workspaces/while preserving:Directory entries are checked with
DirEntry::file_type, so symlinked directories are not traversed or removed as workspaces.User-visible behavior
Routine updater cleanup now reclaims stale build workspaces instead of allowing them to accumulate across updates. Current candidate and rollback artifacts remain available.
Scope
This changes the Rust update manager and applies across package formats and architectures that use it. It does not change the signed upstream package, package building, promotion, or rollback behavior.
Validation
cargo test -p codex-update-manager(51 passed)cargo clippy -p codex-update-manager --all-targets -- -D warningsgit diff --checkThe regression test verifies that cleanup removes a stale package and stale workspace, retains the current package and workspace, retains the rollback workspace, and does not follow a workspace symlink.