Fix false-positive input detection causing premature command termination#312392
Merged
meganrogge merged 7 commits intomainfrom Apr 25, 2026
Merged
Fix false-positive input detection causing premature command termination#312392meganrogge merged 7 commits intomainfrom
meganrogge merged 7 commits intomainfrom
Conversation
Split detectsInputRequiredPattern into two tiers: - detectsHighConfidenceInputPattern: specific patterns (y/n, password, PowerShell options, (END), press any key, parenthesized defaults) that are safe to use as a fast-path in _waitForIdle. - detectsInputRequiredPattern: includes broader heuristics (bare ':' and '?' with trailing space) that should only be checked after the terminal has been confirmed idle through normal polling. The broad patterns (especially /: +$/ and /\? +$/) were triggering false positives on normal command output (build logs, headers ending with ':') when used in _waitForIdle's fast-path. This caused the foreground execution race to resolve prematurely via onDidDetectInputNeeded, making the agent think commands needed interactive input when they were still running normally. This regression was introduced in PR #308587 (Apr 9) which wired these regexes into onDidDetectInputNeeded for the foreground execution race, and benchmarks started regressing on Apr 13. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses false-positive terminal input prompt detection that could prematurely terminate foreground command monitoring by splitting input detection into a high-confidence fast-path vs broader heuristics evaluated only after idle is established.
Changes:
- Introduces
detectsHighConfidenceInputPatternand switches_waitForIdleto use it as the fast-path. - Keeps broader heuristics (bare
:/?with trailing space) indetectsInputRequiredPattern, intended for post-idle evaluation only. - Adds a dedicated test suite for
detectsHighConfidenceInputPattern.
Show a summary per file
| File | Description |
|---|---|
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.ts |
Splits input detection into high-confidence vs full heuristic set; updates _waitForIdle to avoid broad-pattern false positives. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/outputMonitor.test.ts |
Adds unit tests covering the new high-confidence detector behavior. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
When execution.isActive() reports true (e.g. task-backed executions), _waitForIdle now checks detectsInputRequiredPattern (the broader heuristics) once the terminal has been idle for consecutive poll cycles. This prevents prompts like 'Enter your name: ' from timing out when the execution stays active, while still avoiding false positives during active output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
roblourens
approved these changes
Apr 24, 2026
rzhao271
approved these changes
Apr 24, 2026
Contributor
|
⏳ Queued vscode build for
|
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.
Split detectsInputRequiredPattern into two tiers:
detectsHighConfidenceInputPattern: specific patterns (y/n, password, PowerShell options, (END), press any key, parenthesized defaults) that are safe to use as a fast-path in _waitForIdle.
detectsInputRequiredPattern: includes broader heuristics (bare ':' and '?' with trailing space) that should only be checked after the terminal has been confirmed idle through normal polling.
The broad patterns (especially /: +$/ and /? +$/) were triggering false positives on normal command output (build logs, headers ending with ':') when used in _waitForIdle's fast-path. This caused the foreground execution race to resolve prematurely via onDidDetectInputNeeded, making the agent think commands needed interactive input when they were still running normally.
This regression was introduced in PR #308587 (Apr 9) which wired these regexes into onDidDetectInputNeeded for the foreground execution race.