Skip to content

[8.8.0] Use FileArtifactValue#setContentsProxy for remote repo contents cache#29975

Merged
iancha1992 merged 4 commits into
bazelbuild:release-8.8.0from
fmeum:rrcc-8.7.0-24
Jun 25, 2026
Merged

[8.8.0] Use FileArtifactValue#setContentsProxy for remote repo contents cache#29975
iancha1992 merged 4 commits into
bazelbuild:release-8.8.0from
fmeum:rrcc-8.7.0-24

Conversation

@fmeum

@fmeum fmeum commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

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 the materialization-data variant. Before this change, such metadata would roundtrip into a plain RemoteFileArtifactValue (without the content proxy optimization) when no expiration time is set.

8.x adaptation: the remote metadata factories still live on the nested FileArtifactValue.RemoteFileArtifactValue class (create/createWithMaterializationData) rather than the v9 top-level createForRemoteFile* overloads. The overlay filesystem therefore injects external repo files via RemoteFileArtifactValue.createWithMaterializationData (passing the expiration as epoch millis and a null materialization path), and CompactPersistentActionCache.decodeRemoteMetadata drops its early return to the non-materialization RemoteFileArtifactValue.create so decoded remote metadata always supports the FileContentsProxy optimization.

Closes #28654.

PiperOrigin-RevId: 884796123
Change-Id: Ib399aff3864f5fbbef230b64a7a5ef619bf854d0
(cherry picked from commit 257a224)

@fmeum fmeum requested a review from a team as a code owner June 24, 2026 12:18
@github-actions github-actions Bot added team-Performance Issues for Performance teams team-Configurability platforms, toolchains, cquery, select(), config transitions team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. team-Core Skyframe, bazel query, BEP, options parsing, bazelrc team-Remote-Exec Issues and PRs for the Execution (Remote) team area-Bzlmod Bzlmod-specific PRs, issues, and feature requests awaiting-review PR is awaiting review from an assigned reviewer labels Jun 24, 2026
@fmeum fmeum marked this pull request as draft June 24, 2026 13:30
@fmeum fmeum marked this pull request as ready for review June 24, 2026 13:34
@iancha1992 iancha1992 requested review from coeuvre and tjgq June 24, 2026 18:20
fmeum and others added 4 commits June 25, 2026 09:40
Fixes bazelbuild#27517 by checking Skyframe deps in batches that stop right before any dep that may cause a cycle if checked while previous deps are out-of-date.

This is accompanied by a restructuring of `RepoRecordedInput` that consolidates all Skyframe logic associated with the computation of the corresponding value exclusively within that class. This will also be helpful in adding support for dynamic inputs to the remote repo contents cache in future work.

The upstream commit additionally moved the entirety of `RepositoryFetchFunction` to Skyframe workers so that checking the up-to-dateness of local repo contents cache entries isn't quadratic. That worker refactor is omitted in this 8.x backport, which keeps the existing split `RepositoryDelegatorFunction`/`StarlarkRepositoryFunction` architecture and restart-based evaluation; the cycle fix and the `RepoRecordedInput` restructuring are applied on that model. The batched up-to-dateness check is restart-safe (`isAnyValueOutdated` short-circuits while its batch's values are still missing).

Closes bazelbuild#28206.

Co-authored-by: Xudong Yang <wyverald@gmail.com>
PiperOrigin-RevId: 855252657
Change-Id: Ica18760ae79da5155fc0f3d8cd4f24c52a034c86
(cherry picked from commit 72a25a9)
* The cache was always written to, even if not enabled. (On 8.x this guard was already folded into the remote repo contents cache port, bazelbuild#29075, so only the second fix below is applied here.)
* Google RBE doesn't accept `Command`s without the (deprecated) `Platform` field set. We set it both on `Command` and `Action`, just to be safe.

Fixes bazelbuild#28294 (comment)

Closes bazelbuild#28295.

PiperOrigin-RevId: 856169835
Change-Id: I2479119a173e325a7d39643a36536569f5f831fc
(cherry picked from commit a9946096847e22de98e0e11b1f5dfbb6ec6ecdbb)
Important outputs and runfiles from external repos that are remote repo contents cache hits got stuck at various levels of the materialization pipeline for being source artifacts. This is fixed by consolidating the skip logic in a `RemoteOutputChecker.mayBeRemote` static helper and letting external-repo source artifacts flow through the toplevel-output download path.

8.x adaptation: v9 routes toplevel outputs through `RemoteImportantOutputHandler`, which does not exist on 8.x (`ImportantOutputHandler` has no production implementor). The equivalent toplevel-output materialization on 8.x lives in `CompletionFunction.ensureToplevelArtifacts`/`downloadArtifact`, which previously bailed out on non-`DerivedArtifact`s and only ran under skymeld. This change lets external-repo source artifacts (which have no generating action and are thus never downloaded by `finalizeAction`) flow through that path in both skymeld and non-skymeld builds, so they honor `--remote_download_outputs` just like build outputs do. `AbstractActionInputPrefetcher.prefetchFiles` already only skips main-repo source artifacts, so it is unchanged beyond annotating the `action` parameter `@Nullable` (source artifacts have no generating action).

Closes bazelbuild#28308.

PiperOrigin-RevId: 881618604
Change-Id: Ifaae8e39b0bcab3803653ca82bcf00d26c487316
(cherry picked from commit 16613f1)
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`.

8.x adaptation: the remote metadata factories still live on the nested `FileArtifactValue.RemoteFileArtifactValue` class (`create`/`createWithMaterializationData`) rather than the v9 top-level `createForRemoteFile*` overloads. The overlay filesystem therefore injects external repo files via `RemoteFileArtifactValue.createWithMaterializationData` (passing the expiration as epoch millis and a null materialization path), and `CompactPersistentActionCache.decodeRemoteMetadata` drops its early return to the non-materialization `RemoteFileArtifactValue.create` so decoded remote metadata always supports the `FileContentsProxy` optimization.

Closes bazelbuild#28654.

PiperOrigin-RevId: 884796123
Change-Id: Ib399aff3864f5fbbef230b64a7a5ef619bf854d0
(cherry picked from commit 257a224)
@iancha1992 iancha1992 added this pull request to the merge queue Jun 25, 2026
@iancha1992 iancha1992 added this to the 8.8.0 release blockers milestone Jun 25, 2026
Merged via the queue into bazelbuild:release-8.8.0 with commit 023a3f6 Jun 25, 2026
46 checks passed
@github-actions github-actions Bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Jun 25, 2026
@fmeum fmeum deleted the rrcc-8.7.0-24 branch June 26, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Bzlmod Bzlmod-specific PRs, issues, and feature requests team-Configurability platforms, toolchains, cquery, select(), config transitions team-Core Skyframe, bazel query, BEP, options parsing, bazelrc team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. 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.

3 participants