Skip to content

chat: require Agent Host for managed permissions - #340617

Merged
Ross Wollman (rwoll) merged 19 commits into
mainfrom
rwoll/managed-permissions-harness-v2
Oct 9, 2026
Merged

Ross Wollman (rwoll) merged 19 commits into
mainfrom
rwoll/managed-permissions-harness-v2

Conversation

@rwoll

@rwoll Ross Wollman (rwoll) commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Supersedes #340408. Builds on the automatic migration and cleanup in #340585 and #340596.

Any nonempty managed permissions object now requires Copilot Agent Host, including
defaults, explicit false / "enable", and empty rule lists. This reuses the existing
Local chat migration without sending anything automatically.

Copilot's permission picker reflects runtime restrictions and defaults, allowing
admins to block Allow All while keeping Assisted available. Explicit new mode
restrictions replace the legacy blanket restriction; defaultMode alone does not.

Empty permissions: {} and legacy policy alone retain existing Local behavior.
Editor Inline Chat keeps its limited read/edit exception. Sandboxing remains independent.

Policy behavior

Legacy ChatToolsAutoApprove: false with no managed permissions still blocks
both Allow All and Assisted in Copilot Agent Host.
It does not force users off
Local. A nonempty permissions object determines harness eligibility; only an
explicit new mode restriction replaces the legacy blanket mode restriction.

The table shows selectable modes, not the starting selection. It assumes all
modes are supported and no additional restrictions. Legacy JSON represents policy
values, not OS-specific deployment syntax. Local does not support Assisted.

# Legacy policy JSON Managed-settings JSON Full Local chat AH: Allow All AH: Assisted AH: Manual
1 {} {} Available ✅ ✅ ✅
2 {"ChatToolsAutoApprove":false} {} Available, legacy restrictions ❌ ❌ ✅
3 {} {"permissions":{"disableBypassPermissionsMode":"disable"}} Migrate to Copilot ❌ ✅ ✅
4 {"ChatToolsAutoApprove":false} {"permissions":{"disableBypassPermissionsMode":"disable"}} Migrate to Copilot ❌ ✅ ✅
5 {} {"permissions":{"disableAssistedPermissionsMode":true}} Migrate to Copilot ✅ ❌ ✅
6 {"ChatToolsAutoApprove":false} {"permissions":{"disableAssistedPermissionsMode":true}} Migrate to Copilot ✅ ❌ ✅
7 {"ChatToolsAutoApprove":false} {"permissions":{"disableBypassPermissionsMode":"disable","disableAssistedPermissionsMode":true}} Migrate to Copilot ❌ ❌ ✅
8 {"ChatToolsAutoApprove":false} {"permissions":{"disableBypassPermissionsMode":"enable"}} Migrate to Copilot ✅ ✅ ✅
9 {"ChatToolsAutoApprove":false} {"permissions":{"disableAssistedPermissionsMode":false}} Migrate to Copilot ✅ ✅ ✅
10 {} {"permissions":{"defaultMode":"assisted"}} Migrate to Copilot ✅ ✅ ✅
11 {"ChatToolsAutoApprove":false} {"permissions":{"defaultMode":"assisted"}} Migrate to Copilot ❌ ❌ ✅
12 {"ChatToolsAutoApprove":false} {"permissions":{"ask":[]}} Migrate to Copilot ❌ ❌ ✅

permissions: {} behaves like no permissions object. Rows 6, 8, and 9 intentionally
replace the legacy restriction with the explicitly configured new mode controls.
Rows 11 and 12 require Agent Host but retain the legacy mode restriction.
In row 10, Assisted is the starting default unless an explicit or remembered
choice takes precedence; in row 11 it is unavailable, so the default falls back
to Manual.

“Migrate to Copilot” means full Local execution is unavailable: new chats use
Copilot and existing Local chats migrate when displayed. The editor-inline
exception above remains. Managed sandbox.enabled: true independently requires
Agent Host even when permissions are absent.

Testing

Test with only permissions.disableBypassPermissionsMode: "disable": full Local chats
should move to Copilot, Allow All should be unavailable, and Assisted should remain
selectable. Also test policy removal and an empty permissions object.

Relates #338932.

Relates https://github.com/microsoft/vscode-internalbacklog/issues/9987.

🤖 Authored with GitHub Copilot on behalf of Ross Wollman (@rwoll).

Ross Wollman (rwoll) and others added 16 commits October 7, 2026 17:14
Resolve native approval policy in the Copilot host and advertise available and effective modes to both windows. Apply the legacy blanket only when no explicit new mode restriction is configured, retaining independent tool restrictions.

Use the same host-authoritative path on desktop and remote hosts while preserving legacy client guards for peers without approval reports.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>
Retain the reviewed SDK 1.0.18-preview.1 and runtime 1.0.94-1 while incorporating current upstream changes. The only conflicts were the older upstream SDK dependency entries.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>
Use allowed and blocked indicators matching the reviewed PR table.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>
Mark scenarios 6 and 8 in the permission matrix without changing their behavior.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>
Preserve the permission policy resolver import alongside upstream bulk questions and Mission Control changes. Validated the merged client build, typecheck, lint, and 1839 focused host tests.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>
Reviewed-head: 6dc6e8e
Pull-request: #340408
Approved-by: rwoll via PR Sign-Off
Requested-by: copilot
Retain upstream provider timing and detached-service support alongside managed approval policies. Use the SDK/runtime versions already rolled on main instead of carrying a dedicated dependency bump.

🤖 Authored with GitHub Copilot on behalf of @rwoll.

Co-authored-by: Copilot <[email protected]>
Do not overwrite the actual SDK result with the requested allow-all mode after a policy-constrained response. Publish the actual applied selection consistently with ordinary synchronization.

Confirmed the bundled runtime returns success:false, mode:manual for blocked allow-all. Both new regressions failed before the fix; five focused toggle/synchronization tests and targeted lint pass.

🤖 Authored with GitHub Copilot on behalf of @rwoll.

Co-authored-by: Copilot <[email protected]>
Give launch/runtime policy snapshots, selection reconciliation, response acceptance, and applied reports one session-owned object. Keep SDK calls, sequencing, retry timing, configuration publication, and lifecycle in CopilotAgentSession.

Preserve the approved precedence matrix and recomputation/event timing, including consulting current policy after SDK calls. Add standalone transition and result-acceptance coverage.

Validation: 1113 policy/session/launcher tests passed; strict initialization/type check and targeted hygiene passed.

🤖 Authored with GitHub Copilot on behalf of @rwoll.

Co-authored-by: Copilot <[email protected]>
Keep explicit and remembered approval preferences until the host advertises its policy contract. Normalize both standard and VS Code approval bindings, wait for resolved preferences before prewarming, and retain legacy restrictions for older peers.\n\nValidate existing-session approval writes as runtime changes and let live Copilot sessions apply native-policy precedence for approval toggles.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>
Provide the new service contracts in paste and session-identity mocks. Assert config replacement over writable client values without requiring host-owned readonly reports to disappear.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>
Merge origin/main at 4bd93ff without rewriting the PR history.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>
Keep only explicit approval defaults before discovery, translate completion keys and values for standard hosts, and retain unavailable Editor choices as disabled. Surface completion write failures and cover provider-neutral defaults and acceptance paths. Clarify that legacy Local does not provide Assisted mode.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>
Include the merged automatic-migration cancellation fix and preserve both SDK type imports at the session-launcher merge boundary.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>
*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>
Route nonempty managed permissions to Copilot regardless of individual values. Preserve effective permission-key presence across delivery, observe all current native permission controls, and reuse the existing Local execution gate and automatic migration. Keep editor inline chat and legacy-only policy behavior unchanged.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 9, 2026 00:10

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.

🟡 Changes recommended

Standard approvalMode hosts currently bypass write validation and are misread when their effective mode is allow-all.

2 open findings
What changed in this PR

Requires Copilot Agent Host for managed permission settings and aligns approval-mode policy across runtime, Editor, and Agents Window.

Changes:

  • Detects any nonempty managed permissions configuration.
  • Publishes and enforces host-managed approval modes.
  • Updates permission pickers, migration behavior, documentation, and tests.
File Description
.github/​skills/​policy-and-managed-settings/​sdk-runtime-policy.md Documents managed permission behavior
src/​vs/​platform/​agentHost/​common/​agentHostEnablementService.ts Updates enablement contract
src/​vs/​platform/​agentHost/​common/​agentHostManagedSettings.ts Adjusts legacy policy bridging
src/​vs/​platform/​agentHost/​common/​sessionConfigProperties.ts Handles approval policy reports
src/​vs/​platform/​agentHost/​node/​agentService.ts Validates reported approval modes
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgent.ts Resolves runtime approval policy
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentSession.ts Synchronizes applied permission modes
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentStartupConfig.ts Tracks legacy restriction state
src/​vs/​platform/​agentHost/​node/​copilot/​copilotApprovalPolicy.ts Implements approval-policy resolution
src/​vs/​platform/​agentHost/​node/​copilot/​copilotSessionLauncher.ts Supplies runtime policy and flags
src/​vs/​platform/​agentHost/​node/​sessionPermissions.ts Applies host-reported effective modes
src/​vs/​platform/​agentHost/​test/​browser/​agentHostEnablementService.test.ts Updates managed-settings fixtures
src/​vs/​platform/​agentHost/​test/​common/​agentHostManagedSettings.test.ts Tests legacy bridge behavior
src/​vs/​platform/​agentHost/​test/​electron-browser/​agentHostProtocolClient.test.ts Tests root-policy forwarding
src/​vs/​platform/​agentHost/​test/​node/​agentService.test.ts Tests config validation and defaults
src/​vs/​platform/​agentHost/​test/​node/​copilotAgent.test.ts Tests native policy toggles
src/​vs/​platform/​agentHost/​test/​node/​copilotAgentSession.test.ts Tests runtime mode reconciliation
src/​vs/​platform/​agentHost/​test/​node/​copilotApprovalPolicy.test.ts Covers policy combinations
src/​vs/​platform/​agentHost/​test/​node/​copilotSessionLauncher.test.ts Tests launch policy injection
src/​vs/​platform/​agentHost/​test/​node/​copilotTestEvents.ts Adds unmanaged-settings mock
src/​vs/​platform/​agentHost/​test/​node/​e2e/​suites/​stateOperationsSuite.ts Excludes read-only config reports
src/​vs/​platform/​agentHost/​test/​node/​providerIntegration/​copilotAutoTier.integrationTest.ts Narrows asserted tier values
src/​vs/​platform/​agentHost/​test/​node/​providerIntegration/​copilotManagedPermissions.integrationTest.ts Tests runtime mode restrictions
src/​vs/​platform/​agentHost/​test/​node/​sessionPermissions.test.ts Tests host policy enforcement
src/​vs/​platform/​policy/​common/​copilotManagedSettings.ts Detects permission-key presence
src/​vs/​platform/​policy/​test/​common/​copilotManagedSettings.test.ts Tests harness requirements
src/​vs/​platform/​policy/​test/​common/​fileManagedSettingsService.test.ts Tests permission serialization
src/​vs/​platform/​policy/​test/​node/​nativeManagedSettingsService.test.ts Tests native permission watching
src/​vs/​sessions/​contrib/​chat/​browser/​agentHostInputCompletions.ts Routes config actions through providers
src/​vs/​sessions/​contrib/​chat/​browser/​copilotConfigSlashSubmitHandler.ts Supplies resolved session config
src/​vs/​sessions/​contrib/​chat/​test/​browser/​agentHostInputCompletions.test.ts Tests standard approval writes
src/​vs/​sessions/​contrib/​chat/​test/​browser/​newChatInputPaste.test.ts Adds provider-service fixture
src/​vs/​sessions/​contrib/​providers/​agentHost/​browser/​agentHostPermissionPickerDelegate.ts Uses host policy reports
src/​vs/​sessions/​contrib/​providers/​agentHost/​browser/​baseAgentHostSessionsProvider.ts Defers clamping until discovery
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​localAgentHostSessionsProvider.test.ts Tests discovered approval defaults
src/​vs/​sessions/​contrib/​providers/​copilotChatSessions/​browser/​mobilePermissionPicker.ts Reuses delegated restriction state
src/​vs/​sessions/​contrib/​providers/​copilotChatSessions/​browser/​permissionPicker.ts Supports host-owned restrictions
src/​vs/​sessions/​contrib/​providers/​copilotChatSessions/​test/​browser/​permissionPicker.test.ts Updates managed-settings fixture
src/​vs/​sessions/​contrib/​providers/​remoteAgentHost/​test/​browser/​remoteAgentHostSessionsProvider.test.ts Tests remote host authority
src/​vs/​workbench/​contrib/​chat/​browser/​actions/​chatAccessibilityHelp.ts Updates managed-policy help text
src/​vs/​workbench/​contrib/​chat/​browser/​agentHostCompletionAction.ts Validates completion approval actions
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostChatInputPicker.ts Disables unavailable approval rows
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostSessionHandler.ts Normalizes config after discovery
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostUntitledProvisionalSessionService.ts Preserves approval seeds
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentSessionSettingsFileSystemProvider.ts Omits host-owned reports
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​applyAgentHostSessionConfig.ts Resolves current approval schema
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​applyAgentHostSubmitConfig.ts Passes resolved config metadata
src/​vs/​workbench/​contrib/​chat/​browser/​widget/​input/​editor/​agentHostInputCompletions.ts Uses advertised approval binding
src/​vs/​workbench/​contrib/​chat/​browser/​widget/​input/​permissionPickerActionItem.ts Supports delegated restrictions
src/​vs/​workbench/​contrib/​chat/​common/​agentHostConfigPolicy.ts Centralizes client policy normalization
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentHostCompletionAction.test.ts Tests binding and policy behavior
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentHostChatContribution.test.ts Extends configuration fixture
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentHostChatInputPicker.test.ts Tests disabled policy choices
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentHostSessionUri.test.ts Tests standard binding dispatch
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentHostUntitledProvisionalSessionService.test.ts Tests prewarming policy behavior
src/​vs/​workbench/​contrib/​chat/​test/​browser/​widget/​input/​chatModelConfigurationStore.test.ts Updates managed-settings mocks
src/​vs/​workbench/​contrib/​chat/​test/​browser/​widget/​input/​editor/​chatInputCompletions.test.ts Adds connection-service fixtures
src/​vs/​workbench/​contrib/​chat/​test/​browser/​widgetHosts/​editor/​chatEditorInput.test.ts Tests managed permission routing
src/​vs/​workbench/​contrib/​chat/​test/​browser/​widgetHosts/​viewPane/​chatViewPane.test.ts Tests policy-gated migration
src/​vs/​workbench/​contrib/​chat/​test/​common/​chatService/​chatService.test.ts Expands managed-permission coverage
src/​vs/​workbench/​services/​policies/​common/​accountPolicyService.ts Exposes effective managed settings
src/​vs/​workbench/​services/​policies/​test/​browser/​accountPolicyService.test.ts Tests permission presence lifecycle

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Validate the advertised approval property and normalize effective standard modes. Publish composed availability changes while idle and dismiss stale picker choices without losing allowed draft selections.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>

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.

🟡 Changes recommended

Legacy policy can be bypassed when no approval preference exists, and standard AHP report fields are incorrectly returned in client configuration writes.

3 open findings
2 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Strip read-only approval reports for both binding aliases

src/​vs/​platform/​agentHost/​common/​sessionConfigProperties.ts:137

This strips host-owned approval reports only for the VS Code autoApprove alias. With the standard approvalMode binding, NewSession merges the discovered values into its follow-up resolveSessionConfig request, so availableApprovalModes/effectiveApprovalMode are sent back even though the host advertised them as read-only reports. Omit these report keys based on their read-only schema in either binding.

🧠 Review effort: Balanced

Re-resolve selectable approval modes for retained session config when the Copilot client starts. Preserve the last runtime-applied mode, avoid resuming chats, and discard reports superseded by a new client, resumed chat, or removed session.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: f9ee4864 Current: a2abdefd

Changed (1)

sessions/chatCompositeBar/OverflowingTabs/Light
Before After
before after

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.

🔵 Needs a closer look

Memory-scoped approval defaults are dropped, and untitled pickers can display a stale host-reported effective mode.

3 open findings
Previously missed (2)

In code that hasn't changed since last review

Medium severity Use server precedence for both approval report fields

src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostChatInputPicker.ts:830

effectiveApprovalMode is also a host-owned read-only report, but untitled sessions still let the provisional overlay override it. If the stale overlay mode remains in the host's available list, the chip and hover show the stale effective mode even after the runtime has changed it. Give both approval-report fields server precedence.

Medium severity Include memory-scoped chat configuration overrides

src/​vs/​workbench/​contrib/​chat/​common/​agentHostConfigPolicy.ts:26

Memory-scoped chat.defaultConfiguration overrides are omitted here. Both callers previously read the effective value (getValue() / inspect().value), where memory configuration has higher precedence than workspace and user configuration, so a temporary explicit approval default now silently falls back to a lower layer. Include inspected.memoryValue immediately after policy while still excluding defaultValue.

🧠 Review effort: Balanced

Discover and seed the advertised Manual binding before unseeded legacy-policy sessions can prewarm. Validate policy-report bindings, preserve memory-scoped preferences, and keep host-owned reports out of client writes for both aliases.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>
@rwoll
Ross Wollman (rwoll) marked this pull request as ready for review October 9, 2026 02:14
@rwoll
Ross Wollman (rwoll) enabled auto-merge (squash) October 9, 2026 02:15
@rwoll
Ross Wollman (rwoll) merged commit fa64687 into main Oct 9, 2026
35 checks passed
@rwoll
Ross Wollman (rwoll) deleted the rwoll/managed-permissions-harness-v2 branch October 9, 2026 02:19
@vs-code-engineering vs-code-engineering Bot added this to the 1.142.0 milestone Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants