nanocoder
nanocoder copied to clipboard
[Bug] On Windows a cd inside execute_bash never reaches the file tools
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
- Create a project folder with a sub folder
suband set it as the session cwd. - Call
execute_bashwith{"command": "cd sub && cd"}. It prints the path ofsub. - 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:cwdCaptureFileisundefinedwhenisWindows. 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.
i can have a look into this @addyCooks