fix(sandbox): don't duplicate agent file and --config-dir args#2487
Merged
dgageot merged 1 commit intodocker:mainfrom Apr 21, 2026
Merged
Conversation
runInSandbox was appending args and --config-dir a second time on top of what the dockerAgentArgs helper already produces. Inside the sandbox, the duplicated agent file path was then interpreted by `docker-agent run` as the first user message, e.g. `docker agent run --sandbox ./pokemon.yaml` would send "./pokemon.yaml" as the initial prompt. Add regression tests covering argument de-duplication, ordering, flag stripping (--sandbox/--sbx), and the implicit --yolo default. Assisted-By: docker-agent
gtardif
approved these changes
Apr 21, 2026
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.
Problem
runs the right agent but sends
./pokemon.yamlas the first chat message.Root cause
In
cmd/root/sandbox.go,runInSandboxappendsargsand--config-dira second time on top of what thedockerAgentArgshelper already produces. Inside the sandbox, the duplicated agent file path is then interpreted bydocker-agent runas the first user message (args[1]).Fix
Drop the duplicate
appendcalls inrunInSandboxand rely on the helper's output as-is.Tests
Adds
cmd/root/sandbox_test.gocovering:--config-dirappear exactly once.--config-dir(so cobra parses it as the agent, not a message).--sandbox/--sbxflags are stripped (no sandbox recursion).--yolois added by default but not duplicated when the user passes it.