Skip to content

Respect terminal auto-approve setting in Agent Host default permissions#322633

Merged
anthonykim1 merged 2 commits into
mainfrom
anthonykim1/terminalAutoApproveRespect
Jun 24, 2026
Merged

Respect terminal auto-approve setting in Agent Host default permissions#322633
anthonykim1 merged 2 commits into
mainfrom
anthonykim1/terminalAutoApproveRespect

Conversation

@anthonykim1

@anthonykim1 anthonykim1 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Part of: #322112

  • Add an Agent Host root-config key for chat.tools.terminal.enableAutoApprove.
  • Forward terminal auto-approve enablement from local and remote Agent Host clients on connect and config changes.
  • Gate Agent Host shell auto-approval on the forwarded setting in default permission mode.
  • Preserve session bypass behavior: SessionConfigKey.AutoApprove still auto-approves shell requests even when terminal auto-approve is disabled.
  • Add tests for root-config forwarding and default-vs-bypass shell permission behavior.

Inspirations from:

@anthonykim1 anthonykim1 added this to the 1.127.0 milestone Jun 23, 2026
@anthonykim1 anthonykim1 self-assigned this Jun 23, 2026
Copilot AI review requested due to automatic review settings June 23, 2026 22:46

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 root-config plumbing to ensure shell auto-approval respects VS Code’s chat.tools.terminal.enableAutoApprove setting while preserving session-level “Bypass Approvals” behavior.

Changes:

  • Introduces a new agent-host root-config key (terminalAutoApproveEnabled) and forwards the VS Code setting ID (chat.tools.terminal.enableAutoApprove) from local + remote agent-host clients.
  • Gates default-mode shell auto-approval in SessionPermissionManager.getAutoApproval() on the forwarded root-config key, while keeping session bypass (SessionConfigKey.AutoApprove=autoApprove) authoritative.
  • Adds coverage for both the forwarding behavior (remote client connect) and default-vs-bypass shell permission behavior.
Show a summary per file
File Description
src/vs/platform/agentHost/common/agentHostSchema.ts Adds the new root-config key + setting ID constant and registers it in platformRootSchema with default true.
src/vs/platform/agentHost/electron-browser/localAgentHostService.ts Forwards terminal auto-approve enablement on connect and on configuration changes for the local agent-host client.
src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.ts Forwards terminal auto-approve enablement on connect and on configuration changes for the remote agent-host client (connected-state gated).
src/vs/platform/agentHost/node/sessionPermissions.ts Gates shell auto-approval on the forwarded root-config value in default permission mode, preserving session bypass precedence.
src/vs/platform/agentHost/test/node/sessionPermissions.test.ts Adds tests covering default-mode shell behavior vs disabled root-config and confirms bypass mode still auto-approves.
src/vs/platform/agentHost/test/electron-browser/remoteAgentHostProtocolClient.test.ts Extends handshake test to assert forwarding of the new root-config key.

Copilot's findings

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

@anthonykim1 anthonykim1 marked this pull request as ready for review June 23, 2026 23:23
@anthonykim1 anthonykim1 enabled auto-merge (squash) June 23, 2026 23:51
@anthonykim1 anthonykim1 merged commit 8e04bfd into main Jun 24, 2026
54 checks passed
@anthonykim1 anthonykim1 deleted the anthonykim1/terminalAutoApproveRespect branch June 24, 2026 00:12
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.

3 participants