terminal: Ensure terminals persist when outputLocation is terminal#322388
Merged
Conversation
Preserve run_in_terminal terminals during chat session cleanup when users configured outputLocation=terminal. This keeps terminals available even when they were not promoted to foregroundInstances, and adds a regression test covering session disposal with outputLocation set to terminal. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @anthonykim1Matched files:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates the terminal chat agent “run in terminal” tool’s session-cleanup behavior so that when chat.tools.terminal.outputLocation is set to terminal, the created terminals (and their associated active executions) are preserved instead of being disposed during chat-session cleanup.
Changes:
- Skip disposing session-associated terminals during
onDidDisposeSessioncleanup whenTerminalChatAgentToolsSettingId.OutputLocation === 'terminal'. - Keep
_activeExecutionsentries intact for terminals preserved by the above condition. - Add an electron-browser regression test covering the “preserve terminals on session clear when outputLocation is terminal” scenario.
Show a summary per file
| File | Description |
|---|---|
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts |
Adjusts _cleanupSessionTerminals to preserve terminals (and active executions) when output location is configured as terminal. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/runInTerminalTool.test.ts |
Adds a regression test ensuring terminals are not disposed on session clear when output location is terminal. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
justschen
approved these changes
Jun 22, 2026
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.
Fixes #322380
What changed
run_in_terminalterminals during chat-session cleanup whenchat.tools.terminal.outputLocationis set toterminalterminalWhy
With
outputLocation: terminal, users expect terminals to stay available beyond chat-session cleanup. Previously, hidden terminals could still be disposed when the session was cleared.Validation
npm run typecheck-client./scripts/test.sh --grep "should preserve terminals when output location is terminal" --runGlob "**/runInTerminalTool.test.js"npm run hygiene(reports existing baseline issues outside this change)