Open Workspace In Agents Window: select folder in new chat view#314602
Merged
Conversation
When 'Open in Agents Window' is triggered from the workbench, pass the current workspace folder URI to the agents window and pre-select it in the new chat workspace picker. Flow: - Action passes folderUri via openAgentsWindow API - Main process sends vscode:selectAgentsFolder IPC to agents window - Sessions contribution resolves folder via providers and selects it - Waits for provider registration with Eventually phase timeout Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Screenshot ChangesBase: Changed (12) |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR wires “Open in Agents Window” from the VS Code workbench through to the standalone Agents (Sessions) window so the current workspace folder can be preselected in the “New Session” workspace picker.
Changes:
- Pass the first workbench workspace folder URI into
INativeHostService.openAgentsWindow({ folderUri }). - Thread the folder URI through native main process window creation and send it to the Agents window via
vscode:selectAgentsFolderIPC. - Add a Sessions workbench contribution that receives the IPC, opens the new-session view, resolves the URI via registered sessions providers, and selects it in
NewChatViewPane.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/test/electron-browser/workbenchTestServices.ts | Updates the test native host service stub to accept the new openAgentsWindow options shape. |
| src/vs/workbench/contrib/chat/electron-browser/agentSessions/agentSessionsActions.ts | Passes the current workspace folder URI to openAgentsWindow. |
| src/vs/sessions/contrib/chat/electron-browser/chat.contribution.ts | Adds IPC handler contribution to resolve/select the folder in the Sessions “New Session” picker. |
| src/vs/platform/windows/electron-main/windowsMainService.ts | Extends openAgentsWindow to optionally send a folder-selection IPC after the window opens. |
| src/vs/platform/windows/electron-main/windows.ts | Updates IWindowsMainService.openAgentsWindow signature to accept an optional folder URI. |
| src/vs/platform/native/electron-main/nativeHostMainService.ts | Threads folderUri option from the native host RPC into windowsMainService.openAgentsWindow, and focuses the opened Agents window. |
| src/vs/platform/native/common/native.ts | Extends the openAgentsWindow API to accept an optional { folderUri?: UriComponents }. |
Copilot's findings
- Files reviewed: 7/7 changed files
- Comments generated: 2
Comment on lines
+53
to
+55
| const workspaceContextService = accessor.get(IWorkspaceContextService); | ||
| const folderUri = workspaceContextService.getWorkspace().folders[0]?.uri; | ||
| await nativeHostService.openAgentsWindow({ folderUri }); |
Member
Author
There was a problem hiding this comment.
This is fine for now — file:// is the expected case when triggering from the workbench. Remote workspace folders aren't the target scenario for this action. If remote support is needed later, we can map URIs at that point.
roblourens
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When "Open in Agents Window" is triggered from the workbench, pass the current workspace folder URI to the agents window and pre-select it in the new chat workspace picker.
Flow:
OpenWorkspaceInAgentsWindowActionpasses the first workspace folder URI viaopenAgentsWindow({ folderUri })vscode:selectAgentsFolderIPC to the agents windowSelectAgentsFolderContributionhandles the IPC:NewChatViewPaneworkspace pickeronDidChangeProviderswith a timeout atLifecyclePhase.Eventually