Skip to content

Fix false-positive input detection causing premature command termination#312392

Merged
meganrogge merged 7 commits intomainfrom
merogge/fix-input-detection-false-positives
Apr 25, 2026
Merged

Fix false-positive input detection causing premature command termination#312392
meganrogge merged 7 commits intomainfrom
merogge/fix-input-detection-false-positives

Conversation

@meganrogge
Copy link
Copy Markdown
Collaborator

@meganrogge meganrogge commented Apr 24, 2026

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.

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>
Copilot AI review requested due to automatic review settings April 24, 2026 16:12
@meganrogge meganrogge self-assigned this Apr 24, 2026
@meganrogge meganrogge added this to the 1.118.0 milestone Apr 24, 2026
@meganrogge meganrogge enabled auto-merge (squash) April 24, 2026 16:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 detectsHighConfidenceInputPattern and switches _waitForIdle to use it as the fast-path.
  • Keeps broader heuristics (bare : / ? with trailing space) in detectsInputRequiredPattern, 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

@meganrogge meganrogge requested a review from anthonykim1 April 24, 2026 16:31
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>
@meganrogge meganrogge disabled auto-merge April 24, 2026 16:36
@meganrogge meganrogge enabled auto-merge (squash) April 24, 2026 16:37
@meganrogge meganrogge added the ~requires-eval-assessment Evals will be run and will generate a report upon completion label Apr 24, 2026
@meganrogge meganrogge added ~requires-eval-assessment Evals will be run and will generate a report upon completion and removed ~requires-eval-assessment Evals will be run and will generate a report upon completion labels Apr 25, 2026
@microsoft microsoft deleted a comment from vs-code-engineering Bot Apr 25, 2026
@microsoft microsoft deleted a comment from vs-code-engineering Bot Apr 25, 2026
@vs-code-engineering
Copy link
Copy Markdown
Contributor

⏳ Queued vscode build for cc7e1488394c623edab747daae90552d447c4869 (step 1/2).

@microsoft microsoft deleted a comment from vs-code-engineering Bot Apr 25, 2026
@meganrogge meganrogge merged commit 5886d86 into main Apr 25, 2026
26 checks passed
@meganrogge meganrogge deleted the merogge/fix-input-detection-false-positives branch April 25, 2026 13:15
@meganrogge meganrogge added ~requires-eval-assessment Evals will be run and will generate a report upon completion and removed ~requires-eval-assessment Evals will be run and will generate a report upon completion labels Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants