[Bug] execute_bash on Windows mangles every double-quoted argument (git commit -m "msg" fails)
维护者通常 3 天内回复
评估
这个 Issue 还没有评估数据。
描述
Description
On Windows, execute_bash runs the command with spawn('cmd', ['/c', command], {cwd}) (source/services/bash-executor.ts:142) and no windowsVerbatimArguments. Node then re-quotes the command and escapes each inner " as \", which cmd.exe does not understand. Any command with double quotes is broken: commit messages, node -e "...", --format="...", paths with spaces. Some fail loudly, but node -e "console.log(1+1)" exits with code 0 and prints nothing, so the agent thinks it worked. Custom tools had the same bug and were fixed in #1108; execute_bash was not.
Environment
- OS: Windows 11 (10.0.26300)
- Node version: 22.22.3
- Nanocoder version: 1.31.0 (main at 5c2e693)
- Git: 2.55.0.windows.3
- Provider / Model: not relevant (reproduced by calling the executor directly)
Steps to Reproduce
- On Windows, have the agent run each of these with
execute_bashin a git repo:echo "hello world"node -e "console.log(1+1)"git log -1 --format="%h %s"git commit --allow-empty -m "fix the bug"
Expected Behavior
The same output as typing the command into cmd.exe: "hello world", 2, a commit hash and subject, and a new commit.
Actual Behavior
$ echo "hello world"
exit=0 stdout="\"hello world\""
$ node -e "console.log(1+1)"
exit=0 stdout="" (silent: no output, exit code 0)
$ git log -1 --format="%h %s"
exit=128 stderr="fatal: ambiguous argument '%s\"': unknown revision or path ..."
$ git commit --allow-empty -m "fix the bug"
exit=1 stderr="error: pathspec 'the' did not match any file(s) known to git | error: pathspec 'bug\"' ..."
No commit is created.
Suggested Fix
Spawn it the way custom tools already do (shellArgs and windowsVerbatimArguments in source/custom-tools/handler.ts:92-95 and :303-308):
spawn(process.env.ComSpec || 'cmd.exe', ['/d', '/s', '/c', `"${command}"`], {
cwd,
windowsVerbatimArguments: true,
});
I tried this spawn on the same four commands. All four worked ("hello world", 2, c2d6c64 base, and the commit was created), and echo a & echo b still chained correctly. The custom-tools version also passes /v:off to turn off delayed expansion, which is worth keeping. Please reuse shellArgs from there instead of copying it.
Also add a Windows-only test in source/services/bash-executor.spec.ts for the four commands above, and run that spec in the Windows CI job (.github/workflows/pr-checks.yml only runs two custom-tools specs today).
Additional Context
- Related: #1084 and PR #1108 (same bug in custom tools, fixed), #1028, and #1280 (a request for a configurable shell, a different change).
- I have searched existing issues to ensure this is not a duplicate
- I can reproduce this issue consistently
- This issue occurs with the latest version of nanocoder
- 主要语言
- TypeScript
- 星标
- 2.5k
- 派生
- 341
- 平均合并
- 4 天 5 小时
- 30 天内合并 PR
- 143
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Nano-Collective/nanocoder 的其他 Issue
-
[Bug] /copy code extra reports 'Unknown option "code"', and /help does not mention the code argument可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭area:cli bug good first issue
难度 2/5 1-3 小时 新手友好度 84/100
Nano-Collective/nanocoder#1748 · 1 条评论 ·
维护者通常 3 天内回复
-
[Bug] Auto-commit on a detached HEAD gives no warning, and agent commits carry no marker可能已有人在做 @ducanhnguyen223 今天认领。 未关闭area:tools bug good first issue
难度 2/5 1-3 小时 新手友好度 62/100
Nano-Collective/nanocoder#1747 · 1 条评论 ·
维护者通常 3 天内回复
-
[Bug] Provider connection errors do not say which provider or URL failed, or why ("Connection failed: Unable to reach the model server", "Invalid URL", "bad port")可能已有人在做 @Srinidhi444 于 1 天前认领。 未关闭area:providers bug good first issue
难度 2/5 1-3 小时 新手友好度 72/100
Nano-Collective/nanocoder#1742 · 1 条评论 ·
维护者通常 3 天内回复
-
[Bug] A provider with no "models" list is not rejected: the request is sent with an empty model name可能已有人在做 @CreedTech 今天认领。 未关闭area:cli area:providers bug good first issue
难度 2/5 1-3 小时 新手友好度 62/100
Nano-Collective/nanocoder#1741 · 1 条评论 ·
维护者通常 3 天内回复
-
area:cli area:tools bug good first issue
难度 2/5 1-3 小时 新手友好度 65/100
Nano-Collective/nanocoder#1740 ·
维护者通常 3 天内回复
查看 Nano-Collective/nanocoder 的全部 Issue
相似的 Issue
-
Create/import wallet form shows raw "password must be at least 1 characters" instead of the translated message可能已有人在做 @CapThunder19 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 82/100
joinmarket-webui/jam#1538 ·
维护者通常 1 天内回复
-
t0ggles
难度 2/5 1-3 小时 新手友好度 70/100
nolimits4web/swiper#8240 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
modelcontextprotocol/inspector#2723 ·
维护者通常 1 天内回复
-
status:approved type:bug
难度 1/5 1 小时以内 新手友好度 70/100
维护者通常 1 天内回复