#5168: Fix: force UTF-8 for Windows exec
app: web-ui
agents
Cluster:
Windows Path and Exec Fixes
## Summary
- wrap Windows exec commands with a UTF-8 PowerShell preamble to preserve non-ASCII paths
- reuse the Windows shell helper for node host execution
- add unit coverage for the PowerShell wrapper and Windows node shell args
Closes #5113
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR centralizes Windows shell handling by introducing `src/infra/windows-shell.ts` (PowerShell path resolution + a UTF‑8/CP65001 preamble wrapper), switches node-host execution to use PowerShell instead of `cmd.exe`, and reuses the shared PowerShell args in `getShellConfig`. It also adds unit coverage for the wrapper and node shell argv building, plus UI work for chat image attachments (paste/drag-drop/file picker) with corresponding CSS.
Main concern: the new UTF‑8 wrapper is applied for direct/PTY runs, but the docker/sandbox exec path still uses the unwrapped command, so Windows sandboxed exec may still fail on non‑ASCII paths.
<h3>Confidence Score: 3/5</h3>
- Reasonably safe to merge, but there is one functional gap for Windows sandbox exec.
- The change is mostly additive and covered by unit tests for the new Windows shell helpers, but `runExecProcess` applies the UTF‑8 PowerShell wrapper only to direct/PTY execution while the docker/sandbox branch still uses the unwrapped command, which can leave the original Windows non‑ASCII path issue unresolved in that mode. UI additions are localized and low risk.
- src/agents/bash-tools.exec.ts (Windows sandbox exec path); ui/src/ui/views/chat.ts (drag hover state robustness)
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#9250: Fix: Add shell:true for Windows .cmd files to prevent spawn EINVAL ...
by vishaltandale00 · 2026-02-05
80.8%
#21215: Windows PowerShell reliability fixes (exec shim + Discord numeric p...
by musosoft · 2026-02-19
79.6%
#18143: fix(windows): wrap shell builtins with cmd.exe /c for proper execution
by brandonwise · 2026-02-16
79.3%
#10708: fix: handle Windows PATH case-sensitivity in exec environment
by Yida-Dev · 2026-02-06
79.0%
#7507: test(ci): make tests cross-platform (Windows) + add basic sanitizat...
by ThinkIbrokeIt · 2026-02-02
78.7%
#10714: fix: handle Windows PATH case-sensitivity in node register invoke
by Yida-Dev · 2026-02-06
77.4%
#13873: fix(sandbox): prevent Windows PATH from poisoning docker exec
by alessandrorodi · 2026-02-11
77.1%
#11300: feat(exec): make shell configurable via tools.exec.shell
by imjszhang · 2026-02-07
76.7%
#4295: fix: quote Windows paths with spaces in UI runner command
by Xieweikang123 · 2026-01-30
76.5%
#11961: fix: exec tool wraps shebang scripts in heredoc to use correct inte...
by scott-memco · 2026-02-08
76.4%