Why Windows terminals break AI coding agents
An agent that cannot run your build cannot fix it. On Windows that means ConPTY, the right shell, a process tree kill, long path handling and line endings. Get one wrong and the loop stalls.
Most agent bugs on Windows are not model bugs. They are the agent failing to run a command, misreading the exit code, or killing the wrong process and then waiting forever on a port that is still open.
These are the five details that decide whether an agent works on Windows.
1. ConPTY, not winpty
Windows has a real pseudo console since Windows 10 version 1809: ConPTY. Before it, tools used winpty, a compatibility shim with its own quirks around resizing, cursor position and Unicode.
Any modern terminal stack should use ConPTY. In Node that is node-pty with the ConPTY backend. If a tool still ships winpty, expect mangled output on anything that redraws, including progress bars and full screen TUIs.
2. The shell is not bash
Windows has three shells worth supporting: pwsh.exe, powershell.exe and cmd.exe. They disagree about quoting, escaping, chaining and environment syntax.
# pwsh
Get-ChildItem -Recurse -Filter *.ts | Select-String "TODO"
# cmd
dir /s /b *.ts | findstr TODO
An agent that emits bash syntax into cmd.exe gets an error it cannot interpret, then retries the same command. The fix is to tell the model which shell it is in, and to run commands through that shell explicitly instead of guessing.
State the shell in the system prompt and in the tool description. A model that knows it is in pwsh writes pwsh.
3. Killing a process tree
On Windows, a parent process does not take its children with it. Kill a pnpm dev and the Vite child keeps the port. Start again and you get "port already in use" from a process you thought you stopped.
taskkill /T /F /PID <pid>
/T walks the tree, /F forces. Every agent that starts long running processes needs this, plus a timeout: a command with no output for thirty seconds should be stopped and marked as not run, instead of blocking the turn.
4. Long paths
Windows has a 260 character limit on most paths unless the manifest opts out and the path uses the \\?\ prefix. A git worktree inside a deep node_modules tree hits that limit faster than you expect, and the error is usually a confusing "file not found" on a file that exists.
The fix is a path helper that prefixes long absolute paths, used everywhere the app touches the filesystem, not a string concatenation in one place.
5. Line endings
Repositories are usually LF, working copies are often CRLF, and tools disagree. An agent that writes LF into a CRLF file produces a diff where every line changed, which buries the real edit and breaks review.
Preserve what the file already uses. New files follow the tree's convention. Never normalize a file as a side effect of an unrelated edit.
What this looks like in practice
Tuffcode runs on ConPTY through node-pty, offers pwsh, powershell and cmd per terminal tab, kills process trees with taskkill /T /F, prefixes long paths through one helper, and preserves existing line endings. Terminals live in the right dock with tabs, scrollback, font and cursor settings, and each thread's worktree gets its own shell.
The reason to care is not aesthetics. An agent that can start your dev server, read its output, kill it cleanly and start it again is an agent that can verify its own work. One that leaks a port is an agent you stop trusting.
A short checklist for any Windows agent
- Does it use ConPTY?
- Does it know which shell it is in?
- Does it kill the whole process tree?
- Does it handle paths past 248 characters?
- Does it preserve line endings?
- Does it stop a command that produces no output?
Related: install Tuffcode on Windows and worktrees for parallel agents.