---
created: 2023-12-07
last updated: 2023-12-12
status: Under Review
reviewers:
- tjgq
title: `--remote_local_fallback` Respects Strategy Declarations
authors:
- Silic0nS0ldier
---
The flag --remote_local_fallback
makes it possible for remotely executed action spawns that fail to fallback to the local
spawn strategy.
This proposal seeks to treat spawn retries identically to actions tagged with no-remote
.
Falling back to the local environment is not always safe, and may be contrary to spawn strategy configuration.
e.g.
# Denotes actions with the mnemonic `FOO` must always be spawn with the `remote` strategy
build --strategy=Foo=remote
Requiring that an action be only spawned remotely may reflect a technical limitation. Such as the remote offering a Windows environment while Bazel itself is running on a macOS machine. The Windows binaries cannot be reasonably expected to work on macOS, and compatibility layers to support such a scenario are unlikely to provide identical behaviour.
Even in a context where remote and local environments are identical, local
may not represent the optimal spawn strategy.
worker
may offer better performance, especially if several remotable actions fail (e.g. connectivity loss).sandboxed
may provide an environment closer to that of the remote.
- remote: remove local fallback for remote execution
- Make --remote_local_fallback honor --spawn_strategy
A new flag --incompatible_strict_remote_local_fallback
will be introduced which when flipped makes --remote_local_fallback
rerun spawn strategy selection with remote
ignored.
This means;
- All registered strategies along with their filters are considered (
--spawn_strategy
,--strategy
,--strategy_regexp
, etc). - If a
remote
spawned action has no local fallback, no attempt to spawn locally is made and the build fails. - The
--remote_local_fallback_strategy
flag will have no effect. Note that it is incorrectly documentated as a no-op in Bazel 7.0.0 (see #15519 (comment)).
Current behaviour is counterproductive, so the expectation is that flag guarded behaviour would become the default in the next major version of Bazel.