Roo-Code: Terminal Usage Fails with "VSCE output start escape sequence" Error

Which version of the app are you using?

3.10.5

Which API Provider are you using?

Anthropic

Which Model are you using?

Claude 3.7 Sonnet

What happened?

Every time Roo Code invokes the terminal, it fails to read the output. Instead, it gives an error about “VSCE output start escape sequence”, followed by a suggestion that it might be an “Upstream VSCE Bug?”, and asks the user to use a supported shell. I am already using a supported shell, so this didn’t make sense.

A big clue from “lateral testing” was that Cline didn’t have this issue.

So I spent some time and tokens having AIs analyze the codebase.

The fix, from local testing: remove the sleep of 0.050 seconds (oddly significant!). 😃 This is in src/integrations/terminal/TerminalRegistry.ts; the line to comment out is (indented in the code):

PROMPT_COMMAND: "sleep 0.050",

The error message, which originates from Roo Code itself, was misleading – pointing to an upstream issue when the fix was local.

(Also note, this issue persists across all models and API providers I tested, not just Anthropic’s Claude 3.7 Sonnet.)

Steps to reproduce

  1. Use any model and API provider.
  2. Prompt: “Please run ‘ls’, we’re testing if the terminal works.”
  3. Observe the AI attempt to run ls, and fail with the “VSCE output start escape sequence” error.

Expected Behavior

The terminal command (ls or any other) should execute successfully without errors, as it does in Cline.

Actual Behavior

Roo Code throws the “VSCE output start escape sequence” error and fails to execute the command.

Proposed Fix

Remove the sleep 0.050 delay in the terminal-handling code. This resolves the issue in my testing.

Relevant API REQUEST output


Additional context

This Roo Code instance was running on Arch Linux, in Code OSS version 1.96.4. I have not tested any other platform. I realize that the sleep may have been needed on other platforms. Or, prior to the bug being fixed in VSCE? I saw this in my wandering:

https://github.com/microsoft/vscode/issues/237208

The clue that brought me to this point, today, was: I was thinking, “What is different from my environment, that might impact a terminal?” I had a custom prompt. Having the AI investigate in that direction helped narrow it down.

Thank you so much for providing this wonderful tool!

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 26

Commits related to this issue

Most upvoted comments

Happens to me almost all the time with the latest VS Code Insiders on two different machines.

actionable item: add config option to omit env var

The problem is that if I make the change you are suggesting that it will most certainly break other “supported” versions of vs code, and then we would have to discuss whose version should be supported more, and I do not want to go there for hopefully obvious reasons.

I am now planning a “big terminal fix hammer” (ahem, “compatibility” feature) option that will do lots of different things that really should not be implemented within Roo, because they are almost always upstream code issues or user workarounds specific to their own deployments (eg, shell env settings).

The plan is to try to make Roo as clean as possible without hacking things like the timing delay (and the even worse powershell hack), and then if someone has issues they can turn on the compatibility setting. I am going to reopen the issue, so I remember to address this edge case, but it may take some time for me to get to it.

@hannesrudolph

I am waiting for feedback from @libertyteeth to see if updating to the latest version of VSCode (or VSCode Insiders) solves the problem, because they are running an old version 1.96, which is known to be missing some terminal fixes. I am not yet convinced that this is a bug since the current Roo terminal code is designed to work with the current versions of vscode. also I do not think we can remove that sleep quite yet, at least not until vscode 1.99 is officially released.

@libertyteeth, good sleuthing!

That delay was added after several weeks of troubleshooting and back and forth with VSCE developers working on shell integration. The bug that you referenced is one such discussion, and there were others.

It is interesting that now turning off the delay solves a problem! I would love to remove that line and discontinue the workaround, perhaps that it is no longer necessary.

However, there is a risk that it will introduce regressions in other users. I am hoping I can reproduce the problem exactly and come up with a solution that will still work for everyone else.

Please answer the following questions, so I can get a better picture of what is going on:

  1. you mentioned that you have a custom prompt:
  • if you disable your custom prompt does Roo work properly? (I realize you probably want your custom prompt, and we can work in that direction, but answering this question will help me with troubleshooting)
  • how is your custom prompt configured?
  • is it yours, or a common custom third party prompt that is available to source into your profile (like powerlevel10k)?
  1. what shell are you using (bash zsh ps1 other)
  2. which operating system
  3. exactly which version of vscode (help->about->copy) are you running?

@libertyteeth - Thanks for digging in; there’s quite a storied history behind that sleep.