Skip to content

Use FileArtifactValue#setContentsProxy for remote repo contents cache#28654

Open
fmeum wants to merge 1 commit intobazelbuild:masterfrom
fmeum:file-contents-proxy
Open

Use FileArtifactValue#setContentsProxy for remote repo contents cache#28654
fmeum wants to merge 1 commit intobazelbuild:masterfrom
fmeum:file-contents-proxy

Conversation

@fmeum
Copy link
Collaborator

@fmeum fmeum commented Feb 12, 2026

Even though expiration times don't matter in Bazel (they aren't honored), supporting the contents proxy optimization avoids Skyframe invalidation when external repo files are materialized later.

Along the way ensure that the persistent action cache always recreates remote metadata via FileArtifactValue.createForRemoteFileWithMaterializationData. Before this change, such metadata would roundtrip into a RemoteFileArtifactValue (without the content proxy optimization) if expirationTime is set to null.

@fmeum fmeum requested a review from a team as a code owner February 12, 2026 13:58
@fmeum
Copy link
Collaborator Author

fmeum commented Feb 12, 2026

@bazel-io fork 9.1.0

@github-actions github-actions bot added team-Performance Issues for Performance teams team-Remote-Exec Issues and PRs for the Execution (Remote) team awaiting-review PR is awaiting review from an assigned reviewer labels Feb 12, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the remote external repository caching to use FileArtifactValue.createForRemoteFileWithMaterializationData. This enables the FileContentsProxy optimization, which helps avoid unnecessary Skyframe invalidations when remote repository files are materialized locally. The changes involve plumbing the remoteCacheTtl from RemoteOptions to where the FileArtifactValue is created.

While the overall change is good, I found a critical issue in how the cache TTL is handled. A TTL of 0, which should mean 'no limit', is incorrectly treated as an immediate expiration, which could lead to performance degradation or incorrect behavior. I've provided a suggestion to fix this.

@fmeum fmeum marked this pull request as draft February 12, 2026 15:30
…he files

Even though expiration times don't matter in Bazel (they aren't honored), supporting the contents proxy optimization avoids Skyframe invalidation when external repo files are materialized later.

Along the way ensure that the persistent action cache always recreates remote metadata via `FileArtifactValue.createForRemoteFileWithMaterializationData`. Before this change, such metadata would roundtrip into a `RemoteFileArtifactValue` (without the content proxy optimization) if `expirationTime` is set to `null`.
@fmeum fmeum force-pushed the file-contents-proxy branch from 84a97fc to 7d87090 Compare February 12, 2026 18:54
@fmeum fmeum marked this pull request as ready for review February 12, 2026 18:55
@fmeum fmeum requested review from tjgq and removed request for a team February 12, 2026 18:56
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the creation of FileArtifactValue for remote files to consistently use a variant that supports content proxying. This is a valuable optimization that avoids unnecessary Skyframe invalidations when external repository files are materialized. The changes in CompactPersistentActionCache and RemoteExternalOverlayFileSystem are correct and well-implemented. The plumbing of remoteCacheTtl from RemoteOptions through RemoteModule is also done correctly. Overall, this is a solid improvement to Bazel's remote caching capabilities.

@tjgq tjgq added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally team-Performance Issues for Performance teams team-Remote-Exec Issues and PRs for the Execution (Remote) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants