Repository navigation
fix(#1801): keep each checkout's isolated build in its own target/ - #1825
Merged
Merged
Conversation
checkout_target_dir.sh moved an outside CARGO_TARGET_DIR to <dir>/checkouts/<id>. Those 5-22 GB builds outlived their worktrees: nine of them filled ~160 GB in a day, three for deleted worktrees. The helper now points it at the checkout's git-ignored target/, so the build is removed with the checkout and is still never shared between checkouts. Co-Authored-By: Claude Opus 5.5 <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.
Follow-up to #1801 (fixed in #1803).
Summary
#1803 gave each checkout its own Cargo target directory when
CARGO_TARGET_DIRpoints outside it, so local checks never run binaries another checkout built. It put that directory at${CARGO_TARGET_DIR}/checkouts/<id>, which nothing ever removes. Each one is a full build of 5–22 GB (debug, release,llvm-cov-target, iOS and wasm targets). Claude Code sessions create many short-lived worktrees, so these folders pile up. On 2026-11-05/06, nine of them filled about 160 GB of disk in roughly 24 hours, and three belonged to worktrees that no longer existed.checkout_target_dir.shnow points an outsideCARGO_TARGET_DIRat<checkout root>/targetinstead. That folder is git-ignored (target/in.gitignore), and deleting the worktree deletes it too.CARGO_TARGET_DIRthat is unset stays unset, so Cargo usestarget/as before.What this costs: a checkout no longer keeps its build under the developer's chosen shared location. That folder was never shared between checkouts anyway, so builds are no less incremental than before.
Governing Spec
Project Item
Validation
scripts/ci/checkout_target_dir_test.shnow asserts that each checkout resolves to its owntarget/and that one checkout'starget/is never used by another. It fails against the previous helper (.../shared/checkouts/9c89c4bf1b954c13).CARGO_TARGET_DIR=~/.cargo-target-shared, the helper resolves to<worktree>/target, and sourcing it again gives the same path.scripts/ci/repository_checks.shpasses.local_preflight.sh --pr-bodypassed with the sharedCARGO_TARGET_DIRset. The build (19 GB) went into this worktree'starget/. The script skipped native artifact certification because this machine lacks Java, .NET and the Android SDK, and it always skips the hosted-only CodeQL and stress jobs.🤖 Generated with Claude Code