Skip to content

Terminal tool hangs when shell integration breaks mid-command in rich execute strategy #312853

@meganrogge

Description

@meganrogge

Problem

When the terminal tool uses the rich execute strategy, commands can hang indefinitely if shell integration sequences stop arriving mid-command. This caused 19 out of 45 eval failures (42%) in eval run 24966302375 — and 15 of those 19 tasks passed in the CLI with the same model (gpt-5.4).

Root Cause

In trackIdleOnPrompt() (executeStrategy.ts):

  1. Command starts → terminal data events arrive (command output)
  2. Data arrival cancels the initialFallbackScheduler (the 10s safety net from fix: schedule promptFallbackScheduler immediately in trackIdleOnPrompt #312387)
  3. If a C/D shell integration sequence is detected, state transitions to Executing
  4. In Executing state, promptFallbackScheduler is also cancelled
  5. Shell integration breaks → no A (prompt) sequence ever arrives
  6. Both fallback schedulers are cancelled → the Promise never resolves → permanent hang

The initialFallbackScheduler from #312387 only helps when no data arrives at all. When data arrives but shell integration sequences are incomplete, the hang persists.

Evidence

Every timed-out task in the eval shows this pattern in terminal.log:

20:59:25 [info] Using `rich` execute strategy for command ...
20:59:35 [warning] Shell integration failed to add capabilities within 10 seconds
[nothing for 60 minutes until timeout]
Metric Value
Tasks that timed out in VS Code 19
Same tasks that passed in CLI 15
CLI avg completion time 3-20 min
VS Code active time before hang typically <1 min
Tasks where VS Code never completed a single command 5

Proposed Fix

When shell integration capabilities fail to load within 10 seconds (the warning we already log), downgrade from rich to basic strategy mid-flight. The basic strategy uses data-idle polling rather than shell integration sequences, so it will not hang.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable buginsiders-releasedPatch has been released in VS Code InsidersverifiedVerification succeeded

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions