Skip to content

Exclude PassUnsafeEnv from remote digest#3539

Open
njskalski wants to merge 8 commits into
thought-machine:masterfrom
njskalski:feature/exclude-passunsafeenv-from-remote-digest
Open

Exclude PassUnsafeEnv from remote digest#3539
njskalski wants to merge 8 commits into
thought-machine:masterfrom
njskalski:feature/exclude-passunsafeenv-from-remote-digest

Conversation

@njskalski
Copy link
Copy Markdown
Contributor

This patch enables the Remote build to be have more like local, that is to exclude Unsafe env vars from digest.

It's gated by (default disabled) setting in [Remote] section to not break current setups.

Andrzej J Skalski added 8 commits May 11, 2026 16:40
Adds the missing section in config.html for the new Sandbox.Remote
field so that //docs/test:docs_test passes.
Make PassUnsafeEnv behave on remote execution like it does for the local
cache: the real values are still passed to the executed action, but they no
longer contribute to the remote action digest, so changing them does not
cause remote cache misses.

This generalizes the existing stamped/unstamped decoupling: results are
looked up and stored under a "cache-key" action digest that omits the
volatile values, while the real action (with the values present) is executed
and then backfilled into the cache under the cache-key digest.

Controlled by the new Remote.ExcludePassUnsafeEnvVarsFromDigest config option,
which defaults to true.
Add TestPassUnsafeEnvRemoteCacheHitAcrossValues, which builds a target twice
against the in-process test server with differing PassUnsafeEnv values (using
separate clients with empty local caches) and asserts the second build is a
remote cache hit rather than a re-execution. Adds an execution counter to the
test server to verify the action is executed exactly once.
Flip the new option to be off by default, so PassUnsafeEnv values contribute to
the remote action digest unless explicitly opted in. Update help text, docs,
changelog and tests accordingly.
The previous change only stripped per-target pass_unsafe_env from the cache-key
command. Values declared via the global [Build] PassUnsafeEnv config keyword
enter the build environment through config.GetBuildEnv() and were still left in
the canonical command, so changing them still caused remote cache misses.

Strip both config-level and target-level PassUnsafeEnv (keeping anything also
listed in PassEnv), and treat a non-empty config-level list as enough to enable
the cache-key split. This matches the local cache, which excludes both from its
hash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant