Skip to content

Conditionally download stdout and stderr of remotely executed actions#28716

Open
Silic0nS0ldier wants to merge 2 commits intobazelbuild:masterfrom
Silic0nS0ldier:cond-stdouterr-download
Open

Conditionally download stdout and stderr of remotely executed actions#28716
Silic0nS0ldier wants to merge 2 commits intobazelbuild:masterfrom
Silic0nS0ldier:cond-stdouterr-download

Conversation

@Silic0nS0ldier
Copy link
Copy Markdown
Contributor

Description

Adds a new flag --remote_download_stdouterr (stdouterr is to match --experimental_ui_max_stdouterr_bytes) to control downloading of action stdout and stderr.

To suite the various use cases, multiple options are available.

  • failed: This is functionally a none option, as it matches the behavior of other action outputs under all configurations (barring usage of --remote_download_symlink_template) where outputs of failed actions are always downloaded.
    • Fewest possible downloads when combined with --remote_download_outputs=minimal.
    • Implicitly reduces action log noise.
  • uncached: Downloads stdout and stderr of all actions that actually ran. Implicitly includes failed actions (since failures are not cached).
    • An arbitrary split similar to --test_summary=short_uncached|detailed_uncached.
    • Number of downloads drops proportional to cache hit rate.
    • Implicitly reduces action log noise. May be useful for local development to put the focus on affected actions.
  • all: The default and current behavior. All actions have their stdout and stderr downloaded.
    • Beyond being the default, keeping support for this is useful for integrations that require logs to be downloaded (none that I know of, but as the default I'm sure something is reliant on this).

A toplevel option was considered, but is more complicated to implement. Best implemented in a separate PR, if there is demand.

This does not affect test outputs (test.xml and test.log).

Motivation

Ideally actions are silent, in practice however many log warnings (very common for third party and even first-party C and C++).

In a CI setting this output is seldom viewed (mostly being regarded as log noise, which can be suppressed with UI filter flags), which makes the networking overhead hard to justify. This overhead can amount to significant load as the number of concurrent invocations increases (especially when combined with bazel test //...).

Closes #19782

Note that a different take on this which modifies the behavior based on --remote_download_outputs has also been raised. #23223 This PR borrows the unit test implementation.

Build API Changes

New command line flag --remote_download_stdouterr with options;

  • failed
  • uncached
  • all

The flag itself has not been discussed, although the behavior (not downloading stdout and stderr of actions) has been discussed at #19782 and #23223.

Since the flag is not usable within builds (as part of a transition) it is backward compatible, although using the flag with older Bazel versions may result in an error (unrecognized flag).

Checklist

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

Release Notes

RELNOTES[NEW]: Downloading of stdout and stderr of remotely executed actions can now be disabled with --remote_download_stdouterr. Available options are all (default), uncached and failed.

@Silic0nS0ldier Silic0nS0ldier requested a review from a team as a code owner February 19, 2026 14:42
@github-actions github-actions Bot added team-Remote-Exec Issues and PRs for the Execution (Remote) team awaiting-review PR is awaiting review from an assigned reviewer labels Feb 19, 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 introduces a new flag --remote_download_stdouterr to conditionally download stdout and stderr for remotely executed actions, which can reduce network overhead. The changes include the new flag definition, the logic to control downloads based on the flag's value, and shell tests to verify the new behavior. The implementation is correct and the new feature is well-tested. I have no critical feedback on these changes.

}
}

if (downloadOutErr) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There are actions that always require stdout/stderr, most importantly C++ actions using MSVC's /showIncludes feature. Test actions also act on the local output. Have you tested those with the flag?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

/showIncludes does rely on stdout/stderr, that is just where the outputs are sent. In that respect, it is no different to another other action which writes to standard output streams (via a flag or otherwise).

Confusing? Potentially. But this (not downloading logs) is an opt-in behaviour.

While working on this I did attempt implement printing of the BES action result URL (for RE services where logs are accessible) so there can be a fallback. Attempted and failed, so I opted to exclude it from this PR, with the hopes of implementing it later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As for test actions, I'll do some testing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've done some digging. test.log (and it's permutations for sharding and retries) is the standard output destination, so in it's current state this does break them (and means the default test.xml is generated with an empty test.log).

It also cannot be made a regular test output, as the streaming output mode for tests relies on this.

I don't think this is impossible to solve, but it is likely to require changing the test machinery (much more effort, greater risk). What I'll do is scope this to just "normal" actions (i.e. non-test actions) and work on test action support in a follow up.

@Silic0nS0ldier
Copy link
Copy Markdown
Contributor Author

I stumbled across --remote_print_execution_messages. Noting here so I can follow up if and how the scope overlaps with this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR is awaiting review from an assigned reviewer team-Remote-Exec Issues and PRs for the Execution (Remote) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to not download action/test stdout/stderr

2 participants