-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Metadata
Metadata
Assignees
Labels
Type
Projects
Status