microsoft / microsoft/vscode

Terminal OutputMonitor may report "needs input" for long-running commands that continuously produce output

Open
#330,790 1 comment 0 reactions 1 assignee Claimed by @meganrogge View on GitHub
chat-terminal confirmation-pending
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Type: Bug

# Terminal OutputMonitor may report "needs input" for long-running commands that continuously produce output

### Description

I observed that a long-running command which continuously updates terminal output can eventually cause the agent to show a notification similar to:

`bash ... may need input`

even though the command does not require any user input and continues running normally.

I originally observed this with a long-running Python task using `tqdm`. The progress bar continuously redraws the current terminal line.

Interestingly, long-running commands that produce no terminal output do not appear to trigger the same notification.

### Steps to reproduce

1. Ask the agent to run a long-running Python command that continuously updates terminal output.

For example:

```python
import time

for i in range(3000):
print(f"\rprogress: {i}", end="", flush=True)
time.sleep(0.1)
```

2. Let the command continue running for several minutes.

3. Do not provide any terminal input.

4. Observe whether the agent eventually reports that the `bash` command may need input, despite the process continuing to make progress and never reading from stdin.

A real-world example where I observed this behavior is a long-running Python task using `tqdm`.

### Expected behavior

A process that continuously produces output and has no detected interactive prompt should not be reported as needing input solely because it has been running for a long time.

Continuous progress output should normally be evidence that the process is still working, rather than evidence that it is blocked waiting for stdin.

### Actual behavior

The agent may report:

`bash ... may need input`

while the process is still actively producing progress output and does not require user interaction.

### Possible cause

**Disclosure:** The source-code analysis in this section was prepared with AI assistance. The user-visible behavior described above is based on my own observation.

The AI-assisted analysis suggests that this may be related to the terminal `OutputMonitor` state machine in:

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

The monitor attempts to detect when terminal output becomes idle. Continuously updating output, such as a `tqdm` progress bar, can prevent it from reaching a stable idle state.

There is also an extended polling timeout path which, after the extended polling period expires while the process is still running, can signal `onDidDetectInputNeeded` so that the agent can inspect the terminal for an unrecognized interactive prompt.

Conceptually, this appears to map:

```text
monitor could not reach idle before timeout
```

to:

```text
input may be needed
```

These conditions do not appear equivalent.

A process continuously producing changing output is generally evidence that it is still actively running. It does not by itself indicate that the process is blocked waiting for stdin.

### Relation to #312148

This appears related to, but potentially different from, #312148.

#312148 addressed false `needs input` notifications caused by prompt-detection patterns matching ordinary streaming output, such as normal output ending with `:` or `?`.

The behavior described here may not require a prompt-detection pattern to match. The suspected false positive is instead the extended polling timeout itself being represented as `inputNeeded`.

### Suggested behavior

When extended monitoring times out without positive evidence of an interactive prompt, it might be better to:

* report the command as still running, or
* stop this monitoring cycle and continue waiting for normal completion, or
* only emit `inputNeeded` when there is actual prompt-related evidence.

In particular, continuously receiving new terminal output should probably reduce, rather than increase, confidence that the process is blocked waiting for user input.

VS Code version: Code 1.133.0 (a5b500951314efd502d07465bd138dfbd714a960, 2026-08-11T22:14:08Z)
OS version: Windows_NT x64 10.0.26200
Modes:
Remote OS version: Linux x64 6.6.114.1-microsoft-standard-WSL2
Remote OS version: Linux x64 5.15.0-97-generic

System Info

|Item|Value|
|---|---|
|CPUs|13th Gen Intel(R) Core(TM) i9-13900HX (32 x 2419)|
|GPU Status|2d_canvas: enabled
GPU0: VENDOR= 0x8086, DEVICE=0xa788 [Intel(R) UHD Graphics], DRIVER_VENDOR=Intel, DRIVER_VERSION=32.0.101.6733 *ACTIVE*
GPU1: VENDOR= 0x10de, DEVICE=0x28e0 [NVIDIA GeForce RTX 4060 Laptop GPU], DRIVER_VERSION=32.0.16.1074
GPU2: VENDOR= 0x10de, DEVICE=0x28e0 [NVIDIA GeForce RTX 4060 Laptop GPU], DRIVER_VERSION=32.0.16.1074
GPU3: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.8972
Machine model name:
Machine model version:
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgpu: enabled
webnn: disabled_off|
|Load (avg)|undefined|
|Memory (System)|15.75GB (2.41GB free)|
|Process Argv|--crash-reporter-id 696ce6cc-3656-4c03-be79-b2900c01cf11|
|Screen Reader|no|
|VM|40%|

|Item|Value|
|---|---|
|Remote|WSL: Ubuntu|
|OS|Linux x64 6.6.114.1-microsoft-standard-WSL2|
|CPUs|13th Gen Intel(R) Core(TM) i9-13900HX (32 x 0)|
|Memory (System)|7.62GB (3.71GB free)|
|VM|0%|

|Item|Value|
|---|---|
|Remote|SSH: v2xr|
|OS|Linux x64 5.15.0-97-generic|
|CPUs|Intel(R) Xeon(R) Gold 6430 (128 x 1337)|
|Memory (System)|1007.52GB (853.09GB free)|
|VM|0%|
Extensions (26)

Name|Identifier|Author|Version
---|---|---|---
GitHub 存储库|github.remotehub|GitHub|0.64.0
Jupyter Keymap|ms-toolsai.jupyter-keymap|ms-toolsai|1.1.2
Remote - SSH|ms-vscode-remote.remote-ssh|ms-vscode-remote|0.124.0
Remote - SSH: Editing Configuration Files|ms-vscode-remote.remote-ssh-edit|ms-vscode-remote|0.87.0
WSL|ms-vscode-remote.remote-wsl|ms-vscode-remote|0.104.3
远程资源管理器|ms-vscode.remote-explorer|ms-vscode|0.5.0
远程存储库|ms-vscode.remote-repositories|ms-vscode|0.42.0
LaTeX Workshop|james-yu.latex-workshop|James-Yu|10.18.0
Rainbow CSV|mechatroner.rainbow-csv|mechatroner|3.24.1
Chinese (Simplified) (简体中文) Language Pack for Visual Studio Code|ms-ceintl.vscode-language-pack-zh-hans|MS-CEINTL|1.131.2026072717
Black Formatter|ms-python.black-formatter|ms-python|2026.6.0
Python Debugger|ms-python.debugpy|ms-python|2026.6.0
Python|ms-python.python|ms-python|2026.4.0
Pylance|ms-python.vscode-pylance|ms-python|2026.3.1
Data Wrangler|ms-toolsai.datawrangler|ms-toolsai|1.24.2
Jupyter|ms-toolsai.jupyter|ms-toolsai|2025.9.1
Jupyter Keymap|ms-toolsai.jupyter-keymap|ms-toolsai|1.1.2
Jupyter Notebook Renderers|ms-toolsai.jupyter-renderers|ms-toolsai|1.3.0
Jupyter Cell Tags|ms-toolsai.vscode-jupyter-cell-tags|ms-toolsai|0.1.9
Jupyter Slide Show|ms-toolsai.vscode-jupyter-slideshow|ms-toolsai|0.1.6
JetBrains Mono. A typeface for developers​_|narasimapandiyan.jetbrainsmono|NarasimaPandiyan|1.0.4
SFTP|natizyskunk.sftp|Natizyskunk|1.16.3
Codex – OpenAI’s coding agent|openai.chatgpt|openai|26.810.41047
vscode-pydata-viewer|percy.vscode-pydata-viewer|Percy|0.0.15
PyTorch Structure Viewer|pth-viewer.pth-viewer|pth-viewer|0.0.12
AI Chat Models|vicanent.gcmp|vicanent|0.26.33

A/B Experiments

```
vsliv368:30146709
pythonvspyt551cf:31249601
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
envsactivate1:31551504
cloudbuttont:31379625
3efgi100_wstrepl:31403338
ec5jj548:31422691
cp_cls_t_966_ss:31526232
4je02754:31466945
8hhj4413:31478653
cp_cls_t_1081:31454832
conptydll_true:31498968
e9c30283:31461165
test_treatment2:31471001
46204921:31447328
capico_a_098a3278:31555650
ei9d7968:31496641
nes-extended-on:31455476
chat:31457767
8hig5102:31480529
89g7j272:31518289
i2gc6536:31499202
52612955:31516516
ghj88844:31499326
h08i8180_copy:31475368
23c7c724:31520045
ddid_c:31478207
hmra_i5g22:31518061
7df3h592:31512476
cp_cls_t_1082:31535311
logging_enabled_new:31498466
j0d79568:31499440
jb_cp_cls_t_632:31543129
56dj4588:31512888
32d76977:31512328
ha629193:31508444
cdk-lw-on:31524445
a1ije391_t:31540920
jbcp_cls_pctr_t:31531130
61138546:31518536
cp_intellij_t_nes:31548657
jf4hg949:31526829
ahp-both-windows:31556933
sessions_5:31532894
ihg5j128:31534457
f412h606:31551416
9gg7f176:31542112
nes-ex-cf-euporie-03:31542868
enable_editor_pane_layout:31566296
allow-none:31555437
6i51c363:31551401
36h42362:31564511
c7c27ce7:31554789
1h923230:31564177
0dg73464:31554319
treatment-23-1:31555779
unuse_dynamic_mcp:31555281
0c1h4866:31566224
session-archive:31558132
5b8j3302:31564601

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.