fix: schedule promptFallbackScheduler immediately in trackIdleOnPrompt#312387
Merged
meganrogge merged 1 commit intomainfrom Apr 24, 2026
Merged
fix: schedule promptFallbackScheduler immediately in trackIdleOnPrompt#312387meganrogge merged 1 commit intomainfrom
meganrogge merged 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a hang in the terminal chat agent’s execution flow by ensuring the idle/prompt fallback logic in trackIdleOnPrompt can make progress even when the terminal produces zero data events (eg broken shell integration), preventing run_in_terminal from blocking indefinitely.
Changes:
- Schedule
promptFallbackSchedulerimmediately so the prompt fallback can fire without relying ononData. - Add inline documentation explaining why immediate scheduling is necessary (avoid indefinite block when no data events arrive).
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.ts | Arms the prompt-fallback scheduler immediately in trackIdleOnPrompt to avoid indefinite hangs when no terminal data events occur. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 2
When no terminal data events arrive after a command is sent (e.g. shell integration is broken and the command finishes silently or hangs waiting for input), neither the idle scheduler nor the prompt fallback scheduler was ever triggered, causing trackIdleOnPrompt to block forever. This caused run_in_terminal to hang indefinitely in both RichExecuteStrategy and BasicExecuteStrategy, leading to 7 timeout failures (X_AGENT_STILL_RESPONDING) in terminalbench evaluation runs. Fix: add a separate initial fallback timer (10s) that fires only when no data events arrive at all. This is long enough to avoid false early completion for slow-starting commands (e.g. sleep 5), but prevents the infinite hang. Once any data arrives, the initial fallback is canceled and the existing data-driven promptFallbackScheduler (1s) takes over. Behavior summary: - Shell integration works → no change (C sequence sets Executing state, initial fallback guard exits early) - Shell integration broken + data flowing → no change (onData cancels initial fallback, existing debounce logic handles idle detection) - Shell integration broken + no data at all → resolves after ~11s instead of hanging forever Fixes #312384 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9783ec5 to
f01aebc
Compare
anthonykim1
approved these changes
Apr 24, 2026
Contributor
|
This is great, So this would fix "silent" case where shell integration could be broken (and trackIdleOnPrompt is used) + commands that would hang with no output would now resolve after ~11s instead of indefinite hang. |
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.
When no terminal data events arrive after a command is sent (e.g. shell integration is broken and the command finishes silently or hangs waiting for input), neither the idle scheduler nor the prompt fallback scheduler was ever triggered, causing trackIdleOnPrompt to block forever.
This caused run_in_terminal to hang indefinitely in both RichExecuteStrategy and BasicExecuteStrategy, leading to 7 timeout failures (X_AGENT_STILL_RESPONDING) in terminalbench evaluation runs.
Fix: schedule the promptFallbackScheduler immediately so it can fire even without data events. If no data arrives within promptFallbackMs (default 1s), the fallback transitions to PromptAfterExecuting and schedules the idle timer, which resolves ~2s after the last data event (or immediately if none arrived). When data does arrive, the existing onData handler reschedules/cancels as before — no behavior change for the normal path.
Fixes #312384