Add auto-approve session config for agent host#309513
Merged
roblourens merged 3 commits intomainfrom Apr 13, 2026
Merged
Conversation
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)
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)
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a session-scoped “auto-approve” configuration to Agent Host sessions in the Sessions app, so approval level can be set per session (and changed mid-session) rather than behaving like a global toggle.
Changes:
- Introduces an
autoApprovesession config property (default/autoApprove/autopilot) and uses it to bypass tool confirmations at the agent-host side. - Adds UI pickers + styling for choosing elevated approval levels (with policy gating and confirmation prompts).
- Enables mid-session config updates by caching session-mutable config in local/remote session providers and dispatching
session/configChanged.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts | Cache + dispatch of session-mutable config for running remote sessions |
| src/vs/sessions/contrib/localAgentHost/browser/localAgentHostSessionsProvider.ts | Cache + dispatch of session-mutable config for running local sessions |
| src/vs/sessions/contrib/chat/browser/media/agentHostSessionConfigPicker.css | Visual styling for elevated approval levels on the picker trigger |
| src/vs/sessions/contrib/chat/browser/agentHostSessionConfigPicker.ts | Session approvals picker UI, policy gating, and confirmation dialogs |
| src/vs/platform/agentHost/test/node/agentSideEffects.test.ts | Adds unit coverage for session-level auto-approve behaviors |
| src/vs/platform/agentHost/node/copilot/copilotAgent.ts | Extends session config schema/values with autoApprove |
| src/vs/platform/agentHost/node/agentSideEffects.ts | Implements unconditional auto-approval when session config is elevated |
Copilot's findings
- Files reviewed: 7/7 changed files
- Comments generated: 4
Contributor
Address Copilot review: use IResolveSessionConfigResult indexed type instead of typeof expression for clearer type annotation. (Written by Copilot)
connor4312
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add an
autoApprovesession config property to the Copilot agent host with three options matching the extension host permission picker: Default Approvals, Bypass Approvals, and Autopilot (Preview).Changes
Session config schema (
copilotAgent.ts)autoApproveproperty toresolveSessionConfig()withsessionMutable: truedefault,autoApprove,autopilotAuto-approval behavior (
agentSideEffects.ts)_tryAutoApproveToolReady(): whenautoApproveisautoApproveorautopilot, auto-approve all tool calls unconditionally (bypasses per-file and per-command rules)UI — New session picker (
agentHostSessionConfigPicker.ts)chat.autopilot.enabledsettingchat.tools.global.autoApprovegetConfigIcon()(shield/warning/rocket)UI — Running session picker (
agentHostSessionConfigPicker.ts)MenuId.ChatInputSecondary(same location as normal agent permission picker)ChatContextKeyExprs.isAgentHostSessioncontext keyMid-session config changes (both providers)
setSessionConfigValue()dispatchesSessionConfigChangedaction for running sessions_preserveSessionMutableConfig()transfers mutable config when session transitions from new to committed_handleConfigChanged()updates running config cache (creates minimal entry for restored sessions)_runningSessionConfigsentries deleted on session removal/deletion/disconnectTests (
agentSideEffects.test.ts)Notes
(Written by Copilot)