Skip to content

Commit 67dd4a4

Browse files
KJ7LNWEric Wheelerellipsis-dev[bot]
authored
docs: add known shell integration issues (#70)
* docs: add known shell integration issues Document two major shell integration issues: - Ctrl+C behavior breaking command capture with example and workaround - Multi-line command output issues with phantom text examples Include clear reproduction steps and workarounds for both issues. Signed-off-by: Eric Wheeler <[email protected]> * Update docs/troubleshooting/shell-integration.md fix dup Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * Update docs/troubleshooting/shell-integration.md fix grammar Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * docs: add memory leak crash issue Document potential memory leak in shell integration that can cause VSCode to crash and close all windows unexpectedly. Note that it typically only occurs after gigabytes of terminal output. Signed-off-by: Eric Wheeler <[email protected]> * docs: add PowerShell execution policy step Add a required step for Windows users to configure PowerShell execution policy before shell integration will work. Include link to detailed instructions in the Understanding PowerShell Execution Policies section. Signed-off-by: Eric Wheeler <[email protected]> * docs: add PowerShell command output issues to known issues Document two critical PowerShell command execution issues: - Output buffering causing missing/truncated output - Duplicate command execution bug Include workarounds implemented in PR #1585 Signed-off-by: Eric Wheeler <[email protected]> * docs: add getting started section to shell integration guide Reorganize shell integration documentation to provide quick setup steps at the top: - Add Getting Started section before technical details - Include quick setup steps for all users, Windows, and WSL - Improve WSL instructions with clearer method descriptions - Add note about shell integration timeout with large rc files Signed-off-by: Eric Wheeler <[email protected]> --------- Signed-off-by: Eric Wheeler <[email protected]> Co-authored-by: Eric Wheeler <[email protected]> Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
1 parent 6ddcda4 commit 67dd4a4

File tree

1 file changed

+124
-2
lines changed

1 file changed

+124
-2
lines changed

docs/troubleshooting/shell-integration.md

Lines changed: 124 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,40 @@
44

55
Shell integration is a [new feature in VSCode 1.93](https://code.visualstudio.com/updates/v1_93#_terminal-shell-integration-api) that allows extensions like Roo Code to run commands in your terminal and read their output. Command output allows Roo Code to react to the result of the command on its own, without you having to handhold by copy-pasting the output in yourself. It's also quite powerful when running development servers as it allows Roo Code to fix errors as the server logs them.
66

7+
## Getting Started with Shell Integration
8+
9+
If you're seeing "Shell Integration Unavailable" messages or Roo Code can't see command output, follow these quick steps:
10+
11+
### For All Users
12+
13+
1. **Update VSCode/Cursor** to the latest version
14+
2. **Select a supported shell**: Open Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`) → "Terminal: Select Default Profile" → Choose bash, zsh, PowerShell, or fish
15+
16+
### For Windows Users
17+
18+
**PowerShell users**: Set execution policy to RemoteSigned:
19+
```powershell
20+
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
21+
```
22+
Then **Restart VSCode completely**
23+
24+
### For WSL Users
25+
26+
1. **Running VSCode From _Inside_ WSL**: Run `code .` or `code-insiders .` from your WSL terminal
27+
2. **Running VSCode From Windows with WSL Terminal**: Install WSL extension and add to your `~/.bashrc`:
28+
```bash
29+
. "$(code --locate-shell-integration-path bash)"
30+
```
31+
or
32+
```bash
33+
. "$(code-insiders --locate-shell-integration-path bash)"
34+
```
35+
36+
Notice: if you have a very large `.bash_profile` or `.bashrc` then you might want to put the code/code-insiders script sourcing toward the top so that shell integration does not time out.
37+
38+
If you're still having issues after these steps, see the detailed troubleshooting sections below.
39+
40+
741
## How Shell Integration Works
842

943
Shell integration uses special terminal sequences (like ANSI escape codes) to mark different stages of command execution in your terminal. Here's how it works:
@@ -80,7 +114,11 @@ First, make sure you're using the latest version of VSCode or Cursor:
80114
3. Type "Terminal: Select Default Profile" and choose it
81115
4. Select one of the supported shells: zsh, bash, fish, or PowerShell.
82116

83-
### Step 3: Restart VSCode
117+
### Step 3: Configure PowerShell Execution Policy (Windows)
118+
119+
Windows users **must** configure PowerShell execution policy before shell integration will work. Follow the instructions in the [Understanding PowerShell Execution Policies](#understanding-powershell-execution-policies) section to set up `RemoteSigned` policy, or another policy that works for you and meets your security requirements.
120+
121+
### Step 4: Restart VSCode
84122

85123
After making these changes:
86124

@@ -290,7 +328,71 @@ This often resolves temporary shell integration issues. However, if you experien
290328

291329
This will help us investigate and fix the underlying issue.
292330

293-
## Known Issues
331+
## Known Upstream VSCode Shell Integration Issues
332+
333+
See also: https://github.com/microsoft/vscode/issues/237208
334+
335+
### Ctrl+C Behavior Breaking Command Capture
336+
337+
When shell integration believes there is a command that should be cancelled before running the requested command, the `^C` behavior breaks capture of the subsequent command output. Only `\x1B]633;C\x07` is received, with no actual command output.
338+
339+
To reproduce:
340+
1. Run any command
341+
2. Type text in terminal (making shell integration think `^C` is needed)
342+
3. Run another command - output will not be captured
343+
344+
Example:
345+
```
346+
~]$ echo a # first command works
347+
a
348+
~]$ <type anything here but do not press enter; VSCE will send control-c> ^C
349+
~]$ echo a
350+
a
351+
```
352+
353+
The second `echo a` command produces no output in shell integration (only `\x1B]633;C\x07` is received) even though the terminal shows the output.
354+
355+
**Work-around to avoid this issue:** Always ensure your terminal prompt is clean (no partial commands or text) before letting Roo run commands. This prevents shell integration from thinking it needs to send a Ctrl+C.
356+
357+
358+
### Multi-line Command Output Issues
359+
360+
Multi-line commands can produce unexpected behavior with shell integration escape codes:
361+
362+
1. First command execution works correctly
363+
2. Second execution produces phantom/partial output from previous command
364+
3. Terminal displays spurious text unrelated to actual command output
365+
366+
This occurs with:
367+
- Commands preceded by comments
368+
- Invalid commands followed by valid ones
369+
- Multiple valid commands in sequence
370+
371+
The issue appears when two non-empty lines are passed to shell integration.
372+
373+
If your AI model attempt to execute following two-line command:
374+
375+
```sh
376+
# Get information about the commit
377+
echo "Commit where version change was detected:"
378+
```
379+
380+
it will produce phantom output:
381+
382+
```
383+
]$ # Get information about the commit
384+
hange was detected:"
385+
]$ echo "Commit where version change was detected:"
386+
Commit where version change was detected:
387+
```
388+
389+
The second invocation shows phantom text `hange was detected:"` that was not part of the actual command output.
390+
391+
**Work-around:** If your model attempts this make sure you provide system instructions to ensure that it does not split commands across multiple lines, command should be chained like `echo a && echo b` and not as:
392+
```sh
393+
echo a
394+
echo b # because this one will not provide output.
395+
```
294396

295397
### Incomplete Terminal Output
296398

@@ -304,6 +406,26 @@ If you experience this issue, try:
304406
2. Running the command again
305407
3. If the problem persists, you may need to manually copy-paste relevant output to Roo Code
306408

409+
### Memory Leak Leading to VSCode Crashes
410+
411+
There is a potential memory leak in the upstream shell integration that can cause VSCode to crash unexpectedly. When this occurs, VSCode and all related windows will close completely without warning.
412+
413+
**Work-around:** there is no known workaround, but I do not hit this problem until gigabytes of terminal output, so it may not affect you.
414+
415+
### PowerShell Command Output Issues
416+
417+
PowerShell in Windows environments has two critical command execution issues:
418+
1. Output buffering: PowerShell may emit the ]633;D completion marker before command output is fully processed by VSCE, resulting in missing or truncated output
419+
2. Duplicate command bug: PowerShell fails to execute identical subsequent commands, treating them as duplicates even when they should run independently
420+
421+
These issues affect command execution reliability in Windows environments using PowerShell.
422+
423+
**Work-around:** Roo Code automatically handles both issues when [PR #1585](https://github.com/RooVetGit/Roo-Code/pull/1585) is merged by:
424+
- Adding a 150ms delay after command execution to ensure output capture
425+
- Appending a unique counter to each command to prevent duplicate command issues
426+
427+
See [#1585](https://github.com/RooVetGit/Roo-Code/pull/1585) for implementation details.
428+
307429
## Troubleshooting Resources
308430

309431
- [VSCode Terminal Output Issue #237208](https://github.com/microsoft/vscode/issues/237208): Tracking the incomplete terminal output capture issue (ongoing as of March 8, 2025)

0 commit comments

Comments
 (0)