SIGN IN SIGN UP

Add auto-approve session config for agent host (#309513)

* Add auto-approve session config for agent host

Add an autoApprove session config property to the Copilot agent host with
three options: Default Approvals, Bypass Approvals, and Autopilot (Preview).

- Add autoApprove property to resolveSessionConfig() in copilotAgent.ts
  with sessionMutable: true so it can be changed during running sessions
- Auto-approve all tool calls in agentSideEffects when bypass/autopilot
  is active, overriding per-file and per-command approval rules
- Add client-side filtering (autopilot gated by chat.autopilot.enabled,
  enterprise policy disables bypass/autopilot options)
- Show confirmation dialogs matching the extension host permission picker
- Render the picker in MenuId.ChatInputSecondary for running sessions
  (same location as the normal agent permission picker)
- Wire SessionConfigChanged dispatch for mid-session config changes in
  both local and remote agent host session providers
- Add running session config cache with proper lifecycle cleanup
- Handle restored sessions by creating minimal config entries
- Add 4 unit tests for session-level auto-approve behavior

(Written by Copilot)

* Move auto-approve picker to NewSessionControl (left side)

Render the autoApprove picker in the same location as the normal EH
permission picker (Menus.NewSessionControl, left side) instead of
alongside target/branch on the right side.

- Skip autoApprove property in main session config picker
- Add AgentHostNewSessionApprovePicker registered on NewSessionControl
- Existing running session picker on ChatInputSecondary unchanged

(Written by Copilot)

* Use named type for mutableProperties annotation

Address Copilot review: use IResolveSessionConfigResult indexed type
instead of typeof expression for clearer type annotation.

(Written by Copilot)
R
Rob Lourens committed
39b97f8097ccc3c9d2381862dfe017e67629ef62
Parent: 90c4da9
Committed by GitHub <noreply@github.com> on 4/13/2026, 4:58:18 PM