Repository navigation
Leave the sealed system volume to the OS build instead of watching it - #3
Merged
Merged
Conversation
Bazel reads every watched file in full when a new server first checks a repository's recorded inputs. On macOS the search path is mostly /bin and /usr/bin, so that check read every system tool: on one CI host the watches covered 1,214 files and 277 MiB, and the first build after a boot spent 33.5 s on the check without running the rule. Those files sit on the sealed system volume, which changes only with the OS build the key already records and watches. An entry whose resolution stays on that volume throughout now contributes its name, mode and link target but not its content, and neither it nor a listing on the volume is watched. An entry that passes through a link or a directory anywhere else stays watched and digested, even when it ends on the volume, because that part can change without an OS update. On the same host the watches drop to 255 files and 2.4 MiB. On a warm macOS host, a new server's check of the repository went from 0.24-0.76 s to 0.02-0.03 s. Linux keys are unchanged; every macOS host's key changes once.
This was referenced Oct 13, 2026
Merged
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.
Bazel reads every watched file in full when a new server first checks a
repository's recorded inputs (
RepoRecordedInput.Filedigests the file'scontent). On macOS the search path is mostly
/binand/usr/bin, so thatcheck read every system tool. On one CI host the watches covered 1,214 files
and 277 MiB, and the first build after a boot spent 33.5 s on the check
without running the rule.
Those files sit on the sealed system volume, which changes only with the OS
build the key already records (
sw_vers) and watches (SystemVersion.plist).Change
directory it passes, every link it follows, and the file it reaches)
contributes its name, mode and link target, not its content, and is not
watched. A search path directory on the volume is not listed-watched.
digested and watched, even when it ends on the volume, because that part can
change without an OS update.
safaridriver, which links into the Appcryptex, is one such entry and stays watched.
statvfs().f_fsidofSystemVersion.plist.st_devcannot tell the volumes apart on APFS: it reports the same devicefor
/usr/binand/usr/local.volume, and what "When the key changes" watches and why.
Linux takes the same path as before, so Linux keys are unchanged. Every macOS
host's key changes once.
SCHEMAstays as it is, because the changedidentities cannot collide with old ones. The module version is not bumped
here, so one release can carry this and #2. The two merge cleanly.
Verification
the real system volume:
/binyields no watches, a same-directory link in/usr/binis not watched, a scratch link to/bin/shstays watched, and apath through a scratch directory link to
/binis not covered. Each of threemutations fails at least one of them: never matching the volume, dropping the
per-directory check, and the simpler walk that checks only each link's
resolved parent.
tests/check_platform.pypasses on macOS 26.7 (arm64). Changed tools andbottles still re-execute in a running server, and fresh output bases still
hit the disk cache.
--strictpass.(277.2 MiB) and 131 listings, down to 255 files (2.4 MiB) and 129 listings.
Key computation on a warm cache went from 3.2-4.8 s to 0.7-0.8 s.
warm page cache:
@host_cache_keytook 0.24-0.76 s before and 0.02-0.03 safter, with the rule never running. Its marker went from 1,229
FILEentriesto 270.
Not measured: the cold case, the first build after a boot. Here it is bounded
by reading 2.4 MiB instead of 277 MiB.