Skip to content

sessions: close side pane on last tab close when multiple chats are shown - #342117

Merged
Sandeep Somavarapu (sandy081) merged 5 commits into
mainfrom
sandy081/agents/report-investigation-chat-mode-issue
Oct 16, 2026
Merged

Sandeep Somavarapu (sandy081) merged 5 commits into
mainfrom
sandy081/agents/report-investigation-chat-mode-issue

Conversation

@sandy081

Copy link
Copy Markdown
Member

In the Agents window with the per-chat layout (sessions.experimental.layoutScope: "chat"), closing the last editor tab while more than one chat of the same session is shown (for example a split chat group, or a subagent chat next to the main chat) left the side pane open with only the empty group's Add Tab actions. You then had to press Close Editor Area separately.

This regressed in #341141. That PR switched the last-editor-close guards from "multiple sessions visible" to _multipleLayoutOwnersVisible(), which in the chat scope means "multiple chats shown". Chats of the same session share that session's main editor part, so a second chat of the same session has no reason to keep an empty side pane open.

Change: both last-editor-close guards (DesktopExistingSessionStrategy._registerEmptyGroupClose and DesktopDraftSessionStrategy._registerLastEditorClose) check multipleSessionsVisibleObs again. The per-chat ownership introduced in #341141 is unchanged everywhere else (restore, capture, detail sync). Keeping the side pane open when several sessions are visible stays intentional and is still covered by the existing test.

How to test

  1. Set "sessions.experimental.layoutScope": "chat" and reload the Agents window.
  2. Open a session that has two chats, then run Agents: Split Chat Group Right so both chats are shown.
  3. Open Changes (Ctrl+Shift+G) and close the Changes tab.
  4. Before this change, the side pane stays open with the empty group's Add Tab actions. After it, the side pane closes and the chats take the full width.

Validation

  • ./scripts/test.sh --run src/vs/sessions/contrib/layout/test/browser/desktopStrategies.test.ts --run src/vs/sessions/contrib/layout/test/browser/desktopLayoutController.test.ts --run src/vs/sessions/contrib/layout/test/browser/chatLayoutOwnership.test.ts: 235 passing. The new Existing Session multi-chat test failed before the fix and passes after it.
  • npm run typecheck-client: passed.
  • npm run eslint and hygiene on the changed files: passed.
  • Live run of the Agents window from sources using the steps above: reproduced before the fix (side pane stayed open) and confirmed after it (side pane closes).

…hown

Closing the last editor tab while several chats of the same session are shown in the per-chat layout left an empty side pane open. The last-editor-close guards only need to defer to another visible session, since chats of the same session share its main editor part.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 17:16
@sandy081 Sandeep Somavarapu (sandy081) added this to the 1.143.0 milestone Oct 16, 2026
@vs-code-engineering

vs-code-engineering Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

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

Benjamin Christopher Simmonds (@benibenj)

Matched files:

  • src/vs/sessions/contrib/layout/browser/desktop/desktopDraftSessionStrategy.ts
  • src/vs/sessions/contrib/layout/browser/desktop/desktopExistingSessionStrategy.ts
  • src/vs/sessions/contrib/layout/browser/desktop/desktopLayoutStrategy.ts
  • src/vs/sessions/contrib/layout/test/browser/desktopStrategies.test.ts

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: bb42e51d Current: 04cf6f6c

Changed (1)

sessions/chatCompositeBar/MixedStatuses/Light
Before After
before after

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.

🟡 Changes recommended

Both guards regress last-editor closure when another session remains mounted but hidden by maximization.

1 open finding
What changed in this PR

Fixes empty side panes remaining open after the last editor closes when multiple chats share a session in the Agents window.

Changes:

  • Switches both last-editor-close guards to session counts.
  • Adds Existing Session and Quick Chat regression tests.
File Description
src/​vs/​sessions/​contrib/​layout/​test/​browser/​desktopStrategies.test.ts Tests pane closure with multiple chats shown.
src/​vs/​sessions/​contrib/​layout/​browser/​desktop/​desktopExistingSessionStrategy.ts Updates the Existing Session close guard.
src/​vs/​sessions/​contrib/​layout/​browser/​desktop/​desktopDraftSessionStrategy.ts Updates the draft and Quick Chat close guard.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

In the per-chat layout a maximized chat can leave other sessions mounted but not shown; only block the last-editor close when another session's chat is actually shown.

Co-authored-by: Copilot <[email protected]>

@justschen Justin Chen (justschen) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks!

Fixes TS1117 after #341455 and #342128 both added the same shorthand property to the test fixture.

Co-authored-by: Copilot <[email protected]>
Fixes the duplicate-import lint error after #341455 and #342128 both imported from the same module.

Co-authored-by: Copilot <[email protected]>
@sandy081
Sandeep Somavarapu (sandy081) merged commit d3ce6b2 into main Oct 16, 2026
49 checks passed
@sandy081
Sandeep Somavarapu (sandy081) deleted the sandy081/agents/report-investigation-chat-mode-issue branch October 16, 2026 22:48
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.

5 participants