Repository navigation
Windows: run commands in cmd.exe without Git Bash, tell the agent the device's shell - #370
Open
default-cybe wants to merge 11 commits into
Open
default-cybe wants to merge 11 commits into
default-cybe wants to merge 11 commits into
Conversation
…gent the shell The hub's Bash tool sent its bash wrapper (exec, trap, eval) to every device, so a Windows PC without Git Bash failed every command with "'exec' is not recognized". A cmd.exe device now gets a cmd wrapper that reports the final folder and keeps the exit code. Windows picks Git Bash over the WSL launcher, kills with taskkill /T, and reports the shell exec uses. The Environment block names the OS and shell, and Devices suggests Git for Windows on a cmd-only PC. Committed-by: Conclave (cliproxy/claude-opus-5-5)
Committed-by: Conclave (cliproxy/claude-opus-5-5)
…e verbatim Review fixes: the command goes in parentheses so an if or for cannot take the marker into its body; lines join without & inside a ( ) block, rem and :: lines are dropped, and a trailing & is cut. cmd runs with /v:off, and on Windows the hub passes its line in quotes with windowsVerbatimArguments, as raw_arg does in the daemon, so Bun's own quoting cannot break inner quotes. Committed-by: Conclave (cliproxy/claude-opus-5-5)
Committed-by: Conclave (cliproxy/claude-opus-5-5)
Preserve the merged Windows shell discovery, cwd validation and daemon reconnect fixes. Execute foreground cmd commands as temporary UTF-8 batch scripts instead of reparsing user syntax inside an inline parenthesis block. Keep native cmd quoting, exit status, process-tree cancellation and truthful shell information. Judge Windows commands with conservative shell-aware permissions, including custom commands, workflows and verification. Run real cmd and Rust process tests in Windows pull-request CI, covering spaces, percent variables, parentheses, Unicode, multiline blocks, cwd, exit codes, npm-style shims, timeouts and background shells. Committed-by: Conclave (cliproxy/gpt-6.1-sol)
Committed-by: Conclave (cliproxy/gpt-6.1-sol)
Run chcp 65001 >nul in the outer cmd.exe /d /v:off /s /c command line before invoking "%__CONCLAVE_SCRIPT%". Running chcp inside the .cmd file after cmd.exe had already opened it in the default codepage misread Unicode paths and shifted batch file byte offsets across :__conclave_run. Committed-by: Conclave (cliproxy/gpt-6.1-sol)
…file Move the batch epilogue (exit code capture, stderr cwd marker, and exit) out of the temporary .cmd file and into the outer cmd.exe /d /v:off /s /c command line after `call "%__CONCLAVE_SCRIPT%"`. When a command invoked another .cmd shim without CALL, cmd.exe transferred batch execution to the shim and returned to the top-level `call`, skipping any statements after `call :__conclave_run` inside the outer .cmd file. Committed-by: Conclave (cliproxy/gpt-6.1-sol)
…ing on Windows In command-line mode (`cmd.exe /c`), `%%errorlevel%%` is not de-doubled by `call`, so `call exit /b %%__conclave_exit%%` always evaluated to 0; use `%^errorlevel%` and `%^__conclave_exit%` so the caret prevents first-pass expansion and `call` expands the real exit code after the script finishes. Also avoid `detached: true` on win32 so child processes inherit stdout/stderr pipes instead of a detached console, and include `chcp 65001 >nul` inside the batch script as well. Committed-by: Conclave (cliproxy/backup-gemini/gemini-4-argon-high)
A caret inside set "..." quotes is literal, so %^errorlevel% never turned into %errorlevel% and every command reported exit code 0. Use the unquoted call set form, with no space before &, so call expands the real errorlevel. Committed-by: Conclave (cliproxy/personal-claude/claude-opus-5-5)
…er lookup The runner's parallel batch, extension gate (project gate) and audit still read a Bash command as bash, so on a cmd.exe device `echo hi #& del x` ran as read-only: unaudited, ungated and in parallel. callReadOnly judges it in the shell it runs in, as checkPermission already does. cmd.exe runs a program from the current folder before PATH, so a repo's git.bat ran under an allow rule for git. Set NoDefaultCurrentDirectoryInExePath for cmd in the hub's exec and spawn and in the daemon's. Committed-by: Conclave (cliproxy/personal-claude/claude-opus-5-5)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On a Windows PC without Git for Windows the device shell is cmd.exe, and every Bash call failed with
'exec' is not recognized as an internal or external command. The hub sent its bash-only wrapper (exec 3>&2 2>&1,trap ... EXIT,eval) to every device. The model then fell back to saying it could only run Unix commands.What changes
Hub Bash tool (packages/core/src/tools/bash.ts)
RemoteMachine.lastInfo.shellfrom the daemon hello (no round trip), orLocalMachine.shell()on the hub.wrapCmdCommand:(<command>) & call set __cc_ec=%^errorlevel%& call echo <marker>%^CD% 1>&2 & call exit %^__cc_ec%.callwith%^X%delays expansion, so the final folder and the command's errorlevel are read after the command runs.extractCwdalready looks.iforforfrom taking the marker into its body.&, except inside a( )block.remand::lines are dropped, and a trailing&is cut.cmd /d /s /c "..."unchanged. So the hub update alone fixes cmd devices.Why cmd and not PowerShell: cmd is what the daemon already starts on these PCs, so no extra process is needed. It keeps argv and kill handling the same as today and works with daemons already deployed. PowerShell would need its own quoting layer, and its start-up is slower on every call.
Shell picker and process handling (packages/core/src/machine/local.ts, packages/daemon-rs/src/procs.rs, from the 2026-11-07 patch)
git.exe./d /v:off /s /c "<line>". On the hub this useswindowsVerbatimArguments, which matchesraw_argin the daemon.taskkill /T /F, so the whole process tree ends.bash -cgoes to the device shell on Windows.info.shellon Windows reports the shell exec actually runs, not$SHELL./d/xcwd maps back toD:\xon a Windows session.The model knows the device (session/prompt.ts): the Environment block gets one line:
- Shell: Windows, commands run in cmd.exe (no bash): use Windows commands (dir, type, findstr, where) or PowerShell via powershell -NoProfile -Command- Shell: Windows with Git Bash: POSIX commands work; paths like D:\x work as /d/x or D:/x- Shell: Linux, commands run in bash(macOS likewise)The Bash tool's description no longer says
bash -c.Devices page: a Windows device on cmd.exe shows "Install Git for Windows for full shell support", with a link to https://git-scm.com/downloads/win.
TS daemon:
conclave daemonuses LocalMachine, so it gets the same picker and argv.Tests
bash.test.ts:&.local-machine.test.ts:/d /v:off /s /c) for exec and for a backgroundbash -c.project.test.ts: the Environment text for win32+cmd, win32+Git Bash and linux.procs.rs:is_cmd_matches_cmd_exe_only,windows_bash_skips_wsl_and_finds_git_bash. cargo is not on the hub, so CI compiles and runs these.platform-card.test.ts: the coder prompt budget goes up by 50 for the new line (+37 measured).Reviewed by gpt-5.5 (read-only). Fixed from that review:
if/forswallowed the wrapper.rem, blocks and a trailing&./v:off.Left as is: the blocking
taskkillcall, which runs only on timeout or abort.