Repository navigation
Fix managed sandbox settings and session bypass controls - #338172
Conversation
Keep sandbox settings and session controls aligned with managed policy, publish host-confirmed state and failures, and route session opt-out through pending SDK bypass requests. Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The SDK request-correlation ordering remains unsafe, and the canonical sandbox-toggle tests still assert the previous behavior.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Aligns sandbox policy enforcement across Agent Host, Settings, Workbench, and Agents Window.
Changes:
- Adds deny-wins managed sandbox resolution and live Settings refresh.
- Publishes host-confirmed policy/state to sandbox pickers and notifications.
- Routes approved session bypasses through the SDK and expands tests/documentation.
| File | Description |
|---|---|
settingsTreeModels.test.ts |
Tests managed Settings values. |
settingsTree.test.ts |
Tests managed renderers. |
settingsEditor2.test.ts |
Tests live policy refresh. |
settingsTreeModels.ts |
Projects managed sandbox values. |
settingsEditor2.ts |
Refreshes Settings on policy changes. |
agentHostSandboxNotifications.test.ts |
Tests client-scoped errors. |
agentHostGenericConfigChips.test.ts |
Adds environment setup. |
agentHostChatInputPicker.test.ts |
Tests host policy/state behavior. |
agentHostSandboxNotifications.ts |
Reports sandbox update failures. |
agentHostModePickerPresentation.ts |
Updates accessibility guidance. |
agentHostChatInputPicker.ts |
Consumes host sandbox metadata. |
agentHost.contribution.ts |
Registers notifications. |
permissionPicker.test.ts |
Tests locking and re-enablement. |
permissionPicker.ts |
Adds confirmed sandbox state. |
localAgentHostSessionsProvider.test.ts |
Tests policy propagation and rollback. |
agentHostModePicker.test.ts |
Tests prepublication fallback. |
agentHostPermissionPickerDelegate.test.ts |
Tests host policy projection. |
baseAgentHostSessionsProvider.ts |
Exposes sandbox policy/state. |
agentHostPermissionPickerDelegate.ts |
Derives picker sandbox state. |
chat.contribution.ts |
Registers Sessions notifications. |
agentHostSessionsProvider.ts |
Extends provider sandbox API. |
sandboxSettingsResolutionHelper.test.ts |
Tests resolution rules. |
sandboxSettingsResolutionHelper.ts |
Centralizes sandbox resolution. |
copilotManagedSettings.test.ts |
Tests deny-wins composition. |
copilotManagedSettings.ts |
Adds outbound managed control. |
editArcReporter.test.ts |
Updates service stub. |
sessionSandbox.test.ts |
Tests policy, bypass, and rollback. |
sandboxConfigForSdk.test.ts |
Updates SDK expectations. |
copilotShellTools.test.ts |
Tests effective terminal policy. |
copilotSessionLauncher.test.ts |
Tests launch-time sandbox policy. |
copilotAgentSession.test.ts |
Tests SDK bypass integration. |
agentSideEffects.test.ts |
Tests permission origin routing. |
agentHostChangesetOperationService.test.ts |
Updates configuration stub. |
sessionSandbox.ts |
Applies effective policy overrides. |
sessionPermissions.ts |
Gates session-bypass options. |
sandboxConfigForSdk.ts |
Defers optional capabilities. |
copilotSessionLauncher.ts |
Publishes applied sandbox state. |
copilotSandboxPolicy.ts |
Projects runtime sandbox policy. |
copilotAgentSession.ts |
Implements SDK session opt-out. |
copilotAgent.ts |
Forwards response context. |
agentSideEffects.ts |
Routes client action origin. |
agentService.ts |
Passes client sequence IDs. |
agentConfigurationService.ts |
Tracks policy, state, and rollback. |
agentSandboxStateMeta.ts |
Defines confirmed-state metadata. |
agentSandboxPolicyMeta.ts |
Defines policy metadata. |
agent.ts |
Extends permission contracts. |
agentHostSandboxToggle.ts |
Locks managed direct disabling. |
AGENTS.md |
Documents sandbox lifecycle. |
github-managed-settings.md |
Documents managed composition. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <[email protected]>
Align toggle tests with approved session bypass semantics, retain attachment read grants without hardcoded SDK defaults, and exclude incidental sandbox metadata from the client tool lifecycle snapshot. Co-authored-by: Copilot <[email protected]>
Distinguish desktop-only local managed policy fallback from browser behavior while retaining host policy assertions. Co-authored-by: Copilot <[email protected]>
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Raymond Zhao (@rzhao271)Matched files:
|
Bhavya U (bhavyaus)
left a comment
There was a problem hiding this comment.
this feels like a rather large change to take in without insiders bake time. Consider deferring to 1.141.0?
|
Yeah this is mostly sandbox related for managed policies. Some of the enterprises are looking to test this next week and provide feedback. I will create an extensive TPI for testing. |
6ed05a1
into
main
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](#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](#339023), not its other policy-parity gaps. *🤖 Authored with GitHub Copilot on behalf of @rwoll.*


Summary
Validation
Draft / follow-up