Skip to content

fix(harness): preserve Docker exec commands on Windows - #2925

Open
guslegend0510 wants to merge 6 commits into
agentscope-ai:mainfrom
guslegend0510:codex/fix-2924-docker-exec-stdin
Open

fix(harness): preserve Docker exec commands on Windows#2925
guslegend0510 wants to merge 6 commits into
agentscope-ai:mainfrom
guslegend0510:codex/fix-2924-docker-exec-stdin

Conversation

@guslegend0510

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.0.3-SNAPSHOT

Description

Fixes #2924

DockerSandbox.doExec() previously passed the complete shell command as the final docker.exe argument (sh -c <command>). On Windows, nested double quotes can be altered while the Win32 command line is serialized and parsed, breaking filesystem commands such as write_file and edit_file.

This PR:

  • runs docker exec -i ... sh -s and streams the command through UTF-8 stdin instead of placing it in argv;
  • wraps the streamed command so command-level stdin remains isolated while heredocs and explicit redirections continue to work;
  • preserves existing stdout/stderr capture, output truncation, non-zero exit, and timeout behavior;
  • adds regression tests for nested quotes, Unicode, multiline heredocs, non-zero exits, timeouts, and output truncation.

Testing

  • mvn -pl agentscope-harness -am -Dtest=DockerSandboxExecTest -Dsurefire.failIfNoSpecifiedTests=false test
  • mvn -pl agentscope-harness -am test
  • mvn spotless:check
  • git diff --check
  • Docker Linux-container verification covering the Issue [Bug]:DockerSandbox.doExec() strips nested double quotes on Windows #2924 reproduction, file write, Python heredoc edit, and stdin isolation

Checklist

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation is not required; the implementation Javadoc was updated
  • Code is ready for review

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.29412% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rness/agent/sandbox/impl/docker/DockerSandbox.java 85.29% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

[Bug]:DockerSandbox.doExec() strips nested double quotes on Windows

2 participants