Skip to content

sessions - enforce sessions window in embedded ap#307032

Merged
bpasero merged 1 commit intomainfrom
ben/current-fox
Apr 1, 2026
Merged

sessions - enforce sessions window in embedded ap#307032
bpasero merged 1 commit intomainfrom
ben/current-fox

Conversation

@bpasero
Copy link
Copy Markdown
Member

@bpasero bpasero commented Apr 1, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 1, 2026 06:11
@bpasero bpasero enabled auto-merge (squash) April 1, 2026 06:11
@bpasero bpasero self-assigned this Apr 1, 2026
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

Updates the Electron main-process window opening flow to force the embedded “sessions/agents” app to always open the agent sessions workspace, and to skip normal startup restore behavior.

Changes:

  • Switch openAgentsWindow to route through a shared ensureAgentsWindow(...) helper.
  • In open(...), detect embedded app mode and rewrite the open configuration to always target the agents workspace.
  • Skip hot-exit / previous-session restore when running as the embedded app.
Comments suppressed due to low confidence (2)

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

  • ensureAgentsWindow rebuilds a new IOpenConfiguration from scratch and drops many fields from the incoming config (e.g. forceNewWindow, forceNewTabbedWindow, forceReuseWindow, waitMarkerFileURI, remoteAuthority, forceProfile/forceTempProfile, etc.). This changes the behavior of both openAgentsWindow and (now) every open() call in the embedded app.

If the intent is only to override the workspace and suppress recents/restores, consider starting from { ...openConfig, urisToOpen: [...], noRecentEntry: true } and then explicitly overriding/clearing only the fields that must not apply in the agents app.

		return {
			urisToOpen: [{ workspaceUri: agentSessionsWorkspaceUri }],
			userEnv: openConfig.userEnv,
			cli: openConfig.cli,
			noRecentEntry: true,
			context: openConfig.context,
			contextWindowId: openConfig.contextWindowId,
			initialStartup: openConfig.initialStartup,
		};

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

  • The comment in openAgentsWindow says it opens in a new browser window, but the config returned by ensureAgentsWindow no longer sets forceNewWindow: true. As a result, open() may reuse an existing window depending on user settings and context.

If a new window is required here, set forceNewWindow: true (and ensure forceReuseWindow is not set).

		// Open in a new browser window with the agent sessions workspace
		return this.open(await this.ensureAgentsWindow(openConfig));
	}

	private async ensureAgentsWindow(openConfig: IOpenConfiguration): Promise<IOpenConfiguration> {
		const agentSessionsWorkspaceUri = this.environmentMainService.agentSessionsWorkspace;

Comment on lines +295 to +300
async openAgentsWindow(openConfig: IOpenConfiguration): Promise<ICodeWindow[]> {
this.logService.trace('windowsManager#openAgentsWindow');

// Open in a new browser window with the agent sessions workspace
return this.open(await this.ensureAgentsWindow(openConfig));
}
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openAgentsWindow now takes IOpenConfiguration, but IWindowsMainService.openAgentsWindow (and existing call sites) pass only IBaseOpenConfiguration (e.g. { context, contextWindowId }). This will fail type-checking and also breaks runtime expectations because cli/userEnv are required for IOpenConfiguration.

Consider keeping the parameter type as IBaseOpenConfiguration and constructing the full IOpenConfiguration inside (using this.environmentMainService.args and the appropriate user env), or update the interface + all callers in the same PR.

This issue also appears in the following locations of the same file:

  • line 298
  • line 315

Copilot uses AI. Check for mistakes.
@bpasero bpasero merged commit 4c022c6 into main Apr 1, 2026
22 checks passed
@bpasero bpasero deleted the ben/current-fox branch April 1, 2026 06:40
@vs-code-engineering vs-code-engineering bot added this to the 1.115.0 milestone Apr 1, 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