-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Problem (one or two sentences)
On Windows, Roo Code's background terminal execution (ExecaTerminalProcess) incorrectly falls back to legacy PowerShell 5.1 instead of the user's configured PowerShell 7 profile, causing severe UTF-8 encoding issues (mojibake).
Context (who is affected and when)
This affects Windows users who have explicitly set PowerShell 7 (pwsh.exe) as their default VS Code terminal profile, particularly when executing commands that output non-ASCII characters (e.g., Chinese) during agent tasks.
Reproduction steps
- On Windows, install PowerShell 7 and set it as the default VS Code terminal profile.
- Ensure Roo Code's "Disable Terminal Shell Integration" is enabled (this is the default state).
- Ask Roo Code to run a command that outputs Chinese or other non-ASCII characters (e.g., echo "你好").
Expected result
Roo Code should correctly parse the VS Code terminal settings, use pwsh.exe (PowerShell 7) which natively supports UTF-8, and display the characters correctly without encoding issues.
Actual result
Roo Code incorrectly falls back to powershell.exe (PowerShell 5.1). Since it runs as a non-interactive subprocess, it ignores user $PROFILE settings (like chcp 65001) and defaults to the local system codepage (e.g., GBK), resulting in garbled text output.
Variations tried (optional)
I investigated the source code with my coding agent and found the exact root causes:
Flawed Shell Detection: In src/utils/shell.ts, getWindowsShellFromVSCode() aggressively falls back to SHELL_PATHS.POWERSHELL_LEGACY if the profile name includes "powershell" but lacks an explicit path or source === "PowerShell".
Profile Parsing Bug: In src/integrations/terminal/TerminalProcess.ts, the configuration is read incorrectly using vscode.workspace.getConfiguration("terminal.integrated.defaultProfile").get("windows"). This often returns null, forcing the legacy fallback.
(Note: I have already figured out how to fix these logic flaws and I would love to submit a PR for this if the team agrees with the findings!)
App Version
v3.51.1
API Provider (optional)
Unbound
Model Used (optional)
N/A
Roo Code Task Links (optional)
No response