sessions - enforce sessions window in embedded ap#307032
Conversation
There was a problem hiding this comment.
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
openAgentsWindowto route through a sharedensureAgentsWindow(...)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
ensureAgentsWindowrebuilds a newIOpenConfigurationfrom scratch and drops many fields from the incoming config (e.g.forceNewWindow,forceNewTabbedWindow,forceReuseWindow,waitMarkerFileURI,remoteAuthority,forceProfile/forceTempProfile, etc.). This changes the behavior of bothopenAgentsWindowand (now) everyopen()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
openAgentsWindowsays it opens in a new browser window, but the config returned byensureAgentsWindowno longer setsforceNewWindow: 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;
| 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)); | ||
| } |
There was a problem hiding this comment.
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
No description provided.