Skip to content

Fix managed sandbox settings and session bypass controls - #338172

Merged
Dileep Yavanmandha (dileepyavan) merged 4 commits into
mainfrom
DileepY/sandboxError_investigate
Sep 27, 2026
Merged

Dileep Yavanmandha (dileepyavan) merged 4 commits into
mainfrom
DileepY/sandboxError_investigate

Conversation

@dileepyavan

Copy link
Copy Markdown
Member

Summary

  • Keep sandbox enablement settings On and disabled whenever managed sandbox.enabled is true, regardless of allowBypass, with live Settings editor refresh and organization-managed indicators.
  • Publish host-owned sandbox policy and confirmed state to workbench and Agents Window pickers, retain local prelaunch policy fallback, and report rejected changes through client-scoped error notifications before rollback.
  • Route supported outside-sandbox "Allow in this Session" approvals through sandbox.disableForSession using the real pending SDK permission request ID; allow re-enablement after successful opt-out.
  • Share sandbox toggle resolution and apply deny-wins managed bypass/outbound restrictions without overwriting saved preferences; leave optional SDK capabilities without host settings to runtime defaults.

Validation

  • 172 tests passed covering Settings editor/model/renderers, sandbox settings resolution, SDK configuration mapping, session sandbox state, and managed-settings composition.
  • 126 sandbox-focused tests passed covering Copilot sessions/launcher, both picker surfaces, and notifications.
  • npm run typecheck-client passed.
  • ESLint passed on changed TypeScript files.
  • Repository formatting and pre-commit hygiene passed (one test file required repository formatting).

Draft / follow-up

  • A live user report remains unresolved: clicking "Allow in this Session" did not reach _disableSandboxForPendingRequest. Unit coverage passes, but the exact prompt/request path still needs investigation and end-to-end verification.
  • No final manual running-window validation has been completed.
  • An earlier broader picker run had one unrelated fractional-pixel layout assertion failure; layout code was left unchanged.

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]>
Copilot AI balanced review requested due to automatic review settings September 27, 2026 03:06

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.

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 Medium severity · 1 Low severity

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.

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 4336606a Current: a41287a8

Changed (2)

sessions/chatCompositeBar/MixedStatuses/Light
Before After
before after
sessions/sessionChatInputToolbar/SessionChatPills_HorizontalOverflow/Dark
Before After
before after

3 insignificant change(s) omitted (≤20 px, Δ≤2). See CI logs for details.

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]>
@dileepyavan
Dileep Yavanmandha (dileepyavan) marked this pull request as ready for review September 27, 2026 20:12
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

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

Raymond Zhao (@rzhao271)

Matched files:

  • src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts
  • src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts
  • src/vs/workbench/contrib/preferences/test/browser/settingsEditor2.test.ts
  • src/vs/workbench/contrib/preferences/test/browser/settingsTree.test.ts
  • src/vs/workbench/contrib/preferences/test/browser/settingsTreeModels.test.ts

@bhavyaus Bhavya U (bhavyaus) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels like a rather large change to take in without insiders bake time. Consider deferring to 1.141.0?

@dileepyavan

Copy link
Copy Markdown
Member Author

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.

@dileepyavan
Dileep Yavanmandha (dileepyavan) merged commit 6ed05a1 into main Sep 27, 2026
36 of 38 checks passed
@dileepyavan
Dileep Yavanmandha (dileepyavan) deleted the DileepY/sandboxError_investigate branch September 27, 2026 21:49
@vs-code-engineering vs-code-engineering Bot added this to the 1.140.0 milestone Sep 27, 2026
Ross Wollman (rwoll) added a commit that referenced this pull request Oct 1, 2026
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.*
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Nov 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants