Skip to content

only show bypass approvals for worktree CLI#301911

Merged
justschen merged 3 commits intomainfrom
justin/eelektross
Mar 16, 2026
Merged

only show bypass approvals for worktree CLI#301911
justschen merged 3 commits intomainfrom
justin/eelektross

Conversation

@justschen
Copy link
Collaborator

@justschen justschen commented Mar 16, 2026

fix #300480

CLI runs in isolated worktrees - bypass approvals is always on there

Screenshot 2026-03-15 at 5 36 50 PM

Copilot AI review requested due to automatic review settings March 16, 2026 00:36
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

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 ChatInputPart to detect the session isolation option 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

  • worktreeIsolated is captured when getActions() runs, so this run handler can become stale if isolation changes while the dropdown is open. Consider re-reading delegate.isWorktreeIsolated.get() inside run before deciding to return / prompt / set the permission level.
						run: async () => {
							if (worktreeIsolated) {
								return;
							}

src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.ts:170

  • worktreeIsolated is captured when getActions() runs, so this run handler can become stale if isolation changes while the dropdown is open. Consider re-reading delegate.isWorktreeIsolated.get() inside run (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.

@justschen justschen marked this pull request as ready for review March 16, 2026 01:02
@vs-code-engineering vs-code-engineering bot added this to the 1.112.0 milestone Mar 16, 2026
@justschen justschen merged commit 6da8508 into main Mar 16, 2026
21 checks passed
@justschen justschen deleted the justin/eelektross branch March 16, 2026 04:25
justschen added a commit that referenced this pull request Mar 16, 2026
justschen added a commit that referenced this pull request Mar 16, 2026
Revert "only show `bypass approvals` for worktree CLI (#301911)"

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 commits:
- 6d10c7c make sure worktree is always bypass for sessions window
- 37d616e fix worktree states
- bb1e8df try to isolate permissions picker with worktree cli
justschen added a commit that referenced this pull request Mar 16, 2026
justschen added a commit that referenced this pull request Mar 16, 2026
Revert "only show `bypass approvals` for worktree CLI (#301911)"

This reverts commit 6da8508.
justschen added a commit that referenced this pull request Mar 16, 2026
This reverts commit 6da8508.

(cherry picked from commit e2978d7)
justschen added a commit that referenced this pull request Mar 16, 2026
* Revert "only show `bypass approvals` for worktree CLI (#301911)"

This reverts commit 6da8508.

(cherry picked from commit e2978d7)

* fix bypass approvals skipping  confirmation widget
justschen added a commit that referenced this pull request Mar 16, 2026
* Revert "only show `bypass approvals` for worktree CLI (#301911)"

This reverts commit 6da8508.

(cherry picked from commit e2978d7)

* cherry pick fix for \ in collapsed thinking header
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.

Render some distinction with default approvals when using Copilot CLI worktree

3 participants