Skip to content

Backtrack when the sandboxer cannot find a process input - #23748

Merged
jgranstrom merged 1 commit into
mainfrom
jg/sandboxer-missing-digest
Nov 5, 2026
Merged

jgranstrom merged 1 commit into
mainfrom
jg/sandboxer-missing-digest

Conversation

@jgranstrom

Copy link
Copy Markdown
Contributor

With the sandboxer, missing process input doesn't trigger backtracking as the error is returned as a string instead of StoreError::MissingDigest. So under pantsd every run with missing input fails, until pantsd is restarted. Without the sandboxer this backtracks since #23027.

With this PR

  • Sandboxer answers MissingDigest with NotFound, other errors stay FailedPrecondition
  • After a failed materialization, prepare_workdir asks Store::ensure_downloaded for the missing digest as a typed error, like the non-sandboxer path. If nothing is missing, it asks the sandboxer again.
  • Sandboxer now only restarts on codes other than NotFound

Tested end to end, with a warm pantsd and a deleted process output. On main every run fails and the sandboxer starts 3 times. With this change the first run backtracks and succeeds, the next is a cache hit, and the sandboxer starts once.

Disclosure: Implemented and verified with Claude with human direction

With the sandboxer, a missing input reached prepare_workdir as text, so
the run failed instead of backtracking, and the sandboxer was restarted.

The sandboxer now answers a missing digest with NotFound, on which
Sandboxer does not restart it. prepare_workdir then asks
Store::ensure_downloaded for the typed MissingDigest that backtracking
needs, or retries once if nothing is missing.
@jgranstrom
jgranstrom marked this pull request as ready for review November 3, 2026 20:28

@benjyw benjyw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good find

@jgranstrom
jgranstrom merged commit 9a827fe into main Nov 5, 2026
105 of 112 checks passed
@jgranstrom
jgranstrom deleted the jg/sandboxer-missing-digest branch November 5, 2026 19:23
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.

2 participants