fix: remove inline backtick fences from tool instruction prose (#11674)
The system prompt prefix and suffix contained raw triple-backtick
sequences in prose text, producing an odd number of fence markers.
This made it ambiguous for models to distinguish actual tool-call
code fences from inline mentions of the syntax. Remove inline fence
syntax from prose, relying on the adjacent examples to convey the
format.
* fix: coerce MCP tool args to match schema string types
When tool call arguments are parsed via JSON.parse(), string-typed
parameters containing valid JSON (e.g. file content for .json files)
get deeply parsed into objects. Built-in tools handle this via
getStringArg(), but MCP tools with dynamic schemas had no equivalent
fix, causing write_file and similar tools to receive objects instead
of strings.
Add coerceArgsToSchema() that checks the tool's inputSchema and
re-stringifies any values that should be strings before passing
args to the MCP client.
Fixes#8510
* fix: narrow coercion to only objects/arrays, not numbers/booleans
Only re-stringify values that are objects or arrays (the actual
deep-parsing issue). Numbers and booleans passed to a string-typed
parameter are left as-is so they surface as type errors rather than
being silently converted.
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(openai-adapters): map reasoning-delta to reasoning_content
* Fix system-message tool parser for non-terminal tool calls
* Fix duplicate predefined tools in dynamic system-message section
* fix(openai-adapters): fix TS syntax error in vercelStreamConverter test
The `as typeof X & Y` type assertion was ambiguous to the TypeScript
parser without parentheses, causing TS1005 errors across all CI checks.
Simplify to `as any` since this is a test assertion.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: remove unrelated vercelStreamConverter changes
Per reviewer feedback — keeping this PR focused on the
system-message tools parser fix.
* fix: correct test expectations for post-tool-call content preservation
The 'preserves content after a tool call' test incorrectly consumed the
trailing newline and preserved text within the tool-call loop. Adjusted
the loop count from 6 to 4 (actual tool-call deltas) and added explicit
assertions for the trailing newline and preserved content chunks.
The 'mid-message' test was missing an assertion for the newline chunk
emitted between the closing codeblock fence and trailing text.
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: MumuTW <mumu@novel98.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>
Remove all ControlPlaneClient infrastructure, WorkOS auth, managed proxy,
platform profile loading, org policy enforcement, and credits UI.
Config is now fully local — only file-based config.yaml and .env secrets.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fix: harden system message tools instructions and wire toolOverrides to system message path
The system message tools path (used when models don't support native tool
calling) had two issues:
1. Weak format instructions - the prefix/suffix used vague prose that local
models often ignored, reverting to XML or JSON tool call formats from
their training priors. Replaced with explicit numbered rules that
prohibit alternative formats.
2. toolOverrides silently ignored - applyToolOverrides() existed and ran on
the native tools path (in BaseLLM.streamChat), but was never called on
the system message path. Config YAML toolOverrides for disabled and
description had no effect when tools were injected via system message.
Fixed by:
- Strengthening systemMessagePrefix/Suffix in toolCodeblocks framework
- Adding toolOverrides to ModelDescription interface and serialization
- Calling applyToolOverrides() in streamNormalInput before both paths
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
fix: harden system message tools instructions and wire toolOverrides to system message path
The system message tools path (used when models don't support native tool
calling) had two issues:
1. Weak format instructions - the prefix/suffix used vague prose that local
models often ignored, reverting to XML or JSON tool call formats from
their training priors. Replaced with explicit numbered rules that
prohibit alternative formats.
2. toolOverrides silently ignored - applyToolOverrides() existed and ran on
the native tools path (in BaseLLM.streamChat), but was never called on
the system message path. Config YAML toolOverrides for disabled and
description had no effect when tools were injected via system message.
Fixed by:
- Strengthening systemMessagePrefix/Suffix in toolCodeblocks framework
- Adding toolOverrides to ModelDescription interface and serialization
- Calling applyToolOverrides() in streamNormalInput before both paths
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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>
* feat: add tool prompt overrides support in YAML model config
Adds per-model tool prompt overrides under chatOptions in YAML config:
```yaml
models:
- name: my-model
chatOptions:
toolPromptOverrides:
run_terminal_command:
description: "Custom description"
view_diff:
disabled: true
```
This replaces the JSON-only implementation with YAML-only support as
requested by maintainers. The JSON implementation is preserved on the
`feature/tool-prompt-overrides-json` branch for reference.
Changes:
- Add toolOverrideSchema to chatOptionsSchema (packages/config-yaml)
- Add ToolOverride interface and toolPromptOverrides to LLMOptions (core)
- Store and apply overrides in BaseLLM.streamChat()
- Add applyToolOverrides utility with comprehensive tests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(cli): add tool prompt overrides support for CLI parity
Apply toolPromptOverrides from YAML model config in CLI,
ensuring feature parity with VS Code extension.
- Add applyChatCompletionToolOverrides helper for CLI tool format
- Apply overrides in streamChatResponse before LLM calls
- Support description changes and disabling tools
- Add unit tests for override logic
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: package lock update
* ci: retrigger after hub 502
* refactor: rename toolPromptOverrides to toolOverrides
- Rename property across core, config-yaml, and CLI
- Consolidate ToolOverride type to extend ToolOverrideConfig from
config-yaml instead of duplicating 7 fields
- Inline record-to-array conversion to match file patterns
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: retrigger CI (clean run)
* chore: revert gui package-lock to main
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Dallin Romney <dallinromney@gmail.com>
Add type check in safeParseToolCallArgs to handle cases where
toolCall.function.arguments is already an object instead of a JSON string.
This prevents parameter loss and 'argument is required' errors in tool calls.
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>
Handle case where JSON content was parsed into an object by the tool call parser. If the arguments to the tool call are valid JSON (e.g. the model attempts to create a .json file) the earlier call to JSON.parse() will have deeply parsed the returned contents. If that has happened, convert back to string.
Fixes: #8972
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>