Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.
This repository was archived by the owner on May 15, 2026. It is now read-only.

[BUG] Windows terminal fallback incorrectly defaults to PowerShell 5.1 (Legacy) ignoring PS7 profile, causing UTF-8 encoding issues #11958

Description

@3aKHP

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

  1. On Windows, install PowerShell 7 and set it as the default VS Code terminal profile.
  2. Ensure Roo Code's "Disable Terminal Shell Integration" is enabled (this is the default state).
  3. 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

Relevant logs or errors (optional)

Activity

  1. 3aKHP commented on Mar 19, 2026

    @3aKHP
    Author

    Claiming

    @roomote Thanks for the excellent analysis and plan! Since this would be my very first open-source contribution, I would love to implement this plan and submit the PR myself using my own coding agent.

    I will reach out to Hannes on Discord for the assignment as per the contributing guidelines.

  2. ghost added a commit that references this issue on Mar 19, 2026
    1a2c45c
  3. added a commit that references this issue on Mar 20, 2026
    28043ff
  4. rossdonald commented on Mar 23, 2026

    @rossdonald
    Contributor

    Did you see this related issue? #8530

    PowerShell 7 (pwsh) is not installed by default on Windows. Windows comes pre-installed with Windows PowerShell 5.1 (powershell.exe). So, it's not correct to default to PowerShell 7 as some users won't have it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions