Skip to content

Use FileArtifactValue#setContentsProxy for remote repo contents cache#28654

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

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

@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
Copy Markdown

@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
@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Mar 17, 2026
bazel-io pushed a commit to bazel-io/bazel that referenced this pull request Mar 17, 2026
…he (bazelbuild#28654)

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`.

Closes bazelbuild#28654.

PiperOrigin-RevId: 884796123
Change-Id: Ib399aff3864f5fbbef230b64a7a5ef619bf854d0
github-merge-queue bot pushed a commit that referenced this pull request Mar 17, 2026
…ents cache (#28654) (#29016)

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`.

Closes #28654.

PiperOrigin-RevId: 884796123
Change-Id: Ib399aff3864f5fbbef230b64a7a5ef619bf854d0

Commit
257a224

Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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