Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

[Bug] execute_bash on Windows mangles every double-quoted argument (git commit -m "msg" fails)

Ouverte
#1,663 0 commentaires 0 réactions 1 personne assignée Voir sur GitHub

Les mainteneurs répondent en général sous 3 jours

@addyCooks y travaille déjà.

Depuis le 8/10/2026.

  • #1667 par @addyCooks — ouverte

Évaluation

Cette issue n'a pas encore été évaluée.

Description

area:ci area:tools bug high-priority

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

  1. On Windows, have the agent run each of these with execute_bash in a git repo:
    1. echo "hello world"
    2. node -e "console.log(1+1)"
    3. git log -1 --format="%h %s"
    4. 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
Langage dominant
TypeScript
Étoiles
2.5k
Forks
341
Merge moyen
4 j 10 h
PR mergées (30 j)
140

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de Nano-Collective/nanocoder

Toutes les issues de Nano-Collective/nanocoder

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.