Skip to content

Retry with AllowNetwork option before retrying outside the sandbox.#319181

Merged
dileepyavan merged 11 commits into
mainfrom
DileepY/retry-allowNetwork
Jun 1, 2026
Merged

Retry with AllowNetwork option before retrying outside the sandbox.#319181
dileepyavan merged 11 commits into
mainfrom
DileepY/retry-allowNetwork

Conversation

@dileepyavan
Copy link
Copy Markdown
Member

@dileepyavan dileepyavan commented May 31, 2026

fixes #319251

Copilot AI review requested due to automatic review settings May 31, 2026 01:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.retryWithAllowNetworkRequests and 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

@dileepyavan dileepyavan marked this pull request as ready for review June 1, 2026 03:24
@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/terminal/terminalContribExports.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineSandboxAnalyzer.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineRewriter.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/commandLineSandboxAnalyzer.test.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/sandboxOutputAnalyzer.test.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/terminalSandboxService.test.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/commandLineSandboxRewriter.test.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/runInTerminalTool.test.ts

@dileepyavan dileepyavan enabled auto-merge (squash) June 1, 2026 03:25
@dileepyavan dileepyavan merged commit 2ac719f into main Jun 1, 2026
25 checks passed
@dileepyavan dileepyavan deleted the DileepY/retry-allowNetwork branch June 1, 2026 04:03
@vs-code-engineering vs-code-engineering Bot added this to the 1.123.0 milestone Jun 1, 2026
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.

[sandbox]Retry using allowNetwork option before retrying outside the sandbox

3 participants