Skip to content

Sessions: Ask for workspace trust when picking a folder in new chat view#299242

Merged
sandy081 merged 17 commits intomainfrom
copilot-worktree-2026-03-04T15-51-38
Mar 4, 2026
Merged

Sessions: Ask for workspace trust when picking a folder in new chat view#299242
sandy081 merged 17 commits intomainfrom
copilot-worktree-2026-03-04T15-51-38

Conversation

@sandy081
Copy link
Member

@sandy081 sandy081 commented Mar 4, 2026

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:

  • Removed session management (setNewSession, _newSession, setRepoUri)
  • Removed IWorkspaceTrustRequestService — trust is now handled by the caller

newChatViewPane.ts — Orchestrates trust and session wiring:

  • Trust is requested before creating a new session in _createNewSession
  • Trust is requested when the user picks a new folder via onDidSelectFolder
  • If trust is denied, the folder picker resets to the previous value
  • Session still gets created without a folder URI if trust is denied (so pickers render correctly)
  • Removed workspaceContextService.getWorkspace().folders[0] fallback — folder URI comes solely from the picker
  • Removed unused workspaceContextService injection from NewChatWidget

chatWidget.css — Fixed send button cursor:

  • Added cursor: pointer for enabled state
  • Added cursor: default for disabled state

configuration.contribution.ts:

  • Removed diffEditor.renderSideBySide from default overrides

Copilot AI review requested due to automatic review settings March 4, 2026 17:31
@sandy081 sandy081 self-assigned this Mar 4, 2026
@sandy081 sandy081 added this to the 1.111.0 milestone Mar 4, 2026
@sandy081 sandy081 enabled auto-merge (squash) March 4, 2026 17:35
Copy link
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

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 FolderPicker by 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 / clearSelection updates only the in-memory selection. Because FolderPicker._selectFolder persists to storage and recents, the denied URI can remain recorded as the last-picked/recent folder even after this revert (and setSelectedFolder will 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();
			}

@sandy081 sandy081 force-pushed the copilot-worktree-2026-03-04T15-51-38 branch from 18ed3ac to 31679d9 Compare March 4, 2026 17:39
@sandy081 sandy081 merged commit 54780aa into main Mar 4, 2026
20 checks passed
@sandy081 sandy081 deleted the copilot-worktree-2026-03-04T15-51-38 branch March 4, 2026 19:03
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