Repository navigation
Repair runfiles trees with entries deleted out-of-band - #47
Merged
Merged
Conversation
Cherry-pick of 9e03337 (azad/repair-runfiles-trees-8.1.1). 8.1.1 is the default Bazel, so the primary fix lives there. If a symlink inside a runfiles tree built by a SymlinkTreeAction is deleted from disk (e.g. by a CI disk cleaner), Bazel never restores it: the output MANIFEST is the action's only output, so the action keeps hitting the action cache. Spawns reading the missing entry then fail, e.g. the Kotlin builder worker can't start ("... kotlin_build_tools_impl/ file/downloaded does not exist in the runfiles!"). Example: https://buildkite.com/uber/android-code-differential-bazel8/builds/6501#01a10fd3-bd05-4654-a91b-7aa51e5cbc41 Fix: before a local or worker spawn uses a runfiles tree, check once per command that every entry exists, and resync the tree if any are missing. Testing on 8.8.0: - Reproduced the failure: deleted the kotlin_build_tools_impl symlink from the Kotlin builder's runfiles tree in an Android output base and built cold with BAZEL_LATEST=1 --config=buildkite on stock 8.8.0 (4375ec8). The build failed with the error above. - Tested the fix: built the same damaged tree cold with the fixed binary. It logged "Runfiles tree ... is missing entries, recreating it." and the build passed. - RunfilesTreeUpdaterTest: 2 of 3 fail without the fix; 3/3 pass with it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ckilian867
approved these changes
Oct 6, 2026
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.
Cherry-pick of 9e03337 from #46 (8.1.1). 8.1.1 is
the default Bazel, so the primary fix lives there.
If a symlink inside a runfiles tree built by a SymlinkTreeAction is
deleted from disk (e.g. by a CI disk cleaner), Bazel never restores it:
the output MANIFEST is the action's only output, so the action keeps
hitting the action cache. Spawns reading the missing entry then fail,
e.g. the Kotlin builder worker can't start ("... kotlin_build_tools_impl/
file/downloaded does not exist in the runfiles!"). Example:
https://buildkite.com/uber/android-code-differential-bazel8/builds/6501#01a10fd3-bd05-4654-a91b-7aa51e5cbc41
Fix: before a local or worker spawn uses a runfiles tree, check once per
command that every entry exists, and resync the tree if any are missing.
Testing on 8.8.0:
from the Kotlin builder's runfiles tree in an Android output base and
built cold with BAZEL_LATEST=1 --config=buildkite on stock 8.8.0
(4375ec8). The build failed with the error above.
It logged "Runfiles tree ... is missing entries, recreating it." and
the build passed.
🤖 Generated with Claude Code