Skip to content

agentHost: preserve legacy policy-required sandboxing - #339144

Merged
Ross Wollman (rwoll) merged 3 commits into
mainfrom
rwoll/agent-host-sandbox-policy-1e415032
Oct 1, 2026
Merged

Ross Wollman (rwoll) merged 3 commits into
mainfrom
rwoll/agent-host-sandbox-policy-1e415032

Conversation

@rwoll

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

Copy link
Copy Markdown
Member

Prevent a per-session Off selection from overriding the legacy VS Code ChatAgentSandboxEnabled: on policy in Copilot Agent Host on macOS/Linux.

The policy already locked the global chat.agent.sandbox.enabled setting, and sandboxing remained enabled for sessions following that setting. However, forwarding preserved only the resolved on value, not the fact that it was mandatory. Agent Host therefore treated the policy like a personal preference, allowing a session-level Off selection to override it.

Scope

  • Affected: Copilot Agent Host sessions on macOS/Linux governed by the legacy VS Code ChatAgentSandboxEnabled: on policy, when a session selects or already has an Off override.
  • Not a general sandbox failure: the sandbox implementation itself and the legacy Local harness are not changed. Runtime-managed sandbox.enabled: true already has enforcement and session controls from #338172; that is a separate policy path.
  • Personal sandbox preferences remain overridable. Windows continues to use its separate chat.agent.sandbox.enabledWindows setting.

Change

  • Forward the legacy policy requirement separately from editable root settings. The host aggregates connection-owned contributions restrictively, so settings edits or another client cannot clear an active requirement.
  • Combine that requirement with the host's existing runtime policy restrictions. Reconnect restores the contribution before authentication and session replay; withdrawal or disconnect-grace expiry removes only the owning client's contribution.
  • Enforce the requirement in session configuration, not just the UI, and publish the effective policy to the existing session controls.
  • Apply policy arrival and withdrawal to running sessions, including their peer chats and subagents. Preserve permitted SDK-approved bypasses without weakening runtime restrictions.

No SDK or runtime change is required. This addresses the legacy sandbox-enable gap described in #339023, not its other policy-parity gaps.

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

Carry legacy sandbox policy provenance into Agent Host session configuration so a session Off selection cannot override mandatory enablement. Preserve personal preferences, permitted bypasses, runtime restrictions, and the separate Windows enablement setting.

🤖 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 1, 2026 17:32

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

Ross Wollman (rwoll) and others added 2 commits October 1, 2026 11:41
Keep mandatory sandbox enablement in handler-scoped client policy contributions, aggregated restrictively and restored before reconnect replay. Ordinary root settings and other clients can no longer clear an active requirement. Preserve runtime restrictions and scoped withdrawal/disconnect cleanup.

🤖 Authored with GitHub Copilot on behalf of @rwoll.

Co-authored-by: Copilot <[email protected]>
Preserve the upstream removal of the Octokit service while keeping client-managed sandbox policy owned by the service foundation. Revalidate the policy transport and runtime enforcement against current main.

🤖 Authored with GitHub Copilot on behalf of @rwoll.

Co-authored-by: Copilot <[email protected]>
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Anthony Kim (@anthonykim1)

Matched files:

  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/agentHostSandboxForwarder.test.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/common/sandboxSettingsReader.test.ts

@rwoll
Ross Wollman (rwoll) merged commit 0fc14ed into main Oct 1, 2026
35 checks passed
@rwoll
Ross Wollman (rwoll) deleted the rwoll/agent-host-sandbox-policy-1e415032 branch October 1, 2026 22:16
@vs-code-engineering vs-code-engineering Bot added this to the 1.141.0 milestone Oct 1, 2026
Ross Wollman (rwoll) added a commit that referenced this pull request Oct 2, 2026
The Local harness is being deprecated in favor of Agent Host, backed by
the Copilot SDK. Rollout has started, but some existing VS Code
enterprise policies need translation into the SDK's Unified Managed
Settings so enterprise controls remain intact during the transition.

## What this PR does

- **Enables supported legacy policy conversion by default.** Removes the
separate bridge opt-in,
`chat.agentHost.copilot.mapLegacySettingsToManagedSettings`. When
rollout or explicit selection chooses Copilot Agent Host, supported
restrictions carry over automatically. Native terminal restrictions,
including global user settings, still require approval under Allow
All/assisted approval.
- **Adds applied-policy readiness diagnostics.** Run **Developer: Policy
Diagnostics** from the Command Palette to see conversion/enforcement
coverage, source, impact, and remaining gaps. Separates unsupported
requirements from source/path-dependent coverage needing verification;
excludes unconfigured policies and preserves existing diagnostic
sections.

Policy gaps appear in diagnostics but do not block Agent Host rollout.
Existing rollout behavior is unchanged, and supported policy
restrictions remain enforced.

Scope: Copilot Agent Host on this machine, not certification of remote
hosts or other providers.

Refs #332011, #337536, #337537.

## Accepted gaps (report-only)

Accepted for this PR's rollout posture, not reclassified as enforced or
treated as individual administrator consent. Source/path-dependent
findings may already be enforced by runtime-native settings. OTel is
implemented; its entries concern remaining forwarding, precedence, and
runtime coverage. Its policies also reference
`github.copilot.chat.otel.enabled`,
`github.copilot.chat.otel.exporterType`,
`github.copilot.chat.otel.captureIdentity`, and
`github.copilot.chat.otel.headers`.

**Merged fixes:**
[#339144](#339144) closes the
legacy macOS/Linux `ChatAgentSandboxEnabled: on` gap allowing direct
session Off overrides; it is omitted below. Host identity capture is
also fixed by
[#339045](#339045). Both fixes
are merged into `main`; this is not a claim of release availability.

Sandbox lifecycle validation remains open: distinguish policy still
loading from confirmed withdrawal, and verify loss/reapplication of the
last client's requirement across disconnect-grace expiry. The separate
sandbox auto-approval gap remains below.

| Policy / setting | Remaining impact |
|---|---|
| `ChatToolsEligibleForAutoApproval` /
`chat.tools.eligibleForAutoApproval` | Bypass is disabled for excluded
tools, but per-tool confirmation is not guaranteed through other
approval paths. |
| `ChatToolsTerminalEnableAutoApprove` /
`chat.tools.terminal.enableAutoApprove` | Native shell asks are covered;
custom-terminal coverage is incomplete
(`chat.agentHost.customTerminalTool.enabled`). |
| `ChatAgentSandboxAllowAutoApprove` /
`chat.agent.sandbox.allowAutoApprove` | Active sandboxed commands may
auto-approve without an equivalent blanket shell ask. Activation
includes `chat.agent.sandbox.enabledWindows`. |
| `ChatMCP` / `chat.mcp.access` | Independent runtime discovery can
escape workbench access filtering. |
| `ChatAllowedMcpServers` /
`chat.mcp.allowedServers`<br>`ChatDeniedMcpServers` /
`chat.mcp.deniedServers`<br>`ChatAllowManagedMcpServersOnly` /
`chat.mcp.allowManagedServersOnly` | VS Code-only restrictions do not
reach every forwarded, discovered, or built-in server path. |
| `McpEnterpriseManagedAuthIdp` / `mcp.enterpriseManagedAuth.idp` |
Forwarded authentication lacks Local's enterprise IdP lookup; SSO may
fail. |
| `ChatPluginsEnabled` / `chat.plugins.enabled`<br>`ChatEnabledPlugins`
/ `chat.plugins.enabledPlugins` | Independent discovery and
customization paths can bypass disablement or required-plugin decisions.
|
| `ChatExtraMarketplaces` /
`chat.plugins.extraMarketplaces`<br>`ChatStrictMarketplaces` /
`chat.plugins.strictMarketplaces` | Runtime-owned operations lack VS
Code-only values; strict lists do not disable installed plugins. |
| `ChatStrictPluginOnlyCustomization` /
`chat.customizations.strictPluginOnlyCustomization` | Independent
discovery, instructions, and selective lockdown lack equivalent
coverage. |
| `ChatHooks` / `chat.useHooks`<br>`ChatAllowManagedHooksOnly` /
`chat.hooks.allowManagedOnly` | The Local switch does not disable
runtime file hooks; managed-only file-hook/SDK-callback coverage is
incomplete or unverified. |
| `ChatAgentMode` / `chat.agent.enabled` | Agent Host targets can remain
available when agent mode is disabled. |
| `CopilotOtelEnabled` / `chat.agentHost.otel.enabled` | Separate
destinations/recorders can override disablement. |
| `CopilotOtelProtocol` / `chat.agentHost.otel.exporterType` | Inherited
OTLP configuration can override exporter selection. |
| `CopilotOtelCaptureIdentity` / `chat.agentHost.otel.captureIdentity` |
Host identity capture is fixed
([#339045](#339045)); runtime
account attribution awaits upstream merge, a bundled runtime roll, and
end-to-end verification. No additional VS Code account-identity wiring
is expected. |
| `CopilotOtelHeaders` / `chat.agentHost.otel.headers` | Missing host
forwarding can break authenticated export. |
| `ChatAgentNetworkFilter` /
`chat.agent.networkFilter`<br>`ChatAgentAllowedNetworkDomains` /
`chat.agent.allowedNetworkDomains`<br>`ChatAgentDeniedNetworkDomains` /
`chat.agent.deniedNetworkDomains` | Legacy allowlists are not mandatory
boundaries on native runtime URL/shell paths; supported URL denies and
shared VS Code filtering remain. Domain `limitTo` integration is
accepted follow-up work, not a landing prerequisite. |

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*
Ross Wollman (rwoll) added a commit that referenced this pull request Oct 2, 2026
## Summary

Retire legacy VS Code sandbox policies from the Copilot Agent Host
policy contract and roll back the mandatory legacy sandbox requirement
added by #339144. Enterprise sandbox enforcement in Agent Host should
use [Copilot managed
settings](https://docs.github.com/en/copilot/how-tos/administer-copilot/manage-for-enterprise/use-managed-settings/get-started),
not migration of the old preview device policies.

- Remove the connection-owned legacy sandbox requirement, while
retaining native managed sandbox enforcement and the later
session-restoration/reconciliation fixes.
- Mark nine legacy sandbox settings deprecated, keep their migration
notices visible, and preserve their defaults. Add deprecation and
replacement guidance to the four device-policy descriptions and
generated catalog.
- Classify those four retired policies as `notApplicable`, rather than
outstanding Agent Host parity gaps. Update diagnostics, tests, and
contributor documentation together. New Agent Host sandbox controls are
not deprecated.

## Admin and user impact

**`ChatAgentSandboxEnabled: on` no longer guarantees sandboxing in Agent
Host.** Existing setting forwarding remains, so it can supply an On
default, but a session Off selection can override it.

To require sandboxing in Copilot Agent Host, use native managed
`sandbox.enabled: true`. Use `sandbox.allowBypass: false` when bypass
must be prohibited. Outbound network restrictions use
`sandbox.userPolicy.network.allowOutbound`.

Local harness behavior is unchanged. Native managed restrictions,
permitted-bypass controls, restored-session reconciliation, and other
legacy permission translations remain intact. `notApplicable` records
the retirement of the legacy policy contract; it does not mean forwarded
settings have no effect or certify enforcement parity.

The deprecated device policies are `ChatAgentSandboxEnabled`,
`ChatAgentSandboxAllowNetwork`,
`ChatAgentSandboxAllowUnsandboxedCommands`, and
`ChatAgentSandboxAllowAutoApprove`.

## Validation

- Rebased onto current `main`; core compilation completed with zero
errors.
- 528 focused tests passed, covering native sandbox enforcement,
restoration, bypass/fail-closed behavior, ordinary forwarding,
connection lifecycle, deprecation metadata, catalog classifications, and
diagnostics.
- A test-only follow-up fixes two stale CI expectations. Both failures
were reproduced locally, then the affected suites passed 69 tests in
Electron and 68 in WebKit, including unchanged Local/Copilot rollout
selection.
- Targeted hygiene and whitespace checks passed.
- Canonical Workbench and Agents policy-export check passed.

Live MDM deployment was not exercised. Release notes and sandbox
migration guidance have also been updated locally in `vscode-docs` for
separate publication.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*
LeeHansHinLun pushed a commit to Deslopify/code that referenced this pull request Oct 2, 2026
Roll back the connection-owned sandbox requirement from microsoft#339144 while preserving native managed sandbox enforcement, restoration and ordinary setting forwarding. Deprecate the legacy settings and device policies, and mark the retired policy surface not applicable to Agent Host.

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

Co-authored-by: Copilot <[email protected]>
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Nov 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants