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) to sendText(command, true)
- Replace
createTerminal() with workbench.action.terminal.new (a VS Code built-in command that is remote-aware) + onDidOpenTerminal event to get the terminal reference
Related
Description
VsCodeIde.runCommand()inextensions/vscode/src/VsCodeIde.tshas 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 executedThe second parameter of
Terminal.sendText()controls whether a newline is appended.falsemeans the command text is typed into the terminal but Enter is never pressed, so the command never executes. Should betrue.Bug 2:
createTerminal()creates local terminals from UI-side extensionsWhen no existing terminal is available to reuse, the code calls:
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 (viaENABLED_FOR_REMOTES). Draft PR #10538 proposes restrictingchildProcess.spawnto local-only environments (since it also runs on the wrong machine for remotes), which routes all remote terminal commands throughrunCommand()— exposing both bugs.Other callers of
runCommand(Ollama/Lemonade helpers, legacy/cmdslash 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
sendText(command, false)tosendText(command, true)createTerminal()withworkbench.action.terminal.new(a VS Code built-in command that is remote-aware) +onDidOpenTerminalevent to get the terminal referenceRelated
childProcess.spawnto local-only (exposes this bug)