Skip to content

[8.9.0] Add --experimental_max_repeated_lost_inputs to make the action-rewind… - #32354

Merged
iancha1992 merged 1 commit into
bazelbuild:release-8.9.0from
iancha1992:cp30220
Nov 2, 2026
Merged

iancha1992 merged 1 commit into
bazelbuild:release-8.9.0from
iancha1992:cp30220

Conversation

@iancha1992

Copy link
Copy Markdown
Member

…ing lost-input limit configurable (#30164)

Problem

Action rewinding gives up — failing the build with LOST_INPUT_TOO_MANY_TIMES / LOST_OUTPUT_TOO_MANY_TIMES — once the same action loses the same input/output more than a hardcoded MAX_REPEATED_LOST_INPUTS = 20 times (ActionRewindStrategy).

We're rolling out --rewind_lost_inputs, and when the remote cache is unstable, spending up to 20 rewind cycles per lost input is the wrong tradeoff: we'd rather give up early and re-run the build without the cache than grind against a cache that keeps evicting intermediate blobs (the "20× slower" path). Today the give-up threshold is hardcoded, so there is no way to fail fast short of patching Bazel.

Change

Adds --experimental_max_repeated_lost_inputs (default 20, behavior-preserving), threaded through BuildRequestOptions → SkyframeActionExecutor (cached per build in prepareForExecution, exposed via maxRepeatedLostInputs()) → ActionRewindStrategy, mirroring the existing --rewind_lost_inputs wiring. Lower it to give up sooner — 0 fails on the first lost input. It governs both the lost-input and lost-top-level-output give-up checks. The MAX_REPEATED_LOST_INPUTS constant is retained as the default and test anchor.

Test

The existing ineffectiveRewindingResultsInLostInputTooManyTimes RewindingTest case is now parameterized with @TestParameter({"2", "20"}): it sets --experimental_max_repeated_lost_inputs to each value and asserts the same repeatedly-lost input causes give-up on attempt N+1, covering both a lowered limit and the default.

Closes #30164.

PiperOrigin-RevId: 950819794
Change-Id: Ic3c34c791aec8f1944691fb4d609a9913d942297

Description

Motivation

Build API Changes

No

Checklist

  • I have added tests for the new use cases (if any).
  • I have updated the documentation (if applicable).

Release Notes

RELNOTES: None

Commit 33a59c4

…ing lost-input limit configurable (bazelbuild#30164)

## Problem

Action rewinding gives up — failing the build with `LOST_INPUT_TOO_MANY_TIMES` /
`LOST_OUTPUT_TOO_MANY_TIMES` — once the same action loses the same input/output more than a
hardcoded `MAX_REPEATED_LOST_INPUTS = 20` times (`ActionRewindStrategy`).

We're rolling out `--rewind_lost_inputs`, and when the remote cache is unstable, spending up to
20 rewind cycles per lost input is the wrong tradeoff: we'd rather **give up early and re-run the
build without the cache** than grind against a cache that keeps evicting intermediate blobs (the
"20× slower" path). Today the give-up threshold is hardcoded, so there is no way to fail fast
short of patching Bazel.

## Change

Adds `--experimental_max_repeated_lost_inputs` (default `20`, behavior-preserving), threaded
through `BuildRequestOptions` → `SkyframeActionExecutor` (cached per build in
`prepareForExecution`, exposed via `maxRepeatedLostInputs()`) → `ActionRewindStrategy`, mirroring
the existing `--rewind_lost_inputs` wiring. Lower it to give up sooner — `0` fails on the first
lost input. It governs both the lost-input and lost-top-level-output give-up checks. The
`MAX_REPEATED_LOST_INPUTS` constant is retained as the default and test anchor.

## Test

The existing `ineffectiveRewindingResultsInLostInputTooManyTimes` `RewindingTest` case is now
parameterized with `@TestParameter({"2", "20"})`: it sets `--experimental_max_repeated_lost_inputs`
to each value and asserts the same repeatedly-lost input causes give-up on attempt N+1, covering
both a lowered limit and the default.

Closes bazelbuild#30164.

PiperOrigin-RevId: 950819794
Change-Id: Ic3c34c791aec8f1944691fb4d609a9913d942297
@iancha1992 iancha1992 added the team-Core Skyframe, bazel query, BEP, options parsing, bazelrc label Nov 2, 2026
@iancha1992
iancha1992 requested a review from a team as a code owner November 2, 2026 22:46
@iancha1992 iancha1992 added the awaiting-review PR is awaiting review from an assigned reviewer label Nov 2, 2026
@iancha1992
iancha1992 enabled auto-merge November 2, 2026 22:46
@iancha1992

Copy link
Copy Markdown
Member Author

@justinhorvitz

Cherry-pick of 33a59c4 (#30164) into release-8.9.0.

The following files had merge conflicts or required manual adjustments for release-8.9.0 and should be reviewed more closely:

  • src/main/java/com/google/devtools/build/lib/buildtool/BuildRequestOptions.java: BuildRequestOptions on release-8.9.0 uses public fields instead of @OptionsClass abstract getters. Declared public int maxRepeatedLostInputs; (keeping public boolean rewindLostInputs; and omitting experimental_precise_rewinding from the surrounding master context).
  • src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java: Assigned this.maxRepeatedLostInputs = buildRequestOptions.maxRepeatedLostInputs; using field access in prepareForExecution, added maxRepeatedLostInputs(), and omitted preciseRewindingEnabled from surrounding master context.
  • src/main/java/com/google/devtools/build/lib/skyframe/rewinding/ActionRewindStrategy.java: Replaced MAX_REPEATED_LOST_INPUTS with skyframeActionExecutor.maxRepeatedLostInputs() while retaining release-8.9.0's currentBuildLostOutputRecords, currentBuildLostInputRecords, and lostOutputsByDigest.get(digest).
  • src/test/java/com/google/devtools/build/lib/skyframe/rewinding/RewindingTestsHelper.java: Resolved import conflict (keeping GraphInconsistency.Inconsistency alongside Options, plus importing BuildRequestOptions) and updated runTopLevelOutputRewound_ineffectiveRewinding to read Options.getDefaults(BuildRequestOptions.class).maxRepeatedLostInputs via field access.

@iancha1992
iancha1992 added this pull request to the merge queue Nov 2, 2026
Merged via the queue into bazelbuild:release-8.9.0 with commit f237141 Nov 2, 2026
43 checks passed
@github-actions github-actions Bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Core Skyframe, bazel query, BEP, options parsing, bazelrc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants