Dispose finished background terminals to prevent accumulation#316278
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to dispose of background terminals at the start of each new chat turn so that terminals (which are not reused across turns) don't accumulate. Terminals are preserved if the user has revealed them, if they still have an active execution, or if they are the foreground terminal for the session.
The only change visible in the reviewed diff is the removal of a trailing blank line at the end of the constructor in runInTerminalTool.ts. The substantive turn-start cleanup logic described in the PR is not present in the diff hunks provided for review.
Changes:
- Remove a stray blank line at the end of
RunInTerminalTool's constructor body.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts | Removes a single trailing blank line before the closing brace of the constructor. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
8c4708d to
58a8389
Compare
58a8389 to
f6f7c53
Compare
f6f7c53 to
8b797de
Compare
When a new chat request is submitted, clean up background terminals that have completed their execution and are still hidden from the user. This prevents terminal accumulation across turns since background terminals are not reused. Terminals are preserved if they: - Have been revealed by the user (hideFromUser is false) - Still have an active execution (servers, watchers, etc.) - Are the foreground terminal for the session (reused across turns) Fixes #287177 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
8b797de to
a561e1c
Compare
|
/requires-eval-assessment terminalbench2 gpt-5.4,claude-opus-4.6,claude-opus-4.7 |
|
⏳ Queued vscode build for
|
…otification calls The method signature added a toolSpecificData parameter (5th arg), but 4 tests were still using the old signature, passing the outputMonitor in the toolSpecificData position. This caused: - outputMonitor to be undefined, so input-needed listeners were never set up (tests 1 & 3 got 0 instead of expected counts) - alreadyNotifiedInputNeededOutput string to land in the outputMonitor position, causing 'continueMonitoringAsync is not a function' (test 2) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
⏳ Queued vscode build for
|
The 'should preserve session terminal association after inputNeeded' test was failing because the mock terminalInstance lacked shellLaunchConfig, which is accessed in the onCommandFinished handler. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Queued eval-assessment publish build for
|
|
🔬 Queued eval-assessment benchmark for
Results will be posted back here when the run completes. |
|
✅ Eval-assessment build published.
|
Fixes #287177
Background terminals created by the chat agent tools are never reused once their command completes, but they remain alive indefinitely, accumulating across turns.
This PR disposes background terminals as soon as their command finishes (onCommandFinished), provided the user has not revealed the terminal. Terminal output remains viewable in the chat UI thanks to the output mirror snapshot captured before disposal.
Key changes:
TerminalCommandArtifactCollector.capturebefore disposing, so the progress part can still render output via the snapshot mirror even after the terminal instance is gone.demo.mov