Skip to content

Enable terminal commands to run freely in Autopilot and Bypass Approvals modes#304236

Merged
meganrogge merged 11 commits intomainfrom
fix/303174-separate-revert
Mar 23, 2026
Merged

Enable terminal commands to run freely in Autopilot and Bypass Approvals modes#304236
meganrogge merged 11 commits intomainfrom
fix/303174-separate-revert

Conversation

@meganrogge
Copy link
Copy Markdown
Collaborator

@meganrogge meganrogge commented Mar 23, 2026

Reverts #300824 which fixed eval issues by returning early from the tool if a denied command was attempted. This caused issues like #303174, where commands were disallowed vs prompted for.

Now, we will skip the auto approval feature/system when a user is in Autopilot or Bypass Approvals mode so terminal commands run freely.

Also specifies "terminal commands" in Autopilot dialog (Bypass Approvals already had this).

Address #303174 in main. This will be a candidate.

Copilot AI review requested due to automatic review settings March 23, 2026 19:26
@meganrogge meganrogge self-assigned this Mar 23, 2026
@meganrogge meganrogge added this to the 1.113.0 milestone Mar 23, 2026
Copy link
Copy Markdown
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 runInTerminal chat tool so that when a user is in Autopilot or Bypass Approvals mode, terminal commands are not gated by the terminal tool’s auto-approve rules/denials (they should run freely based on the elevated chat permission level). It also adjusts copy in the permission picker dialogs to clarify that terminal commands will run without confirmation.

Changes:

  • Skip the terminal auto-approve analyzer when chat permission level is Autopilot/Bypass Approvals.
  • Remove the previous “deny early / circuit-break” behavior for auto-approve-denied commands.
  • Update permission picker strings and add/update unit tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts Bypasses terminal auto-approve analyzer in Autopilot/Bypass Approvals modes; removes early-deny/circuit-break flow.
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.ts Adjusts session-wide auto-approval handling and removes denial-details plumbing.
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.ts Removes denialDetails from the analyzer result shape.
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.ts Updates telemetry typing to drop the session reason.
src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.ts Updates mode descriptions/warnings to explicitly mention terminal commands running without confirmation.
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/runInTerminalTool.test.ts Updates session auto-approval tests and adds coverage for Autopilot/Bypass Approvals behavior.
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/commandLineAutoApproveAnalyzer.test.ts Adds a new unit test for analyzer behavior when sub-command parsing yields an empty list.

DonJayamanne
DonJayamanne previously approved these changes Mar 23, 2026
@meganrogge meganrogge modified the milestones: 1.113.0, 1.114.0 Mar 23, 2026
…r/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@meganrogge meganrogge requested review from Tyriar and justschen March 23, 2026 19:38
@meganrogge meganrogge enabled auto-merge (squash) March 23, 2026 19:44
@meganrogge meganrogge merged commit e9a5354 into main Mar 23, 2026
19 checks passed
@meganrogge meganrogge deleted the fix/303174-separate-revert branch March 23, 2026 21:01
Comment on lines +653 to +657
const isSessionAutoApproved = chatSessionResource && this._isSessionAutoApproveLevel(chatSessionResource);
const commandLineAnalyzers = isSessionAutoApproved
? this._commandLineAnalyzers.filter(e => !(e instanceof CommandLineAutoApproveAnalyzer))
: this._commandLineAnalyzers;
const commandLineAnalyzerResults = await Promise.all(commandLineAnalyzers.map(e => e.analyze(commandLineAnalyzerOptions)));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative way to handle this is to make a new analyzer that forces auto approval depending on the settings like with the sandbox one:

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.

5 participants