fix: restrict childProcess.spawn to local-only environments
childProcess.spawn executes on the extension host machine. With
extensionKind: ["ui", "workspace"], the extension host almost always
runs locally. For any remote workspace (SSH, WSL, Dev Container,
Codespaces, tunnel), spawning locally either runs commands on the wrong
machine or fails with ENOENT when the local shell doesn't exist in the
extension host context.
Replace ENABLED_FOR_REMOTES (which listed all remote types) with
LOCAL_ONLY (just "" and "local"). All remote types now fall through to
ide.runCommand() which delegates to VS Code's integrated terminal and
executes in the correct remote environment.
The isWindowsHostWithRemote guard is removed as it is now redundant —
the platform-agnostic check handles all cases.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* fix: add default timeout for terminal command tool execution
Terminal commands with waitForCompletion=true had no timeout, risking
indefinite hangs. Adds a 2-minute default timeout with graceful
SIGTERM -> 5s grace period -> SIGKILL escalation. Both streaming
and non-streaming code paths are covered. The SIGKILL timer is
properly cleared if the process exits during the grace period.
* fix: correct process running check and clear SIGKILL timer
Replace `childProc.killed` with `exitCode === null && signalCode === null`
for accurate process-state detection, and clear sigkillTimeoutId in error
handlers to prevent delayed kills after rejection.
Applied to both streaming and non-streaming paths.
---------
Co-authored-by: amabito <192487536+amabito@users.noreply.github.com>
Co-authored-by: amabito <amabito@local>
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 <noreply@anthropic.com>
When the VS Code extension runs on Windows but connects to WSL,
direct shell spawning fails because process.platform is "win32"
but commands should execute in the Linux WSL environment.
This caused: spawn powershell.exe ENOENT
The fix detects this scenario and falls back to ide.runCommand(),
letting VS Code handle the remote terminal execution properly.
Fixes#9661
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove WSL-specific check in favor of generic URI handling
- Support all vscode-remote:// URI schemes (WSL, SSH, dev-container)
- Prefer file:// URIs when available, fall back to remote URIs
- Add tests for various remote URI formats
- Remove CLAUDE.md per reviewer feedback (use AGENTS.md convention)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Paths with spaces or special characters (e.g., /home/user/my%20project)
need decodeURIComponent() to match actual filesystem paths.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Parse vscode-remote://wsl+distro/path URIs to extract the actual
workspace path instead of falling back to Windows HOME directory.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The fileURLToPath function can throw "The URL must be of scheme file"
in some WSL2/remote environments with malformed URIs. Wrap in try-catch
to fall through to HOME directory fallback.
Fixes#8091🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>