Skip to content

terminal: Ensure terminals persist when outputLocation is terminal#322388

Merged
meganrogge merged 1 commit into
mainfrom
fix-322380-terminal-output-location-persist
Jun 22, 2026
Merged

terminal: Ensure terminals persist when outputLocation is terminal#322388
meganrogge merged 1 commit into
mainfrom
fix-322380-terminal-output-location-persist

Conversation

@meganrogge

Copy link
Copy Markdown
Collaborator

Fixes #322380

What changed

  • Preserve run_in_terminal terminals during chat-session cleanup when chat.tools.terminal.outputLocation is set to terminal
  • Keep associated active executions intact for preserved terminals
  • Add a regression test that verifies terminals are not disposed on session clear when output location is terminal

Why

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)

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>
Copilot AI review requested due to automatic review settings June 22, 2026 15:19
@meganrogge meganrogge self-assigned this Jun 22, 2026
@meganrogge meganrogge added this to the 1.127.0 milestone Jun 22, 2026
@meganrogge meganrogge enabled auto-merge (squash) June 22, 2026 15:21
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@anthonykim1

Matched files:

  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/runInTerminalTool.test.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 onDidDisposeSession cleanup when TerminalChatAgentToolsSettingId.OutputLocation === 'terminal'.
  • Keep _activeExecutions entries 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

@meganrogge meganrogge merged commit b1889b0 into main Jun 22, 2026
29 checks passed
@meganrogge meganrogge deleted the fix-322380-terminal-output-location-persist branch June 22, 2026 17:07
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.

Ensure terminals persist when outputLocation: terminal

3 participants