Skip to content

sessions: expand the Pinned section when the first session is pinned - #345233

Merged
Ross Wollman (rwoll) merged 1 commit into
mainfrom
agents/fix-first-pin-collapsed-group-bug
Oct 30, 2026
Merged

Ross Wollman (rwoll) merged 1 commit into
mainfrom
agents/fix-first-pin-collapsed-group-bug

Conversation

@rwoll

@rwoll Ross Wollman (rwoll) commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Found by an automated Agents window QA run.

Related: #326026. That issue is about the Pinned section missing until reload, which is a different symptom. This PR does not claim to fix it.

Repro

  1. Launch in fresh profile/new machine.
  2. Have no pinned sessions and at least one session in the Agents window sessions list.
  3. Right-click a session row and choose Pin.

Expected: an expanded Pinned group appears, showing the session.
Actual: a collapsed Pinned header appears at the top, and the session you just pinned is hidden until you expand it.

Root cause

#324055 made the Pinned section default to PreserveOrCollapsed when there is no saved collapse state. At that time Pinned was always visible, even with no pins. Later, #325135 hid Pinned while it is empty. Together, these mean the first pin always creates a new Pinned tree node with no saved state, so it renders collapsed and hides the session.

Fix

SessionsList now handles SessionListModelChangeKind.Pinned changes from ISessionsListModelService. When a session becomes pinned and the user has no saved collapse state for pinned, it saves the section as expanded. Then the rerender shows the section open. A collapse the user chose (pinned: true in sessionsListControl.sectionCollapseState) is kept as is. Unpinning does nothing.

The test harness gets an opt-in livePins option, so pinSession updates pin state and fires change events like the real service. Existing liveListModel tests keep their current behavior.

Validation

  • ./scripts/test.sh --reporter dot --run src/vs/sessions/contrib/sessions/test/browser/sessionsList.test.ts --run src/vs/sessions/contrib/sessions/test/browser/sessionsListTools.test.ts: passed (437 passing).
  • New tests first pin shows an expanded Pinned section and first pin keeps a user-collapsed Pinned section: passed. With the production change reverted, the first test failed (pinnedExpanded: 'false'), as expected.
  • npm run eslint -- <changed files>: passed.
  • npm run typecheck-client: passed.
  • End to end: Validated live on Ubuntu 24.04 arm64 with Code OSS built from 809053d4c7a. The build ran inside the desktop container, signed in as the GitHub test account. Before and after media are below.

End-to-end: before and after

Before (Insiders 1.145.0, cd2259bd) After (Code OSS from 809053d4c7a)
First pin: collapsed Pinned header, session hidden First pin: Pinned expanded, pinned session visible

After you collapse Pinned yourself, pinning a second session keeps it collapsed:

Pinned stays collapsed after the user collapsed it and pinned another session

Recording, before (Insiders): right-click a session, Pin, and the session disappears under a collapsed Pinned header.

before-insiders.webm

Recording, after (Code OSS from this branch): right-click a session, Pin, and Pinned appears expanded with the session.

after-code-oss.webm

Not verified live: unpin and re-pin across a reload. The unit tests cover the saved-state logic.

🤖 Authored with GitHub Copilot on behalf of Ross Wollman (@rwoll).

The Pinned section defaults to collapsed and is hidden while empty, so
pinning the first session created a collapsed section that hid the session.
Expand Pinned when a session is pinned unless the user has a saved collapse
state for it.

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

🤖 Authored with GitHub Copilot on behalf of @rwoll.
Copilot AI balanced review requested due to automatic review settings October 30, 2026 17:57

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.

🟢 Approval recommended

No active review issues are reported for the Pinned-section expansion change.

No open issues 🎉

What changed in this PR

This PR makes the Agents window’s Pinned section expand when a session is pinned without a saved collapse preference, while preserving an explicitly collapsed state. It does not address the separate missing-section issue in #326026.

Changes:

  • Handle pin-change notifications before refreshing the sessions list.
  • Add opt-in live pin behavior to the test harness.
  • Add regression tests for first-pin expansion and preservation of a saved collapsed state.
File Description
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​sessionsListTestUtils.ts Adds livePins support to update pin state and emit notifications.
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​sessionsList.test.ts Tests first-pin expansion and preservation of the user’s collapse preference.
src/​vs/​sessions/​contrib/​sessions/​browser/​views/​sessionsList.ts Saves an expanded Pinned state on pinning when no collapse preference exists.

Review effort: Balanced

@rwoll
Ross Wollman (rwoll) marked this pull request as ready for review October 30, 2026 19:26
@rwoll
Ross Wollman (rwoll) enabled auto-merge (squash) October 30, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents-window bug Issue identified by VS Code Team member as probable bug on-testplan

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants