From b7c2b4f074b850563541fd9ee7258adb7d87fb0b Mon Sep 17 00:00:00 2001 From: shanevcantwell <153727980+shanevcantwell@users.noreply.github.com> Date: Tue, 10 Feb 2026 08:01:35 -0700 Subject: [PATCH] fix: generalize Windows remote detection for terminal commands Broadens the Windows-with-remote check from WSL-only to all non-local remotes (Dev Container, SSH, Codespaces, etc.) so that terminal commands fall back to ide.runCommand() instead of trying to spawn powershell.exe. Fixes #10007 Co-Authored-By: Claude Opus 4.6 --- core/tools/implementations/runTerminalCommand.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/tools/implementations/runTerminalCommand.ts b/core/tools/implementations/runTerminalCommand.ts index e3bb9374d..351ee75ca 100644 --- a/core/tools/implementations/runTerminalCommand.ts +++ b/core/tools/implementations/runTerminalCommand.ts @@ -114,15 +114,16 @@ export const runTerminalCommandImpl: ToolImpl = async (args, extras) => { const ideInfo = await extras.ide.getIdeInfo(); const toolCallId = extras.toolCallId || ""; - // When extension host runs on Windows but connects to WSL, we can't spawn - // shells directly - the platform is "win32" but commands should run in Linux. + // When the extension host runs on Windows but connects to a remote workspace + // (WSL, Dev Container, SSH, etc.), we can't spawn shells directly — the + // platform is "win32" but commands should run in the remote's Linux/macOS. // Use ide.runCommand() instead to let VS Code handle the remote execution. - const isWindowsHostWithWslRemote = - process.platform === "win32" && ideInfo.remoteName === "wsl"; + const isWindowsHostWithRemote = + process.platform === "win32" && !["", "local"].includes(ideInfo.remoteName); if ( ENABLED_FOR_REMOTES.includes(ideInfo.remoteName) && - !isWindowsHostWithWslRemote + !isWindowsHostWithRemote ) { // For streaming output if (extras.onPartialOutput) {