Skip to content

Conversation

@meisterT
Copy link
Member

@meisterT meisterT commented Jan 9, 2026

Fixes #3759

@github-actions github-actions bot added team-Local-Exec Issues and PRs for the Execution (Local) team awaiting-review PR is awaiting review from an assigned reviewer labels Jan 9, 2026
Copy link

@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 addresses an issue where dangling symbolic links created as outputs in a sandboxed action could lead to non-deterministic build failures. The fix introduces a validation step in AbstractSandboxSpawnRunner.verifyPostCondition that checks all outputs for dangling symlinks after an action completes but before its outputs are copied from the sandbox. This is implemented in a new helper method, SandboxHelpers.validateOutputs. The change is correctly propagated to LinuxSandboxedSpawnRunner by adding a call to the super method. A comprehensive shell test is added to verify the fix and prevent regressions. The changes appear correct and robust, effectively solving the reported issue.

*/
public static void validateOutputs(SandboxOutputs outputs, Path sourceRoot) throws IOException {
for (Entry<PathFragment, PathFragment> output :
Iterables.concat(outputs.files().entrySet(), outputs.dirs().entrySet())) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you move this logic into moveOutputs, you could reuse the stat performed there to avoid an additional stat for all outputs, which can be significant.

Iterables.concat(outputs.files().entrySet(), outputs.dirs().entrySet())) {
Path source = sourceRoot.getRelative(output.getValue());
if (source.isSymbolicLink() && !source.exists()) {
throw new IOException("declared output '" + output.getKey() + "' is a dangling symbolic link");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Outputs matched to artifacts declared with ctx.declare_symlink could legitimately be dangling.

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-Local-Exec Issues and PRs for the Execution (Local) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

check for dangling symlinks before copying outputs out of the sandbox

2 participants