[Android] Backport action cache cleanup fix from Bazel 9 - #41
Merged
azad-uber-2 merged 1 commit intoJul 2, 2026
Merged
Conversation
Backport of the fix for bazelbuild#26818 which causes Bazel 8 to corrupt the output base for Bazel 7 when alternating between versions on the same workspace. The fix deletes unrecognized files from the action cache on-disk directory when loading it into memory. This prevents spurious cache hits for stale runfiles trees when the runfiles output manifest (a symlink to the input manifest) appears valid but the underlying tree was updated by an intervening build with a different Bazel version. Original fix: bazelbuild#27525 Original commit: 912099e Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jbarr21
approved these changes
Jul 2, 2026
azad-uber-2
added a commit
that referenced
this pull request
Jul 9, 2026
Backport of the fix for bazelbuild#26818 which causes Bazel 8 to corrupt the output base for Bazel 7 when alternating between versions on the same workspace. The fix deletes unrecognized files from the action cache on-disk directory when loading it into memory. This prevents spurious cache hits for stale runfiles trees when the runfiles output manifest (a symlink to the input manifest) appears valid but the underlying tree was updated by an intervening build with a different Bazel version. Original fix: bazelbuild#27525 Original commit: 912099e Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
azad-uber-2
added a commit
that referenced
this pull request
Jul 16, 2026
The deleteUnrecognizedFiles method (backported from Bazel 9 in #41) calls cacheRoot.getDirectoryEntries() without checking if the action_cache directory exists. On a cold cache (fresh output base), the directory hasn't been created yet, causing an IOException: 'No such file or directory'. Bazel 7 doesn't have this issue because it lacks deleteUnrecognizedFiles. The fix adds an existence check at the top of the method, returning early if the directory doesn't exist yet (there are no files to clean up anyway).
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.
Backport of the fix for bazelbuild#26818 which causes Bazel 8 to corrupt the output base for Bazel 7 when alternating between versions on the same workspace.
The fix deletes unrecognized files from the action cache on-disk directory when loading it into memory. This prevents spurious cache hits for stale runfiles trees when the runfiles output manifest (a symlink to the input manifest) appears valid but the underlying tree was updated by an intervening build with a different Bazel version.
Original fix: bazelbuild#27525
Original commit: 912099e