Skip to content

Enable window commands in Agents window#315258

Merged
sandy081 merged 1 commit into
mainfrom
sandy081/enable-window-commands-in-agents-window
May 8, 2026
Merged

Enable window commands in Agents window#315258
sandy081 merged 1 commit into
mainfrom
sandy081/enable-window-commands-in-agents-window

Conversation

@sandy081
Copy link
Copy Markdown
Member

@sandy081 sandy081 commented May 8, 2026

This PR enables standard window commands (New Window, Open Folder, Open..., Open Workspace from File, Open Recent, New Window with Profile) in the Agents window.

Changes:

  1. Remove IsSessionsWindowContext guards — Removed precondition and menu when clauses that blocked these commands from appearing/running in the Agents window.

  2. Prevent Agents window from being reused — In windowsMainService.ts, when opening a folder or workspace:

    • doOpenFolderOrWorkspace / doOpenEmpty: If the context window is an Agents window, force opening in a new window instead of reusing it.
    • openInBrowserWindow: Skip the lastActiveWindow fallback when it's an Agents window (handles native macOS menu Open Recent items which don't set contextWindowId).

- Remove IsSessionsWindowContext precondition and menu guards from New Window, Open Folder, Open..., Open Workspace from File, Open Recent, and New Window with Profile commands
- In windowsMainService, prevent the Agents window from being reused when opening folders/workspaces by checking isSessionsWindow in doOpenFolderOrWorkspace, doOpenEmpty, and openInBrowserWindow

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 8, 2026 13:27
@sandy081 sandy081 enabled auto-merge (squash) May 8, 2026 13:28
@sandy081 sandy081 self-assigned this May 8, 2026
@sandy081 sandy081 added this to the 1.120.0 milestone May 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Screenshot Changes

Base: 5618f96f Current: b715c050

Changed (5)

chat/chatToolRiskBadge/GreenElicitationInContext/Dark
Before After
before after
chat/chatToolRiskBadge/GreenElicitationInContext/Light
Before After
before after
chat/chatToolRiskBadge/OrangeElicitationInContext/Dark
Before After
before after
chat/chatToolRiskBadge/RedElicitationInContext/Dark
Before After
before after
chat/chatToolRiskBadge/RedElicitationInContext/Light
Before After
before after

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

Enables standard window/workspace commands in the Agents (sessions) window by removing context guards that previously hid/blocked them, while ensuring those commands don’t repurpose the Agents window when they trigger opening a different workspace.

Changes:

  • Removed IsSessionsWindowContext.negate() preconditions/when clauses so window/workspace commands appear and can run in the Agents window.
  • Updated WindowsMainService to avoid reusing an Agents window when opening an empty window, folder, or workspace, and to avoid falling back to reusing the last active window if it is an Agents window.
Show a summary per file
File Description
src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts Allows “New Window with Profile” submenu to appear in the Agents window.
src/vs/workbench/browser/actions/workspaceActions.ts Removes sessions-window guards from “Open Folder / Open… / Open Workspace…” actions and File menubar items.
src/vs/workbench/browser/actions/windowActions.ts Removes sessions-window guards from “New Window” and “Open Recent” actions/menus.
src/vs/platform/windows/electron-main/windowsMainService.ts Prevents reusing an Agents window for open-empty / open-folder / open-workspace flows and avoids lastActiveWindow fallback reuse when it’s an Agents window.

Copilot's findings

Comments suppressed due to low confidence (1)

src/vs/platform/windows/electron-main/windowsMainService.ts:804

  • This block repeats the same sessions-window contextWindowId handling as doOpenEmpty. Refactoring into a shared helper would reduce duplication and lower the risk of one open path behaving differently if this logic changes later.
			const contextWindow = this.getWindowById(openConfig.contextWindowId); // fix for https://github.com/microsoft/vscode/issues/49587
			if (contextWindow?.config?.isSessionsWindow) {
				forceNewWindow = true; // do not replace the agents window
			} else {
				windowToUse = contextWindow;
  • Files reviewed: 4/4 changed files
  • Comments generated: 1

Comment on lines +773 to +777
const contextWindow = this.getWindowById(openConfig.contextWindowId); // fix for https://github.com/microsoft/vscode/issues/97172
if (contextWindow?.config?.isSessionsWindow) {
forceNewWindow = true; // do not replace the agents window
} else {
windowToUse = contextWindow;
@sandy081 sandy081 merged commit e6f0055 into main May 8, 2026
29 checks passed
@sandy081 sandy081 deleted the sandy081/enable-window-commands-in-agents-window branch May 8, 2026 13:56
lszomoru pushed a commit that referenced this pull request May 8, 2026
- Remove IsSessionsWindowContext precondition and menu guards from New Window, Open Folder, Open..., Open Workspace from File, Open Recent, and New Window with Profile commands
- In windowsMainService, prevent the Agents window from being reused when opening folders/workspaces by checking isSessionsWindow in doOpenFolderOrWorkspace, doOpenEmpty, and openInBrowserWindow

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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