Skip to content

Respect chat.tools.terminal.autoApprove for agent host#322774

Merged
anthonykim1 merged 6 commits into
mainfrom
anthonykim1/terminalAutoApproveList
Jun 25, 2026
Merged

Respect chat.tools.terminal.autoApprove for agent host#322774
anthonykim1 merged 6 commits into
mainfrom
anthonykim1/terminalAutoApproveList

Conversation

@anthonykim1

@anthonykim1 anthonykim1 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Resolves: #322112
Coming from: #322633
Follow-up in future: #322791

  • Add Agent Host root-config plumbing for chat.tools.terminal.autoApprove.
  • Forward normalized terminal auto-approve rules from both local and remote Agent Host clients, including updates when chat.tools.terminal.autoApprove or chat.tools.terminal.ignoreDefaultAutoApproveRules changes.
  • Respect null, boolean rules, and { approve, matchCommandLine } object rules in Agent Host shell approval.
  • Keep chat.tools.terminal.enableAutoApprove=false as the top-level gate for rule-based shell approval.
  • Preserve existing Agent Host safety behavior: deny rules win, parser failure prompts, unsafe write redirects still require confirmation, and bundled defaults remain only as a compatibility fallback when no forwarded rules exist.
  • Mark the bundled fallback rules for removal once all Agent Host clients are guaranteed to forward the real terminal auto-approve setting before shell approvals run.
  • Add coverage for rule normalization, remote forwarding, command auto-approval rule behavior, source-of-truth precedence over fallback defaults, and session permission behavior.
    /cc @justschen

Inspirations from:

Copilot AI review requested due to automatic review settings June 24, 2026 17:19
@anthonykim1 anthonykim1 self-assigned this Jun 24, 2026
@anthonykim1 anthonykim1 added this to the 1.127.0 milestone Jun 24, 2026

Copilot AI left a comment

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.

Pull request overview

Adds agent-host plumbing to forward and enforce VS Code terminal auto-approve rules (chat.tools.terminal.autoApprove) for shell permission decisions, including support for null, boolean, and { approve, matchCommandLine } rule entries, across both local and remote agent-host clients.

Changes:

  • Introduces a new agent-host root config key for forwarded terminal auto-approve rules and implements normalization (including “ignore default rules” behavior).
  • Updates shell command auto-approval to consume forwarded rules (with bundled defaults as a compatibility fallback when rules aren’t forwarded).
  • Adds/extends tests for rule normalization, remote forwarding behavior, and permission decision outcomes.
Show a summary per file
File Description
src/vs/platform/agentHost/common/agentHostSchema.ts Adds root-config key + normalization helpers for forwarding effective terminal auto-approve rules.
src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.ts Forwards terminal auto-approve rules on connect and on relevant configuration changes (remote client).
src/vs/platform/agentHost/electron-browser/localAgentHostService.ts Forwards terminal auto-approve rules on connect and on relevant configuration changes (local client).
src/vs/platform/agentHost/node/sessionPermissions.ts Uses forwarded terminal auto-approve rules during shell permission auto-approval (still gated by enablement setting).
src/vs/platform/agentHost/node/commandAutoApprover.ts Extends rule compilation/matching to support { approve, matchCommandLine } and forwarded rule sets.
src/vs/platform/agentHost/test/common/agentHostSchema.test.ts Adds coverage for terminal auto-approve rule normalization and default-ignoring behavior.
src/vs/platform/agentHost/test/electron-browser/remoteAgentHostProtocolClient.test.ts Adds coverage for forwarding terminal auto-approve rules on connect and when settings change.
src/vs/platform/agentHost/test/node/sessionPermissions.test.ts Adds coverage ensuring forwarded allow/deny rules affect shell permission outcomes as expected.
src/vs/platform/agentHost/test/node/commandAutoApprover.test.ts Adds coverage for forwarded rules including null entries and matchCommandLine behavior.

Copilot's findings

  • Files reviewed: 9/9 changed files
  • Comments generated: 1

Comment thread src/vs/platform/agentHost/node/commandAutoApprover.ts
@anthonykim1 anthonykim1 force-pushed the anthonykim1/terminalAutoApproveList branch from 9e6adc0 to 59d368f Compare June 25, 2026 06:07
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Base: a6d24e1b Current: acbe23d3

No screenshot changes.

@anthonykim1 anthonykim1 marked this pull request as ready for review June 25, 2026 15:42
@anthonykim1 anthonykim1 moved this to In Progress in Agent Host Protocol Jun 25, 2026
@anthonykim1 anthonykim1 enabled auto-merge (squash) June 25, 2026 16:54
@anthonykim1 anthonykim1 merged commit 33c985d into main Jun 25, 2026
29 checks passed
@anthonykim1 anthonykim1 deleted the anthonykim1/terminalAutoApproveList branch June 25, 2026 17:27
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Agent Host Protocol Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Terminal auto-approve for agent host

3 participants