Repository navigation
Description
Description
VsCodeIde.runCommand() in extensions/vscode/src/VsCodeIde.ts has two bugs that prevent it from executing commands in remote environments (SSH, Dev Container, Codespaces, etc.):
Bug 1: sendText(command, false) — command typed but never executed
terminal.sendText(command, false);The second parameter of Terminal.sendText() controls whether a newline is appended. false means the command text is typed into the terminal but Enter is never pressed, so the command never executes. Should be true.
Bug 2: createTerminal() creates local terminals from UI-side extensions
When no existing terminal is available to reuse, the code calls:
terminal = vscode.window.createTerminal(options?.terminalName);With extensionKind: ["ui", "workspace"], the extension host runs on the local machine. createTerminal() from the local extension host creates a local terminal, not a remote one. For SSH/DevContainer connections, this means the terminal opens on the wrong machine.
Impact
These bugs were latent because the terminal tool's primary code path used childProcess.spawn() for most remote types (via ENABLED_FOR_REMOTES). Draft PR #10538 proposes restricting childProcess.spawn to local-only environments (since it also runs on the wrong machine for remotes), which routes all remote terminal commands through runCommand() — exposing both bugs.
Other callers of runCommand (Ollama/Lemonade helpers, legacy /cmd slash command) are also affected.
Observed behavior
Tested with SSH loopback on Linux. Terminal panel shows empty — command is not executed in the remote terminal.
Proposed fix
- Change
sendText(command, false)tosendText(command, true) - Replace
createTerminal()withworkbench.action.terminal.new(a VS Code built-in command that is remote-aware) +onDidOpenTerminalevent to get the terminal reference
Related
- Draft PR fix: restrict terminal childProcess.spawn to local-only environments #10538 — restricts
childProcess.spawnto local-only (exposes this bug) - Issue run_terminal_command fails with "spawn powershell.exe ENOENT" via SSH Remote from Windows #10462 — terminal tool fails on SSH remotes (upstream symptom)
- Issue runTerminalCommand fails with "spawn powershell.exe ENOENT" when VS Code on Windows host connects to WSL2/Dev Container - Continue extension ignores container environment #10007 — terminal tool fails on remote environments
Activity
jamblejoe commentedon Apr 23, 2026
is this related #7636 (comment)?
shanevcantwell commentedon Apr 23, 2026
Yes, same root cause at different layers. Both stem from VS Code terminal APIs not working correctly for remote terminals when the extension runs on the local host.
#7636 is about output capture failing (onDidReadText doesn't fire). #10542 is about command execution failing (sendText never presses Enter, createTerminal creates a local terminal).
PR #10786 attempts to fix both by using shell integration for output capture and workbench.action.terminal.new (which is remote-aware) instead of createTerminal. Both bugs remain unfixed currently.
zwancho commentedon May 7, 2026
I can reproduce this issue consistently with VS Code Remote SSH on Ubuntu 20.04.
The command is only inserted into the terminal input buffer but never actually executes.
Example terminal state after asking Agent to run
pwd:The cursor remains at the end of the line and no Enter/Return is sent.
Continue still reports:
but no process actually starts.
mujtahid-akon commentedon May 7, 2026
Any timeline for a fix?
cliis working fine but the chat mode is still failing as others said above.karypid commentedon Jul 5, 2026
I am running a podman dev container in Linux and getting this same problem. The inline terminal box reads:
And in the chat response the model thinks:
limpidautumn commentedon Jul 12, 2026
I encountered the same issue when connecting to WSL remotely: the Agent interface indicated "Command Executed," but the returned result was:
At the same time, a command was entered into the built-in terminal, but it was not executed.
shanevcantwell commentedon Jul 12, 2026
Note that if you're up to it, and need this working today rather than waiting on review:
gh pr checkout 10786, build the extension, and load the VSIX. That path has the output capture the merged fixes don't yet.limpidautumn commentedon Jul 13, 2026
Thanks for the heads-up, I'll try it now.
shanevcantwell commentedon Jul 13, 2026
Nice - do let me and the thread know whether it solves the problem for you.
brakubraku commentedon Jul 27, 2026
can we get this fix merged finally? what is the timeline?
fletort commentedon Oct 21, 2026
ANy update on this ?
shanevcantwell commentedon Oct 21, 2026
Yeah, actually spotted the inconsistency. I'll see if I can get my open PR updated.
Some cross-indexing below:
Related implementation paths — important for custom VSIX builds
The root cause goes beyond
sendText(command, false). Continue's preference for the local VS Code UI extension host creates a boundary between the process executing Continue and the remote workspace where its tools must operate.#10786 — Shell Integration with remote output capture (February 24)
Introduces
IDE.runCommandWithOutput()across the IDE protocol, using VS Code Shell Integration to execute remote commands and return their output to the agent.This is the branch I've tested with SSH and WSL and previously recommended to users willing to build a custom VSIX. It addresses remote execution and output capture for the agent terminal-tool path. It does not replace the original
VsCodeIde.runCommand()for other callers.The implementation remains unmerged. Recent community testing reported occasional hangs and missed output, so those edge cases still warrant investigation.
#12063 — Remote-aware terminal creation (April 7)
Fixes
VsCodeIde.runCommand()using remote-aware terminal creation and newline submission. This repairs command submission for its callers, but does not capture and return output to the agent.#13243 — Newline-only fix (September 7)
Corrects the missing Enter key. Does not address remote terminal creation or output capture.
These PRs are not interchangeable. In particular, successful command submission does not establish successful agent tool execution with captured results.
For users evaluating an unmerged PR checkout, #10786 provides the more complete agent terminal-tool implementation, subject to its outstanding limitations. The other PRs address narrower parts of the original issue.