Repository navigation
fix(run): say how to build a missing sandbox image when nobody can be asked - #65
Merged
Merged
Conversation
… asked Without a terminal (stdin piped, CI, a script over SSH) the "build the image now?" prompt can't be answered, so a Docker-backend agent run failed with only "its image was not built". It now fails straight away with the command that builds it, as --silent already did. The hint itself was wrong for the default image: it said `docker build -t <tag> <Dockerfile>`, but that Dockerfile is embedded in the binary, so it now names `stashbase agent docker build`. A custom Dockerfile gets `docker build -t <tag> - < <path>`, which matches how the CLI builds it and also covers a per-run --docker-dockerfile.
A custom Dockerfile path with a space or other shell-special character (`/repo/my image/Dockerfile`) was printed bare, so the suggested `docker build -t <tag> - < <path>` broke when pasted. It is now single-quoted when needed, with embedded quotes escaped. The decision whether to prompt (not --silent, stdin and stderr are terminals) and the error text are now small functions with tests, so a change that brings back a blocking prompt in CI fails a test.
Answering "no" to "build the image now?" still ended with the bare "its image was not built". It now names the same build command as the non-interactive path. docs/sandboxing.md says the prompt only appears in an interactive terminal and what a run without one prints instead.
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--silentalready did.docker build -t <tag> <Dockerfile>, but that Dockerfile is embedded in the binary. It now namesstashbase agent docker build.docker build -t <tag> - < <path>. That builds from the Dockerfile alone, the same way the CLI does, so it also covers a per-run--docker-dockerfile. The path is shell-quoted when it has spaces or other special characters.docs/sandboxing.mdsays the prompt only appears in an interactive terminal and what a run without one prints instead.Test plan
'), the prompt decision (--silent, no stdin terminal, no stderr terminal), and the error text for the non-interactive and declined casescargo fmt --checkand fullcargo testpass/dev/nulland an unbuilt custom Dockerfile printed the build command; running it as printed and retrying the run worked'