Sessions: Ask for workspace trust when picking a folder in new chat view#299242
Merged
Sessions: Ask for workspace trust when picking a folder in new chat view#299242
Conversation
…tion if untrusted
…rity and maintainability
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Sessions “new chat” welcome flow to request workspace trust when a user selects a local folder, moving trust orchestration into NewChatWidget and simplifying the folder picker to be selection-only.
Changes:
- Request workspace trust before creating a local (Background) session and when the user picks a folder in the new chat view.
- Simplify
FolderPickerby removing session wiring; selection events are handled by the caller. - Minor UX/config tweaks: send-button cursor states and removal of a default diff override.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/vs/sessions/contrib/configuration/browser/configuration.contribution.ts | Removes diffEditor.renderSideBySide from Sessions default configuration overrides. |
| src/vs/sessions/contrib/chat/browser/newChatViewPane.ts | Adds trust prompting + folder selection rollback logic; removes workspace-folder fallback usage for repo URI. |
| src/vs/sessions/contrib/chat/browser/media/chatWidget.css | Adjusts cursor styling for enabled/disabled send button states. |
| src/vs/sessions/contrib/chat/browser/folderPicker.ts | Removes session coupling so the picker only stores/updates selection and fires events. |
Comments suppressed due to low confidence (1)
src/vs/sessions/contrib/chat/browser/newChatViewPane.ts:1059
- When trust is denied, reverting via
setSelectedFolder/clearSelectionupdates only the in-memory selection. BecauseFolderPicker._selectFolderpersists to storage and recents, the denied URI can remain recorded as the last-picked/recent folder even after this revert (andsetSelectedFolderwill persist again). Consider adding a non-persisting revert path (or explicitly restoring/removing the relevant storage entries) so the UI rollback also rolls back persistence.
if (!trusted) {
const previousFolderUri = this._newSession.value?.repoUri;
if (previousFolderUri) {
this._folderPicker.setSelectedFolder(previousFolderUri);
} else {
this._folderPicker.clearSelection();
}
18ed3ac to
31679d9
Compare
lramos15
approved these changes
Mar 4, 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.
Summary
Ask for workspace trust when a folder is picked or during initialization in the Sessions new chat view.
Changes
folderPicker.ts— Simplified to a pure picker:setNewSession,_newSession,setRepoUri)IWorkspaceTrustRequestService— trust is now handled by the callernewChatViewPane.ts— Orchestrates trust and session wiring:_createNewSessiononDidSelectFolderworkspaceContextService.getWorkspace().folders[0]fallback — folder URI comes solely from the pickerworkspaceContextServiceinjection fromNewChatWidgetchatWidget.css— Fixed send button cursor:cursor: pointerfor enabled statecursor: defaultfor disabled stateconfiguration.contribution.ts:diffEditor.renderSideBySidefrom default overrides