only show bypass approvals for worktree CLI#301911
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts the chat permission picker behavior to account for “worktree-isolated” CLI sessions, where approvals are intended to be bypassed by default.
Changes:
- Adds a worktree-isolation observable to the permission picker delegate and updates the picker UI (checked/disabled/tooltip/label) based on that state.
- Introduces logic in
ChatInputPartto detect the sessionisolationoption and force/reset permission levels when switching into/out of worktree isolation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.ts | Updates permission dropdown options/label to reflect worktree isolation state and adjusts enablement/checked/tooltip behavior. |
| src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts | Tracks session isolation option and forces permission level changes when entering/leaving worktree isolation; passes state to permission picker. |
Comments suppressed due to low confidence (3)
src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.ts:115
worktreeIsolatedis captured whengetActions()runs, so thisrunhandler can become stale if isolation changes while the dropdown is open. Consider re-readingdelegate.isWorktreeIsolated.get()insiderunbefore deciding to return / prompt / set the permission level.
run: async () => {
if (worktreeIsolated) {
return;
}
src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.ts:170
worktreeIsolatedis captured whengetActions()runs, so thisrunhandler can become stale if isolation changes while the dropdown is open. Consider re-readingdelegate.isWorktreeIsolated.get()insiderun(especially since this action is otherwise disabled when worktree isolation is active).
run: async () => {
if (worktreeIsolated) {
return;
}
src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts:844
- This worktree transition unconditionally forces the permission level to AutoApprove. If enterprise policy disables global auto-approve, the UI may imply bypass approvals while confirmations are still required (policy is enforced elsewhere). Consider checking the policy restriction before forcing AutoApprove (and keeping the current/default permission level when policy forbids bypass).
if (isWorktree && !wasWorktree) {
// Switching to worktree: force bypass approvals
this._currentPermissionLevel.set(ChatPermissionLevel.AutoApprove, undefined);
this.permissionLevelKey.set(ChatPermissionLevel.AutoApprove);
this.permissionWidget?.refresh();
You can also share your feedback on Copilot code review. Take the survey.
src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.ts
Show resolved
Hide resolved
pwang347
approved these changes
Mar 16, 2026
justschen
added a commit
that referenced
this pull request
Mar 16, 2026
This reverts commit 6da8508.
justschen
added a commit
that referenced
this pull request
Mar 16, 2026
This reverts commit 6da8508.
justschen
added a commit
that referenced
this pull request
Mar 16, 2026
justschen
added a commit
that referenced
this pull request
Mar 16, 2026
This reverts commit 6da8508.
justschen
added a commit
that referenced
this pull request
Mar 16, 2026
justschen
added a commit
that referenced
this pull request
Mar 16, 2026
justschen
added a commit
that referenced
this pull request
Mar 16, 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.
fix #300480
CLI runs in isolated worktrees - bypass approvals is always on there