Repository navigation
feat: shell integration-based terminal output capture for remote environments - #10786
shanevcantwell wants to merge 1 commit into
Conversation
|
Want AI-powered code review for this PR? Get instant analysis, interactive visualizations, and actionable insights. |
There was a problem hiding this comment.
1 issue found across 10 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="core/tools/implementations/runTerminalCommand.vitest.ts">
<violation number="1" location="core/tools/implementations/runTerminalCommand.vitest.ts:273">
P0: Fallback on empty output causes commands to execute twice in remote environments</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
Better now in ssh and wsl-Ubuntu remote. Containers, JetBrains, linux mint, macos use the same code path. Thanks for the patience while I got to the core of the issue. |
f8e9317 to
bccf81f
Compare
RomneyDa
left a comment
There was a problem hiding this comment.
@shanevcantwell I think current implementation would break things for Jetbrains. You could add ide type detection or jetbrains support
Hi Dallin - I completely missed your update here. I'm curious why you think Jetbrains won't go down the same code path as what #10538 fixed. I don't have $700+ to repro tho. I only had the preview subscription. |
|
Analysis strictly from the code: PR #10538 established IDE-agnostic routing — the decision is local vs remote, not IDE type. Both VS Code and JetBrains go through PR #10786 adds a new protocol method (
This is an implementation gap on the JetBrains side, not an architecture problem. The delegation pattern already works — each IDE provides its own native output capture. Adding it to IntelliJIDE.kt follows the same protocol-driven approach that has worked for all prior PRs (#9679, #9740, #10391, etc.). |
|
Would this fix #10542? I'm getting the following error: |
…environments When the extension host runs on Windows with a remote workspace (SSH, WSL, Dev Container), childProcess.spawn executes locally instead of on the remote. The existing fallback used ide.runCommand (sendText) which had no output capture, returning a hardcoded "Command failed" status. This adds a new runCommandWithOutput IDE method that uses VS Code's Shell Integration API (1.93+) to execute commands on remote terminals with full output capture. The method creates an invisible terminal, waits for shell integration to activate, executes via shellIntegration.executeCommand(), and reads output via the async iterable read() API. ANSI color codes are preserved for rendering by the UnifiedTerminal component; only VS Code's internal OSC 633 shell integration markers are stripped. Falls back gracefully to sendText when shell integration is unavailable. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bccf81f to
1f577f2
Compare
|
Rebased onto latest On the JetBrains question: this PR doesn't change JetBrains behavior. The routing from #10538 is IDE-agnostic (local vs. remote), and Given #10542 now has confirmed repros across Remote SSH, WSL, and podman devcontainers, would it be reasonable to land the VS Code path and track JetBrains parity separately? Happy to file that as a follow-up issue. |
|
I'm trying to use this extension with Dev Containers to run models isolated from my host computer in an unprivileged docker container. Unfortunately, Continue extension cannot operate in agent mode with tool calls within a docker vscode devcontainer... |
|
From a devcontainer I compiled this extension and asked my local AI to:
The execution attempt failed with the following error. Build info
Environment
|
|
i have run into the same problem as samrocketman |
|
laffertyryan0#10 looks promising |
|
I tried building this PR. It seems working good but still have an issue: the opened terminal sometimes requires user interaction. In my case, it ran a git diff and then waited for me to terminate the command. Besides that, it sometimes missed the output form remote terminal, not frequent. |
Let me know if you can track down any pattern to that. I dug around for race conditions when submitting this fix, but it sounds like there might be something buried in there still. |
Port continuedev#10786 using shell execution completion events for exit status. Preserve fallback and background execution, add regression tests, and update extension version metadata.
I used Codex to port this PR to a Continue 2.0.0-based fork and tested it in a Linux SSH workspace, with the terminal visible during command execution. There seems to be a race condition between command execution/output capture and Python environment auto-activation. With the following setting, output capture always succeeded in my testing: Longer commands seem more likely to fail, although I’m not certain whether command length is actually a factor. During failures, Python’s activation command appears to be injected alongside the requested command: The same behavior also occurs with true: Could Python’s asynchronous activation command interfere with shell integration’s execution tracking when both extensions send commands to a newly created terminal? These observations are from my adapted port; I haven’t confirmed whether the same issue occurs with this PR on its original base. |
Summary
childProcess.spawnexecutes locally instead of on the remote. The existing fallback usedide.runCommand(sendText) with no output capture, returning a hardcoded "Command failed" status.runCommandWithOutputIDE method using VS Code's Shell Integration API (1.93+) to execute commands on remote terminals with full stdout capture and ANSI color preservation.runCommandWithOutputfalls back tosendTextinternally and the caller reports "Command completed" — no double-execution.How it works
onDidChangeTerminalShellIntegration(10s timeout)shellIntegration.executeCommand(command)execution.read()async iterableUnifiedTerminal'sAnsiRenderersendText, returns empty string (command still executes, just without output capture)Files changed (10)
core/index.d.tsrunCommandWithOutputto IDE interfacecore/config/types.tscore/protocol/ide.tscore/protocol/messenger/messageIde.tscore/protocol/messenger/reverseMessageIde.tsextensions/vscode/src/extension/VsCodeMessenger.tsextensions/vscode/src/VsCodeIde.tsrunCommandWithOutput()+waitForShellIntegration()implementationcore/tools/implementations/runTerminalCommand.tscore/tools/implementations/runTerminalCommand.vitest.tscore/util/filesystem.tsFileSystemIdeTest plan
pwd,echo, Python scripts with ANSI output — green "Command completed" with captured output and rendered colorschildProcess.spawnpath completely unaffected — no changes to that code pathsendTextinternally, reports "Command completed" without double-executingRelated issues
spawn powershell.exe ENOENTin WSL2/Dev Container) — fix: generalize Windows remote detection for terminal commands #10391 partially addressed this by adding theisWindowsHostWithRemoteguard but the fallback had no output captureUnifiedTerminalcomponent (feat: 💄 Unified Terminal #7383)🤖 Generated with Claude Code