Skip to content

sandbox: assign sandbox profiles to agent hosts (experimental) - #349390

Merged
Dileep Yavanmandha (dileepyavan) merged 13 commits into
mainfrom
DileepY/sandbox-profiles-ui
Nov 23, 2026
Merged

Dileep Yavanmandha (dileepyavan) merged 13 commits into
mainfrom
DileepY/sandbox-profiles-ui

Conversation

@dileepyavan

@dileepyavan Dileep Yavanmandha (dileepyavan) commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Experimental. This feature is off by default. The internal setting chat.agent.sandbox.profiles.enabled controls it. The Settings editor does not show this setting. You can set it in settings.json. An experiment can also set it.

Summary

This change adds sandbox profiles for agent hosts.

A sandbox profile is a named set of agent sandbox settings. You make profiles on your computer. You assign one profile to each remote agent host. The host uses that profile for its sessions.

Concepts

  • Profile library. Each computer keeps its own list of profiles. VS Code and the Agents window use the same list. Settings Sync does not sync the list.
  • Assignment. A host keeps one copy of its assigned profile, in the root setting sandboxProfile. The host is the only source of truth. Clients do not store a copy of this assignment.
  • Default. Default means "no profile". The host then uses its usual sandbox settings. The client sends sandboxProfile: {} to clear an assignment.

Main flows

1. Make a profile

  1. Run Manage Sandbox Profiles.
  2. Select New Profile. The new profile gets your current sandbox settings.
  3. Change the settings if necessary.
  4. Select Save. The profile goes into the library on this computer.

2. Assign a profile to a host

  1. Open Remote Environments.
  2. Connect to the host.
  3. In the Sandbox Profile column, select a profile.
  4. The client sends a copy of the profile to the host.
  5. The host validates the copy and saves it to disk.

To remove the assignment, select Default.

3. The host sends the assignment to all clients

  1. The host sends the change to each connected client.
  2. Each client updates its Sandbox Profile column.
  3. A client can see a profile that is not in its library. Then it shows "Name (on host)".
  4. Select Save "Name" to My Profiles to add that profile to your library. The copy keeps the same ID.

If two clients assign a profile to the same host, the last assignment is used.

4. Sessions use the profile

  1. A session starts, resumes, or starts a new turn.
  2. The host starts with its usual sandbox settings.
  3. The host applies the values of the assigned profile on top.
  4. The host applies session choices.
  5. The host applies organization policy last. Policy always wins.
  6. The host sends the result to the Copilot runtime.

A change to the assignment applies to the next turn of each session. It does not change a turn that runs at that time.

5. Edit a profile

  1. Edit the profile and select Save.
  2. The library updates on this computer.
  3. The client sends the new copy to each connected host that uses this profile.

6. Delete a profile

  1. Select Delete.
  2. If a connected host uses the profile, you cannot delete it. A dialog shows the names of these hosts.
  3. Assign a different profile or Default to these hosts. Then delete the profile.

The client cannot examine disconnected hosts. A disconnected host keeps its own copy of the profile. When it connects again, it shows the profile as "Name (on host)".

7. Reconnect and restart

  • When the host restarts, it reads the assignment from disk.
  • When a client connects again, it gets the current assignment from the host.
  • A client that connects again sends only its own sandbox setting. It does not send sandboxProfile. Thus, a reconnect does not change the assignment.

Limits

  • The host must run a server that includes this change. An older server does not support profiles. For these hosts, the Sandbox Profile column is disabled. The hover gives the reason.
  • When a host is disconnected, its column shows Default and is disabled. Connect to the host to see or change its profile.

User interface

  • Sandbox Profiles editor: make, edit, and delete profiles.
  • Remote Environments: a Sandbox Profile column for each remote host. The dropdown has its own container, so the chevron stays inside the box. The hover tells you the state of the column and the reason when it is disabled.
  • When the setting is off, VS Code does not show the command and the column. Hosts continue to apply assignments that they already have.

Main files

Area Files
Profile library platform/sandbox/common/sandboxProfiles.ts
Client helpers (assign, read, convert) platform/agentHost/common/sandboxProfiles.ts
Host schema and resolution platform/agentHost/common/sandboxConfigSchema.ts, platform/agentHost/node/sessionSandbox.ts
Editor chatAgentTools/browser/sandboxProfilesEditor.ts, sandboxProfilesInput.ts
Remote Environments remoteAgentHost/browser/remotesTable.ts, remotesWidget.ts
Setting and command chatAgentTools/common/terminalChatAgentToolsConfiguration.ts, terminal.chatAgentTools.contribution.ts
Select box hover option base/browser/ui/selectBox/* (hideSelectedOptionHover)

Validation

Unit tests examine these conditions:

  • The host resolves the profile correctly. This includes no assignment, an assignment, organization policy, Default, and values that are not valid.
  • The editor makes, saves, renames, and reverts profiles. Names must be unique.
  • Save updates only connected hosts that use the profile.
  • You cannot delete a profile that a connected host uses.
  • You can assign a profile without a connection to a session.
  • The column is disabled for hosts that are disconnected or do not support profiles.
  • A different device sees the assignment and can save it. The last assignment is used.
  • A reconnect does not change the assignment.
  • The column shows only when the setting is on.

Type check, formatter, oxlint, stylelint, and the layers check pass.

Add Sandbox: Manage Sandbox Profiles, a dialog for creating, editing,
and deleting named presets of the sandbox settings. Profiles are stored
locally in the user profile. Saved profiles open read-only until edited,
and new profiles start from the current effective settings.

Remote Environments gains a Sandbox Profile column. The selection is
stored per host address, and the existing sandbox forwarder sends the
profile's settings to that host when it connects or the profile changes.
Hosts without a profile keep the default VS Code settings, and managed
policy values are never overridden.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 20, 2026 07:52

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

Saving a stale draft can recreate a profile deleted in another window and reactivate its previous sandbox settings through retained per-host assignments.

3 open issues
What changed in this PR

Adds device-local sandbox profiles to VS Code so individual remote agent hosts can use named settings presets without Agent Host or protocol changes.

Changes:

  • Adds a modal profile editor with settings controls and inline JSON editing.
  • Adds per-host profile selection and settings forwarding that preserves managed-policy values.
  • Adds accessibility help, verbosity configuration, and focused regression tests.
File Description
sandboxProfiles.test.ts Tests profile persistence, naming, and editing state.
agentHostSandboxForwarder.test.ts Tests assignments, deletion, updates, and policy precedence.
terminal.chatAgentTools.contribution.ts Registers the editor, command, and accessibility help.
sandboxProfilesInput.ts Manages profile drafts, validation, and persistence.
sandboxProfilesEditor.ts Implements profile management and settings controls.
sandboxProfiles.css Styles the profile editor and controls.
agentHostSandboxForwarder.ts Overlays assigned profiles on forwarded settings.
remotesWidget.test.ts Tests the profile column and offline assignment.
remotesWidget.ts Adds the Sandbox Profile table column.
remotesTable.ts Renders and synchronizes per-host profile selectors.
remotesWidget.css Styles selectors and truncates long names.
accessibilityConfiguration.ts Registers sandbox-profile accessibility verbosity.
remotes.contribution.ts Documents profile selection in accessibility help.
sandboxProfiles.ts Provides shared profile storage and assignment helpers.
accessibleView.ts Adds the sandbox-profile accessibility provider identifier.

Review effort: Balanced

Port the Sandbox Profile column to the redesigned Remote Environments table.

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

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 742a9ae3 Current: ad004be2

Changed (27)

sessions/remotes/remotesWidget/InlineActions/Light
Before After
before after
sessions/remotes/remotesWidget/InlineActionsGroupedByType/Light
Before After
before after
sessions/remotes/remotesWidget/ConnectionError/Light
Before After
before after
sessions/remotes/remotesWidget/ConnectionRetry/Light
Before After
before after
sessions/remotes/remotesWidget/Environments/Light
Before After
before after
sessions/remotes/remotesWidget/EnvironmentActions/Light
Before After
before after
sessions/remotes/remotesWidget/ExtensionActions/Light
Before After
before after
sessions/remotes/remotesWidget/RefreshingTunnels/Light
Before After
before after
sessions/remotes/remotesWidget/TunnelSignIn/Light
Before After
before after
sessions/remotes/remotesWidget/TunnelSigningIn/Light
Before After
before after
sessions/remotes/remotesWidget/TunnelSetupSignIn/Light
Before After
before after
sessions/remotes/remotesWidget/OtherTypesWithoutTunnelSignIn/Light
Before After
before after
sessions/remotes/remotesWidget/SSHSetup/Light
Before After
before after
sessions/remotes/remotesWidget/WSLSetup/Light
Before After
before after
sessions/remotes/remotesWidget/GitHubSetup/Light
Before After
before after
sessions/remotes/remotesWidget/EnvironmentsWide/Light
Before After
before after
sessions/remotes/remotesWidget/EnvironmentsEmpty/Light
Before After
before after
sessions/remotes/remotesWidget/Table/Light
Before After
before after
sessions/remotes/remotesWidget/TableGroupedByAvailability/Light
Before After
before after
sessions/remotes/remotesWidget/TableGroupedByMethod/Light
Before After
before after
sessions/remotes/remotesWidget/TableWithHeading/Light
Before After
before after
sessions/remotes/remotesWidget/EmptyWithHeading/Light
Before After
before after
sessions/remotes/remotesWidget/Wide/Light
Before After
before after
sessions/remotes/remotesWidget/Windows/Light
Before After
before after
sessions/remotes/remotesWidget/Empty/Light
Before After
before after
sessions/remotes/remotesWidget/EmptyWindows/Light
Before After
before after
sessions/remotes/remotesWidget/RefreshWarnings/Light
Before After
before after

Sandbox profiles and the active profile are now root config values on the
agent host, so every client connected to it sees and can change them; the
last write wins. New sessions use the active profile's values over the
host's sandbox values, and managed policy still applies on top.

- Host: add sandboxProfiles and activeSandboxProfile to the sandbox
  config schema; resolve the active profile for session sandbox config.
- Manage Sandbox Profiles edits one host's profiles, with Use for New
  Sessions and an Active marker; deleting the active profile clears it.
- The Remote Environments Sandbox Profile column sets the host's active
  profile and is disabled while a host is disconnected.
- Remove the client-side profile storage and the forwarder overlay, so a
  reconnecting client never replaces another client's selection.
- Hide Add Item in read-only profile lists.

Co-authored-by: Copilot <[email protected]>
@dileepyavan Dileep Yavanmandha (dileepyavan) changed the title sandbox: add sandbox profiles and per-host assignment sandbox: add sandbox profiles stored on the agent host Nov 20, 2026
Sandbox profiles are now created in a per-machine library (application-shared,
not synced) that both VS Code and the Agents window read. Remote Environments
lists the library for each host; assigning sends the host a copy under the
single `sandboxProfile` root config key (`{}` clears it to Default). Other
devices connecting to the host see "X (on host)" and can save it to their own
profiles. Editing a profile updates connected hosts using it; deleting keeps the
hosts' copies. Managed policy still wins and reconnects never overwrite the
assignment.

Also restores a dedicated wrapper for the Remote Environments dropdown so its
chevron renders inside the box.

Co-authored-by: Copilot <[email protected]>
@dileepyavan Dileep Yavanmandha (dileepyavan) changed the title sandbox: add sandbox profiles stored on the agent host sandbox: assign sandbox profiles to agent hosts Nov 22, 2026
Sandbox profiles are now behind chat.agent.sandbox.profiles.enabled, an
experimental setting that is off by default and can be enabled by an
experiment. It controls the Manage Sandbox Profiles command and the Sandbox
Profile column in Remote Environments; hosts keep applying a profile that is
already assigned.

A profile assigned to a remote environment can no longer be deleted. Each
environment's last-known assignment is remembered, so disconnected
environments also count.

Co-authored-by: Copilot <[email protected]>
chat.agent.sandbox.profiles.enabled is an internal experimental flag: it
can be set in settings.json or by an experiment, but is not listed in the
Settings editor.

Co-authored-by: Copilot <[email protected]>
The Remote Environments picker now uses an element-anchored hover with a
pointer, like the row's other controls, instead of the select box's mouse
hover of the selected option. The hover explains why the picker is
disabled (disconnected, or a server without sandbox profiles), and a
disabled picker is dimmed. Adds a hideSelectedOptionHover select box option
so callers can provide their own hover.

Co-authored-by: Copilot <[email protected]>
Remove the client-side assignments tracker and its persisted copy of each
host's assignment. The host's sandboxProfile setting is the only source of
truth; clients read it while connected. A disconnected host's picker shows
Default (disabled) until it reconnects, and deleting a profile is only
blocked by connected hosts that use it. Disconnected hosts keep their own
copy and offer Save to My Profiles when they reconnect.

Co-authored-by: Copilot <[email protected]>
@dileepyavan Dileep Yavanmandha (dileepyavan) changed the title sandbox: assign sandbox profiles to agent hosts sandbox: assign sandbox profiles to agent hosts (experimental) Nov 23, 2026
- Refuse to save a draft of a profile that was deleted in another window,
  instead of recreating it with the same ID.
- Focus the profile list when the selected profile is read-only, because
  the disabled name box can't take focus.
- Keep invalid User-Configured Paths JSON in the editor model: it counts as
  an unsaved change, survives re-rendering, and blocks every save path.

Co-authored-by: Copilot <[email protected]>
The Sandbox Profile column subscribes to onDidChangeConnections and looks up
connections by address. Give the shared workbench test stub and the Remote
Environments component fixture an empty connections service so RemotesEditor
tests and the remotesWidget screenshot fixtures can create the widget.

Co-authored-by: Copilot <[email protected]>
Merged via the queue into main with commit 058ee0e Nov 23, 2026
38 checks passed
@dileepyavan
Dileep Yavanmandha (dileepyavan) deleted the DileepY/sandbox-profiles-ui branch November 23, 2026 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants