Skip to content

Persist sessions sidebar section collapse state#299355

Merged
daviddossett merged 3 commits intomainfrom
daviddossett/persist-sessions-sidebar-collapse-state
Mar 5, 2026
Merged

Persist sessions sidebar section collapse state#299355
daviddossett merged 3 commits intomainfrom
daviddossett/persist-sessions-sidebar-collapse-state

Conversation

@daviddossett
Copy link
Copy Markdown
Collaborator

Persists the expanded/collapsed state of timestamped sections (Today, Yesterday, Last 7 days, etc.) in the sessions sidebar across view open/close and restarts.

Changes:

  • Added IStorageService to AgentSessionsControl to persist section collapse state
  • Section collapse/expand is saved to profile-scoped storage whenever the user toggles a section
  • On initial render, saved state is checked before falling back to default collapse logic
  • Listens to the tree's onDidChangeCollapseState event, unwrapping the IAsyncDataTreeNode to access the actual section element

Copilot AI review requested due to automatic review settings March 5, 2026 01:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 adds persistence for the expanded/collapsed state of timestamped sections in the Agent Sessions sidebar by storing section collapse state in profile-scoped storage and restoring it on render.

Changes:

  • Injects IStorageService into AgentSessionsControl and adds helpers to read/write persisted section collapse state.
  • Updates collapseByDefault to consult persisted state before applying the existing default collapse rules.
  • Listens to the tree’s onDidChangeCollapseState and saves the new state (unwrapping IAsyncDataTreeNode to access the underlying section element).
Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.ts:223

  • The comments describing default behavior (e.g. “More section is always collapsed…”, “Archived section is collapsed…”) are no longer strictly true once persisted collapse state takes precedence. Please update these comments to reflect that they only apply when there is no saved user preference.
				if (element.section === AgentSessionSection.More && !this.options.filter.getExcludes().read) {
					return true; // More section is always collapsed unless only showing unread
				}
				if (element.section === AgentSessionSection.Archived && this.options.filter.getExcludes().archived) {
					return true; // Archived section is collapsed when archived are excluded
				}

@daviddossett daviddossett marked this pull request as ready for review March 5, 2026 18:06
@vs-code-engineering vs-code-engineering bot added this to the 1.111.0 milestone Mar 5, 2026
@daviddossett daviddossett merged commit 65ecbd4 into main Mar 5, 2026
20 checks passed
@daviddossett daviddossett deleted the daviddossett/persist-sessions-sidebar-collapse-state branch March 5, 2026 18:35
@bpasero
Copy link
Copy Markdown
Member

bpasero commented Mar 5, 2026

@daviddossett some feedback:

  • this is quite a significant change for us releasing this to 40m users shortly after (today is testing day!)
  • I see no associated issue to test this and verify it
  • I would have appreciated a ping to review the change as I have been working on this area mainly and thought about this too in the past

Zurich has been holding back larger changes today to stabilise, I feel this change should be reverted and then properly put in for another release. Thoughts?

cc @jo-oikawa @lostintangent @jrieken @benvillalobos

@daviddossett
Copy link
Copy Markdown
Collaborator Author

Reverting—it felt like a small change for me but apologies for pushing through during testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants