feat: shell integration-based terminal output capture for remote environments#10786
Open
shanevcantwell wants to merge 1 commit intocontinuedev:mainfrom
Open
feat: shell integration-based terminal output capture for remote environments#10786shanevcantwell wants to merge 1 commit intocontinuedev:mainfrom
shanevcantwell wants to merge 1 commit intocontinuedev:mainfrom
Conversation
|
Want AI-powered code review for this PR? Get instant analysis, interactive visualizations, and actionable insights. |
Contributor
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.
Contributor
Author
|
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. |
…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>
f8e9317 to
bccf81f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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