Retry with AllowNetwork option before retrying outside the sandbox.#319181
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a safer sandbox escalation path for terminal agent tools: retry network-blocked commands inside the sandbox with unrestricted network access before falling back to unsandboxed execution.
Changes:
- Adds
chat.agent.sandbox.retryWithAllowNetworkRequestsand forwards it through workbench and agent-host sandbox configuration. - Extends terminal sandbox wrapping, command rewriting, confirmations, and tool schemas with
requestAllowNetwork. - Adds tests for sandbox network retry behavior across workbench tools, agent host shell tools, settings forwarding, and sandbox engine behavior.
Show a summary per file
| File | Description |
|---|---|
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/runInTerminalTool.test.ts |
Adds coverage for allow-network schema, confirmations, retries, and rejection paths. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/commandLineSandboxRewriter.test.ts |
Verifies allow-network requests are forwarded to sandbox wrapping. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/common/sandboxSettingsReader.test.ts |
Verifies the new setting is read into agent-host sandbox config. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/terminalSandboxService.test.ts |
Adds blocked-domain allow-network sandbox wrapping tests. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/sandboxOutputAnalyzer.test.ts |
Adds analyzer and network-blocked output detection tests. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/commandLineSandboxAnalyzer.test.ts |
Adds auto-approval coverage for allow-network confirmations. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/agentHostSandboxForwarder.test.ts |
Verifies forwarding of the new sandbox setting. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.ts |
Forwards allow-network requests through the workbench sandbox service wrapper. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration.ts |
Registers the new preview restricted setting and policy metadata. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/sandboxSettingsReader.ts |
Includes the new setting in sandbox setting keys. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.ts |
Adds model guidance and detection for network-blocked sandbox output. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts |
Adds allow-network schema, confirmation, retry, rejection, and invocation handling. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.ts |
Passes allow-network requests to sandbox wrapping and returns confirmation metadata. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineRewriter.ts |
Extends command-line rewrite interfaces for allow-network metadata. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineSandboxAnalyzer.ts |
Updates sandbox auto-approval logic for allow-network confirmations. |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.ts |
Adds allow-network confirmation state to analyzer options. |
src/vs/workbench/contrib/terminal/terminalContribExports.ts |
Exposes the new sandbox setting through terminal contrib exports. |
src/vs/workbench/contrib/chat/common/chatService/chatService.ts |
Adds allow-network fields to terminal tool invocation data. |
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.ts |
Displays allow-network reasons in terminal tool confirmation details. |
src/vs/platform/sandbox/test/common/terminalSandboxEngine.test.ts |
Adds sandbox engine coverage for unrestricted network command config. |
src/vs/platform/sandbox/common/terminalSandboxService.ts |
Extends sandbox service API/result metadata for allow-network confirmations. |
src/vs/platform/sandbox/common/terminalSandboxEngine.ts |
Implements per-command network-unrestricted sandbox config and preflight blocked-domain handling. |
src/vs/platform/sandbox/common/settings.ts |
Defines the new sandbox setting ID. |
src/vs/platform/agentHost/test/node/copilotShellTools.test.ts |
Adds agent-host shell tool schema and confirmation tests for allow-network requests. |
src/vs/platform/agentHost/node/copilot/copilotShellTools.ts |
Adds allow-network schema, confirmation flow, and sandbox wrapping for shell tools. |
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts |
Generalizes sandbox command confirmation handling and UI text. |
src/vs/platform/agentHost/node/copilot/copilotAgent.ts |
Wires generalized sandbox confirmation callback into shell tool creation. |
src/vs/platform/agentHost/common/sandboxConfigSchema.ts |
Adds agent-host config schema/key mapping for the new setting. |
Copilot's findings
- Files reviewed: 28/28 changed files
- Comments generated: 2
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @anthonykim1Matched files:
|
dmitrivMS
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #319251