Skip to content

Add sandbox settings auto-update control#327419

Open
dileepyavan wants to merge 1 commit into
microsoft:mainfrom
dileepyavan:DileepY/sandbox-auto-update
Open

Add sandbox settings auto-update control#327419
dileepyavan wants to merge 1 commit into
microsoft:mainfrom
dileepyavan:DileepY/sandbox-auto-update

Conversation

@dileepyavan

Copy link
Copy Markdown
Member

Summary

  • add the chat.agent.sandbox.settings.autoUpdate setting
  • forward the setting to the agent host as autoUpdateSettings
  • omit command-specific sandbox filesystem and runtime configuration when automatic settings updates are disabled
  • add coverage for the disabled behavior

Validation

  • npm run typecheck-client
  • pre-commit hygiene checks
  • git diff --check

The focused Electron unit test could not run in this environment because no X display or xvfb-run is available.

Copilot AI review requested due to automatic review settings July 24, 2026 23:29
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

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

@anthonykim1

Matched files:

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

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.

Pull request overview

Adds control over command-specific sandbox configuration updates and forwards it to the Agent Host.

Changes:

  • Registers the chat.agent.sandbox.settings.autoUpdate setting.
  • Gates command-derived filesystem and runtime configuration.
  • Adds disabled-behavior coverage.
Show a summary per file
File Description
settings.ts Defines the setting ID.
terminalChatAgentToolsConfiguration.ts Registers the setting.
sandboxSettingsReader.ts Includes it in sandbox configuration updates.
sandboxConfigSchema.ts Maps it into Agent Host configuration.
terminalSandboxEngine.ts Gates command-specific adjustments.
terminalSandboxService.test.ts Tests disabled behavior.

Review details

  • Files reviewed: 6/6 changed files
  • Comments generated: 4
  • Review effort level: Medium

const currentRuntimeConfiguration = getTerminalSandboxRuntimeConfigurationForCommands(this._os, this._commandAllowListCommandDetails);
const currentRuntimeConfiguration = getTerminalSandboxRuntimeConfigurationForCommands(this._os, currentCommandDetails);
const nextRuntimeConfiguration = getTerminalSandboxRuntimeConfigurationForCommands(this._os, normalizedCommandDetails);
const shouldRefreshConfig = this._commandAllowListKeywords.length === 0
}
},
[AgentSandboxSettingId.AgentSandboxSettingsAutoUpdate]: {
markdownDescription: localize('agentSandbox.autoUpdate', "Controls whether the effective sandbox configuration is automatically adjusted based on the terminal command being executed. When disabled, only explicitly configured sandbox settings are used. This applies only when {0} is enabled.", `\`#${AgentSandboxSettingId.AgentSandboxEnabled}#\``),
[AgentSandboxSettingId.AgentSandboxWindowsEnabled]: AgentHostSandboxKey.WindowsEnabled,
[AgentSandboxSettingId.AgentSandboxAllowNetwork]: AgentHostSandboxKey.AllowNetwork,
[AgentSandboxSettingId.AgentSandboxAllowUnsandboxedCommands]: AgentHostSandboxKey.AllowUnsandboxedCommands,
[AgentSandboxSettingId.AgentSandboxSettingsAutoUpdate]: AgentHostSandboxKey.AutoUpdateSettings,
Comment on lines +864 to +865
ok(!config.filesystem.allowRead.includes('/home/user/.gnupg'), 'Disabled auto update should omit command runtime read paths');
ok(!config.filesystem.allowWrite.includes('/home/user/.gnupg'), 'Disabled auto update should omit command runtime write paths');
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