microsoft / microsoft/vscode

Terminal from another window's workspace appears in a newly opened window (regression of #133542)

Open
#333,948 1 comment 0 reactions 1 assignee Claimed by @anthonykim1 View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Type: Bug

Two windows open on two different folders end up sharing a single terminal
session. The terminal belonging to window A is rendered inside window B, both
views are attached to the same pty, and closing window B also tears down the
session in window A.

### Steps to Reproduce

1. Open folder A in a window. Start a long-running interactive TUI process in
the integrated terminal (I used a CLI agent; any full-screen TUI that redraws
on SIGWINCH shows the effect clearly).
2. Open folder B in a second window (File > Open Folder, opening in a new window).
3. Look at the terminal panel in the window for folder B.

### Actual

The window for folder B shows the terminal that belongs to folder A. It is not a
copy: it is the same session. Output written by the process in window A appears
in window B, and both panels stay in lockstep.

Two further symptoms follow from the sharing:

- The TUI reflows to the *other* window's width. Window A's terminal is
narrower than window B's, and the process running in window A redraws itself
at window B's column count, so its layout no longer fits the panel it is
actually displayed in. The pty appears to be resized by whichever window
attached most recently.
- Closing window B also kills the terminal in window A. The running process is
interrupted rather than left alone in the window that still exists.

### Expected

Each window has its own terminal sessions, scoped to its own workspace. Opening
a second window does not attach it to the first window's pty, and closing one
window leaves terminals in other open windows running.

### Notes

This looks like a regression of #133542 ("Reattached to the wrong terminal"),
which was fixed for the July 2023 milestone via #186947. The symptom is the same
one described there: a window attaches to a terminal that belongs to a different
window's workspace.

The "closing one window kills another window's shell" half matches #304649. The
PR opened against it, #307472, is still open, so that half is unfixed on current
stable.

Earlier reports of the shared-session symptom, all closed as duplicates of
#133542: #141882, #133602, #167026.

`terminal.integrated.enablePersistentSessions` is at its default of `true` here.

VS Code version: 1.135.0 (08d4889f9ec4a1685d257b9b95de036c8e1ce1e5, x64)
OS version: Windows_NT x64 10.0.26200
Default terminal profile: Command Prompt
terminal.integrated.shellIntegration.enabled: false

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.