Skip to content

Fix shell working directory on Windows#2330

Draft
xujunfeng1 wants to merge 3 commits into
agentscope-ai:mainfrom
xujunfeng1:agent/windows-shell-working-directory
Draft

Fix shell working directory on Windows#2330
xujunfeng1 wants to merge 3 commits into
agentscope-ai:mainfrom
xujunfeng1:agent/windows-shell-working-directory

Conversation

@xujunfeng1

Copy link
Copy Markdown

What changed

  • Build the working_directory shell prefix based on the current OS.
  • Keep the existing Unix-style single-quoted cd 'dir' && command behavior for non-Windows systems.
  • Use a Windows cmd-compatible cd /d "dir" && command prefix on Windows.
  • Added unit coverage for Windows and Unix command-prefix generation, and made the existing working-directory test derive the expected command from the same OS-aware helper.

Why

Fixes #2271. The previous implementation always used Unix single-quote syntax, which cmd.exe does not understand on Windows.

Validation

  • Compared main...xujunfeng1:agent/windows-shell-working-directory through the GitHub API and verified only ShellExecuteTool.java and ShellExecuteToolTest.java changed.
  • Attempted a sparse shallow clone of xujunfeng1/agentscope-java to run the targeted Maven test, but GitHub HTTPS clone timed out from this environment twice: Failed to connect to github.com port 443 after 21112 ms and 21471 ms.
  • Targeted tests were added, but could not be executed locally until the clone/network issue is resolved.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...gentscope/harness/agent/tool/ShellExecuteTool.java 80.00% 0 Missing and 1 partial ⚠️

📢 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]:window系统下执行任何命令工具 execute 总是出错

2 participants