Skip to content

sessions: scope the side-pane collapse marker to the collapsed session#323360

Merged
sandy081 merged 2 commits into
mainfrom
sandy081/ccr-scope-collapse-marker
Jun 28, 2026
Merged

sessions: scope the side-pane collapse marker to the collapsed session#323360
sandy081 merged 2 commits into
mainfrom
sandy081/ccr-scope-collapse-marker

Conversation

@sandy081

Copy link
Copy Markdown
Member

What

Follow-up to #323345 addressing two Copilot Code Review comments. The previous change derived the per-session auxiliaryBarHiddenByCollapse marker from a controller-global _sidePaneToggledClosed flag that was read at arbitrary save-time capture points. That was leaky:

  • It required resetting the flag on session switch, which broke the flag invariant ("true while the side pane is collapsed") (CCR comment 1).
  • It could still clobber an explicit aux-bar hide on a different session — if the flag was set while capturing a session that had explicitly hidden just the aux bar, that hide was turned into a collapse, causing it to wrongly re-reveal on Changes open (CCR comment 2).

How

  • Record the collapse marker for the active session directly in _onSidePaneToggled — at the moment the collapse happens, scoped to the session it happened on. For a created session, a collapse writes its view state with auxiliaryBarHiddenByCollapse: true; an expand writes { auxiliaryBarVisible: true }.
  • _captureViewState now only preserves an existing marker while the aux bar stays hidden, and never fabricates one from a global flag. An explicit aux-bar hide (no prior marker) therefore stays explicit.
  • The global _sidePaneToggledClosed flag is no longer read anywhere, so it (and the session-switch / aux-bar-change resets that maintained it) is removed.

Net effect is identical user-facing behavior for the original fix (reload + open Changes after collapsing re-reveals the side pane), but the collapse marker can no longer leak across sessions.

Notes for reviewers

  • Behavior verified by the existing two [D9] reload tests, plus a new regression test: [D9] does not turn an explicit aux-bar hide into a collapse when another session is collapsed (verified it fails if _captureViewState fabricates the marker).
  • Spec desktopSessionLayoutController.md (D9/D9b) updated to describe the scoped marker.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Address Copilot code review on #323345: deriving auxiliaryBarHiddenByCollapse
from a controller-global _sidePaneToggledClosed flag read at arbitrary capture
times was leaky. It required resetting the flag on session switch (breaking the
documented invariant) and could still clobber an explicit aux-bar hide on a
different session, turning it into a collapse.

Record the collapse marker for the active session directly in _onSidePaneToggled
(where the collapse actually happens), and have _captureViewState only preserve
an existing marker while the aux bar stays hidden — never fabricate one. The
global flag is no longer read anywhere, so remove it along with the
session-switch and aux-bar-change resets.

Add a regression test asserting an explicit aux-bar hide is not turned into a
collapse when another session is collapsed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 28, 2026 19:58
@sandy081 sandy081 self-assigned this Jun 28, 2026
@sandy081 sandy081 enabled auto-merge (squash) June 28, 2026 19:58
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

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

@benibenj

Matched files:

  • src/vs/sessions/contrib/layout/browser/baseSessionLayoutController.ts
  • src/vs/sessions/contrib/layout/browser/desktopSessionLayoutController.md
  • src/vs/sessions/contrib/layout/browser/desktopSessionLayoutController.ts
  • src/vs/sessions/contrib/layout/test/browser/desktopSessionLayoutController.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 PR refines per-session side-pane state tracking in the Agents window desktop layout controller so the auxiliaryBarHiddenByCollapse marker is recorded only for the session that was actually collapsed, preventing the marker from leaking across sessions. It also adds a regression test and updates the spec to reflect the scoped behavior.

Changes:

  • Record collapse/expand markers directly in _onSidePaneToggled for the active session, and update _captureViewState to preserve (not fabricate) an existing collapse marker.
  • Remove the controller-global _sidePaneToggledClosed flag from the base controller and its associated resets.
  • Add a regression unit test and update desktopSessionLayoutController.md to document the scoped collapse marker behavior.
Show a summary per file
File Description
src/vs/sessions/contrib/layout/test/browser/desktopSessionLayoutController.test.ts Adds regression coverage ensuring a collapse marker does not leak across sessions and convert an explicit aux-bar hide into a collapse.
src/vs/sessions/contrib/layout/browser/desktopSessionLayoutController.ts Moves collapse-marker recording to the toggle hook and changes save-time capture to preserve markers per session.
src/vs/sessions/contrib/layout/browser/desktopSessionLayoutController.md Updates the D9/D9b spec narrative to match the new per-session marker scoping.
src/vs/sessions/contrib/layout/browser/baseSessionLayoutController.ts Removes the no-longer-used global _sidePaneToggledClosed tracking from the base toggle implementation.

Review details

  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread src/vs/sessions/contrib/layout/browser/desktopSessionLayoutController.ts Outdated
… bar

Address Copilot code review on #323360: _onSidePaneToggled set the collapse
marker whenever the aux bar ended up hidden after a toggle. But re-opening the
side pane can restore an editor-only state (aux bar explicitly hidden before the
collapse), which wrongly stamped that explicit hide as collapse-driven and made
opening Changes re-reveal the aux bar.

Pass collapsed + previousAuxiliaryBarVisible to the hook and only mark the
collapse when the toggle fully collapsed a previously-visible aux bar; any other
outcome captures the resulting state without fabricating a marker, preserving an
explicit aux-bar hide.

Add a regression test for the collapse + editor-only re-open case.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sandy081 sandy081 merged commit 424d185 into main Jun 28, 2026
29 checks passed
@sandy081 sandy081 deleted the sandy081/ccr-scope-collapse-marker branch June 28, 2026 20:40
@vs-code-engineering vs-code-engineering Bot added this to the 1.127.0 milestone Jun 28, 2026
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.

3 participants