[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日 13時間
- マージ済み PR(30日)
- 126
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Nano-Collective/nanocoder のほかの issue
-
area:tui bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Nano-Collective/nanocoder#1705 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
area:cli area:tui bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Nano-Collective/nanocoder#1702 ·
メンテナーはふだん 3 日以内に返信
-
[Bug] nanocoder config list/show/diff doesn't know about autoCommit, formatters, hooks, sandbox and notifications対応中かも @Zaygal が 2 日前に担当しました。 オープンarea:cli bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Nano-Collective/nanocoder#1692 ·
メンテナーはふだん 3 日以内に返信
-
[Bug] /doctor prints provider and MCP URLs with embedded credentials, under "Secrets are not printed"対応中かも @insuffer が 3 日前に担当しました。 オープンarea:cli area:mcp area:providers bug good first issue security
難易度 2/5 3〜5日 初心者へのやさしさ 62/100
Nano-Collective/nanocoder#1661 ·
メンテナーはふだん 3 日以内に返信
-
[Bug] Untrusted-directory error says NANOCODER_TRUST_DIRECTORY=1 bypasses the check "for this run", but it trusts the directory permanently対応中かも @karthikponna が 3 日前に担当しました。 オープンarea:cli bug good first issue security
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
Nano-Collective/nanocoder#1660 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
Nano-Collective/nanocoder の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
jaegertracing/jaeger-ui#4596 ·
メンテナーはふだん 1 日以内に返信
-
area:tui enhancement platform:macos
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
anthropics/claude-code#101490 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
netlify/netlify-mcp#75 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信