nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] On Windows a cd inside execute_bash never reaches the file tools

Open addyCooks opened this issue 2 weeks ago • 1 comments

Description

On macOS and Linux, the shell command is wrapped so it writes its final directory to a temp file, and Nanocoder moves the session cwd there. On Windows the capture file is skipped, so a cd in one execute_bash call does not change the cwd the file tools use.

Environment

  • OS: Windows 11 Home 10.0.26300
  • Node version: v22.22.3
  • Nanocoder version: 1.32.0 (built from main at 5df35b3a)
  • Provider: Not provider-specific
  • Model: Not model-specific

Steps to Reproduce

  1. Create a project folder with a sub folder sub and set it as the session cwd.
  2. Call execute_bash with {"command": "cd sub && cd"}. It prints the path of sub.
  3. Check getSessionCwd().

Expected Behavior

The session cwd is the sub folder, so read_file {"path": "x.txt"} resolves inside it, like on macOS and Linux.

Actual Behavior

The session cwd is still the project folder.

Logs/Screenshots

expected: ...\verify2-EHmJtv\sub
actual:   ...\verify2-EHmJtv

Additional Context

  • [x] I have searched existing issues to ensure this is not a duplicate
  • [x] I can reproduce this issue consistently
  • [x] This issue occurs with the latest version of nanocoder (main)

Suggested fix:

  • source/services/bash-executor.ts:213-215: cwdCaptureFile is undefined when isWindows. Add a Windows version of the capture (for example append & cd > "%NC_CWD_FILE%" for cmd.exe and the equivalent for PowerShell) and read it in the same place as the POSIX capture (around line 296-310).
  • Add a Windows-only test for cd sub.

addyCooks avatar Nov 16 '26 09:11 addyCooks

i can have a look into this @addyCooks

Vishesh-Verma-07 avatar Nov 17 '26 07:11 Vishesh-Verma-07