[Bug] execute_bash on Windows mangles every double-quoted argument (git commit -m "msg" fails)
Maintainer antworten meist innerhalb von 3 Tagen
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
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
- Vorherrschende Sprache
- TypeScript
- Sterne
- 2.5k
- Forks
- 341
- Ø Merge
- 4 T. 10 Std.
- Gemergte PRs (30 T.)
- 150
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus Nano-Collective/nanocoder
-
[Bug] `clipboardy` (and its `execa`/`semver` chain) is loaded at startup only for a copy button in the model database viewEvtl. vergeben @Vishesh-Verma-07 hat das vor 1 Tag übernommen. Offenarea:tui bug good first issue performance
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
Nano-Collective/nanocoder#1775 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 3 Tagen
-
[Bug] Auto-commit on a detached HEAD gives no warning, and agent commits carry no markerEvtl. vergeben @ducanhnguyen223 hat das vor 2 Tagen übernommen. Offenarea:tools bug good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
Nano-Collective/nanocoder#1747 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 3 Tagen
-
[Bug] A provider with no "models" list is not rejected: the request is sent with an empty model nameEvtl. vergeben @CreedTech hat das vor 2 Tagen übernommen. Offenarea:cli area:providers bug good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
Nano-Collective/nanocoder#1741 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 3 Tagen
-
[Bug] "Tool approval required" in run mode tells you to use --mode auto-accept when you are already in it, and the alwaysAllow hint names the wrong placeEvtl. vergeben @diyaavirmani hat das vor 1 Tag übernommen. Offenarea:cli area:tools bug good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
Nano-Collective/nanocoder#1740 · 2 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
-
[Bug] File context attachments read directly from disk, ignoring unsaved editor buffersEvtl. vergeben @karthikponna hat das vor 3 Tagen übernommen. Offenarea:vscode bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Nano-Collective/nanocoder#1723 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
Alle Issues in Nano-Collective/nanocoder
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
melgarafael/DeskcommCRM#3000 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
callstackincubator/simlock#639 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
aws/agentcore-cli#2606 ·
Maintainer antworten meist innerhalb von 1 Tag
-
🐛 [BUG] - FeatureComparisonTable text-only cells are top-aligned while icon cells are centeredOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 7 Tagen
-
ai-driven-qa bug Cosmetic
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
Maintainer antworten meist innerhalb von 1 Tag