Skip to content

RunInTerminalTool: OutputMonitor.detectsInputRequiredPattern fallback regexes false-positive on benign command output, pausing the agent loop #315476

Closed

Description

@ba-work
  • Copilot Chat: 0.47.0 (bundled)
  • VS Code: 1.119.0 (commit 8b640ee)
  • OS: macOS Darwin 25.3.0 arm64
  • Mode: Agent
  • Model: independent (reproduces across all Copilot models)

Summary

In agent mode, the loop pauses on benign terminal output whose final line happens to end with : + space or ? + space. The chat host injects [Terminal {id} notification: command may be waiting for input...] and asks the agent whether to send input, even when the underlying command has already exited 0.

Source: src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.ts.

detectsInputRequiredPattern (~line 671) falls back to two broad regexes when the strict detectsHighConfidenceInputPattern doesn't match:

return [
  /: +$/,
  /\? *(?:\([a-z\s]+\))? +$/i,
].some(e => e.test(cursorLine));

The function's own JSDoc (~line 614) says these "may produce false positives on normal command output, so they should only be used after the terminal has been confirmed idle through normal polling."

_waitForIdle (~line 519) honours that contract and gates the broad-pattern check on recentlyIdle && isActive === true, where recentlyIdle requires multiple consecutive idle polls. _handleIdleState (~line 395) does not — it calls detectsInputRequiredPattern on entering Idle and immediately fires onDidDetectInputNeeded if it returns true.

Common output trips this: git informational lines, docker status columns, build tools printing labelled section headers, anything ending in Status: or Done: . Live trigger rate on this machine: 5/5 on a single multi-step turn. Each pause costs an extra round trip while the agent decides "no input needed" and resumes.

The repo's own tests acknowledge the broadness: outputMonitor.test.ts (~line 497) has cases named "does NOT match bare colon prompts (too broad for fast-path)".

Reproduction

In agent mode, ask the agent to run e.g.:

printf 'Status: ok\n'
git --no-pager log --oneline -5

Observed: synthetic input-needed notification despite exit 0. Expected: agent loop continues.

Suggested fix

Drop the broad fallback from detectsInputRequiredPattern and rely on detectsHighConfidenceInputPattern alone. Genuinely-stuck commands without shell integration are still caught by the 2-minute _handleTimeoutState path, so coverage isn't lost.

Happy to send a PR.

Activity

  1. added
    chat-ext-issue
    on May 9, 2026
  2. added 6 commits that reference this issue on May 9, 2026
    191da21
    c198177
    1367c62
    e712877
    0aae89a
    14ba5fb
  3. removed
    chat-ext-issue
    on May 10, 2026
  4. added
    bug
    chat-terminal-output-monitor
    on May 11, 2026
  5. added
    unreleased
    insiders-released
    and removed
    unreleased
    on May 11, 2026
  6. locked and limited conversation to collaborators on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugchat-terminal-output-monitorinsiders-releasedverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions