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>
The `resolveLsToolDirPath` function incorrectly stripped leading dots
from paths like `.continue/rules`, converting them to `continue/rules`
which doesn't exist. This broke the ls tool for any hidden directory.
Remove the faulty condition that matched paths starting with "." but
not "./" and stripped their first character. The path resolver handles
these paths correctly without preprocessing.
Fixes#10466
Co-authored-by: Claude <noreply@anthropic.com>
* fix: add security check to createNewFile tool (CWE-22)
The createNewFile tool was missing the throwIfFileIsSecurityConcern()
check that readFile already has, allowing path traversal to write
sensitive file types (e.g. .env, SSH keys) via prompt injection.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: upgrade tar-fs to patch CVE-2024-12905 and CVE-2025-59343
core/vendor had tar-fs@2.1.2 (via prebuild-install) and tar-fs@3.0.8,
both in vulnerable ranges. npm audit fix upgraded them.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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>
Ensures process.env.HOME is restored even if assertions fail,
preventing flaky behavior in subsequent tests.
🤖 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>
* Fix readFileRange Kotlin Int overflow in IntelliJ plugin
Replace Number.MAX_SAFE_INTEGER with Int.MAX_VALUE (2147483647) to prevent
JSON deserialization errors in IntelliJ plugins.
The issue occurred because JavaScript's Number.MAX_SAFE_INTEGER (2^53 - 1)
exceeds Kotlin's Int maximum value (2^31 - 1), causing the following error:
'java.lang.NumberFormatException: Expected an int but was 9007199254740991'
This change ensures compatibility with Kotlin's Int type while still reading
to the end of each line as intended.
Fixes#8517
Co-authored-by: dallin <dallin@continue.dev>
Generated with [Continue](https://continue.dev)
Co-Authored-By: Continue <noreply@continue.dev>
* Trigger CI re-run
The previous CI failure was a flaky test in the CLI extension, unrelated to our changes.
Co-authored-by: dallin <dallin@continue.dev>
Generated with [Continue](https://continue.dev)
Co-Authored-By: Continue <noreply@continue.dev>
* Extract magic number into MAX_CHAR_POSITION constant
Improve code maintainability by defining the Kotlin Int.MAX_VALUE as a
named constant with clear documentation.
Co-authored-by: dallin <dallin@continue.dev>
Generated with [Continue](https://continue.dev)
Co-Authored-By: Continue <noreply@continue.dev>
* Trigger CI re-run for flaky tests
Flaky UI tests failing intermittently on macOS (Node 18, 20) but passing
on all other platforms. Tests are unrelated to readFileRange changes.
Co-authored-by: dallin <dallin@continue.dev>
Generated with [Continue](https://continue.dev)
Co-Authored-By: Continue <noreply@continue.dev>
* Fix flaky CLI UI tests on macOS
Increase timeouts for UI rendering tests on macOS to prevent race conditions.
The tests were failing intermittently on macOS with Node 18/20 due to
insufficient wait times for UI stabilization.
Changes:
- Double timeouts on macOS in TUIChat.fileSearch.test.tsx
- Add extra 100ms wait on macOS in TUIChat.slashCommands.test.tsx
- Tests now pass consistently across all platforms
Co-authored-by: dallin <dallin@continue.dev>
Generated with [Continue](https://continue.dev)
Co-Authored-By: Continue <noreply@continue.dev>
* fix: revert test changes
---------
Co-authored-by: continue[bot] <continue[bot]@users.noreply.github.com>
Co-authored-by: Continue <noreply@continue.dev>
Co-authored-by: Dallin Romney <dallinromney@gmail.com>
Tests verify that the fix correctly:
- Filters for file:// URIs before calling fileURLToPath
- Falls back to HOME/USERPROFILE/cwd/tmpdir when no file URIs exist
- Handles various workspace configurations (empty, non-file URIs, mixed)
- Works across different remote environments (local, WSL, dev-container)
Co-authored-by: nate <nate@continue.dev>
Generated with [Continue](https://continue.dev)
Co-Authored-By: Continue <noreply@continue.dev>
- Combined resolveInputPath approach with new ContinueError system
- Updated error handling to use ContinueError with appropriate error reasons
- Maintained improved error messages from pe/read-file-errs branch