Skip to content

Agents: fix sessions workspace picker#312136

Merged
sandy081 merged 7 commits intomainfrom
agents/fix-sessions-workspace-picker
Apr 23, 2026
Merged

Agents: fix sessions workspace picker#312136
sandy081 merged 7 commits intomainfrom
agents/fix-sessions-workspace-picker

Conversation

@sandy081
Copy link
Copy Markdown
Member

Fixes several issues with the sessions workspace picker in the Agents window.

Changes

Filter copilot worktrees from VS Code recents

Folders whose name starts with copilot- are filtered out from the VS Code recent folders list, as these are internal worktrees and not user-facing workspaces.

Preserve VS Code recents order

Removed the alphabetical sort that was previously applied to VS Code recent folders. Entries now retain the order VS Code stores them in (most recently used first).

Stable picker width

When maxWidth is set on the action list options, DOM-based width measurement is now skipped entirely and the fixed value is used directly. Previously, the measured width varied with scrollbar presence (which depended on list height which depended on window height), causing the picker width to fluctuate when the window was resized.

Scrollbar clearance

Row width is set to calc(100% - 10px) so content never extends under the 10px Monaco overlay scrollbar track.

Group title / toolbar spacing

In inline-description mode, the flex row gap is set to 0 with explicit margins on individual elements. This keeps the group title ("Folders") and remove button (×) flush with just a small readable gap, while still giving the group title margin-right breathing room when the toolbar is hidden.

Bottom gap

A 30px gap is maintained between the bottom of the picker and the window edge.

Document entry ordering

Added JSDoc on _buildItems() explaining the sorting: own recents first, VS Code recents after, groups ordered by first appearance, within-group order preserved.

- Filter copilot worktrees (folders starting with 'copilot-') from VS Code recents
- Preserve VS Code recents order instead of sorting alphabetically
- Fix overflow with description + group title in inline-description mode
- Fix submenu chevron alignment using flex layout without negative margins
- Cap picker width at 600px (matching quick pick) with stable fixed-width layout
  that skips DOM measurement to prevent width fluctuating with window height
- Add 30px bottom gap so picker doesn't grow flush to window edge
- Add scrollbar clearance: row width calc(100% - 10px) keeps content clear
  of the 10px overlay scrollbar track
- Fix group title / toolbar spacing in inline-description mode
- Document entry ordering in _buildItems()

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 23, 2026 14:11
Manual path.lastIndexOf('/') returns empty string when the URI path
has a trailing slash, causing the filter to miss those folders.
Use the existing basename() helper from resources.ts which handles
all URI path edge cases correctly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 fixes several UX and ordering issues in the Agents window “sessions workspace picker”, primarily by stabilizing picker sizing/spacing and adjusting how recent workspaces are sourced and ordered.

Changes:

  • Adds a fixed-width option for action lists and uses it in the sessions workspace picker to prevent resize-induced width fluctuations.
  • Updates action widget styling to keep row content clear of the overlay scrollbar and refines inline-description spacing.
  • Adjusts sessions workspace picker recents behavior: preserves VS Code recents order and filters out certain internal Copilot worktrees.
Show a summary per file
File Description
src/vs/sessions/contrib/chat/browser/sessionWorkspacePicker.ts Preserves recents ordering, filters Copilot worktree recents, adds picker JSDoc, and sets a fixed picker width via action list options.
src/vs/platform/actionWidget/browser/actionWidget.css Tweaks action-widget row sizing and inline-description layout to improve scrollbar clearance and spacing.
src/vs/platform/actionWidget/browser/actionList.ts Introduces an options-driven “fixed width” path (via maxWidth) and adjusts height calculations to maintain a window-edge gap.

Copilot's findings

Comments suppressed due to low confidence (2)

src/vs/platform/actionWidget/browser/actionList.ts:1773

  • There’s test coverage for ActionListWidget filtering, but the newly introduced maxWidth/fixed-width behavior in ActionList.layout() (and the new bottom-gap height behavior) is untested. Adding a small browser test that asserts the returned width/layout behavior when maxWidth is set (including in a constrained container) would help prevent regressions.
		// When a fixed maxWidth is provided, skip DOM measurement entirely.
		// DOM-based measurement varies with scrollbar presence (which depends on
		// the list height), causing the width to fluctuate as the window is resized.
		let computedWidth: number;
		if (this._options?.maxWidth !== undefined) {
			computedWidth = this._options.maxWidth;
		} else {
			computedWidth = this._widget.computeMaxWidth(minWidth);
		}
		this._cachedMaxWidth = computedWidth;
		this._widget.layout(listHeight, this._cachedMaxWidth);

src/vs/platform/actionWidget/browser/actionList.ts:1771

  • When options.maxWidth is set, layout() forces the widget width to that value without respecting minWidth or the widget’s CSS constraints (e.g. .action-widget { max-width: 80vw; }). In narrow windows this can cause a mismatch where the DOM clamps the widget width but the list is laid out as if it were wider, leading to clipped content/incorrect scrolling. Consider clamping the fixed width to the effective available width (e.g. viewport/CSS max) and also honoring the effective min width.
		if (this._options?.maxWidth !== undefined) {
			computedWidth = this._options.maxWidth;
		} else {
			computedWidth = this._widget.computeMaxWidth(minWidth);
		}
  • Files reviewed: 3/3 changed files
  • Comments generated: 3

Comment thread src/vs/platform/actionWidget/browser/actionList.ts Outdated
Comment thread src/vs/sessions/contrib/chat/browser/sessionWorkspacePicker.ts
Comment thread src/vs/platform/actionWidget/browser/actionList.ts
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 23, 2026

Screenshot Changes

Base: 677ee018 Current: 0cced04a

Changed (2)

editor/codeActionList/SimpleQuickFixes/Light
Before After
before after
editor/codeActionList/SimpleQuickFixes/Dark
Before After
before after

sandy081 and others added 3 commits April 23, 2026 16:30
Only show the 10 most recent folders from VS Code history in the
workspace picker to keep the list focused and manageable.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Rename maxWidth option to fixedWidth to accurately reflect its
  behavior (fixed width, not a cap on measured width)
- Fix spaceAbove calculation: remove bottomGap from spaceAbove since
  the 30px gap is only needed at the bottom of the viewport
- _isCopilotWorktree already uses basename() from a prior commit

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the cap from _loadVSCodeRecentFolders (before provider resolution)
into _getVSCodeRecentWorkspaces (after provider filtering), so unsupported
folders don't consume slots in the limit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
lszomoru
lszomoru previously approved these changes Apr 23, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
lszomoru
lszomoru previously approved these changes Apr 23, 2026
@sandy081 sandy081 enabled auto-merge (squash) April 23, 2026 14:58
@hediet hediet disabled auto-merge April 23, 2026 15:05
@hediet
Copy link
Copy Markdown
Member

hediet commented Apr 23, 2026

Can you confirm if the fixture change is intentional?

I believe it is caused by that:

/* Leave clearance on the right for the vertical scrollbar track */
width: calc(100% - 10px);

(disabled auto-merge as precautionary measure, feel free to merge nontheless)

@sandy081
Copy link
Copy Markdown
Member Author

Hey - this is a great catch - I will fix it

…duction

Replace width: calc(100% - 10px) on rows with margin-right: 10px on
the toolbar, submenu chevron, and group-title (when no actions follow).
This avoids shrinking the row itself which caused code action list
screenshot regressions, while still providing scrollbar clearance.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sandy081 sandy081 merged commit 659d444 into main Apr 23, 2026
52 of 56 checks passed
@sandy081 sandy081 deleted the agents/fix-sessions-workspace-picker branch April 23, 2026 17:26
@vs-code-engineering vs-code-engineering Bot added this to the 1.118.0 milestone Apr 23, 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.

4 participants