Skip to content

agentHost: enable local network access from the sandbox banner - #351082

Merged
Dileep Yavanmandha (dileepyavan) merged 2 commits into
microsoft:mainfrom
dileepyavan:fix/349798-sandbox-local-network
Nov 30, 2026
Merged

Dileep Yavanmandha (dileepyavan) merged 2 commits into
microsoft:mainfrom
dileepyavan:fix/349798-sandbox-local-network

Conversation

@dileepyavan

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

Copy link
Copy Markdown
Member

Fixes #349798.

The local network warning previously opened Settings, even when the connected agent host had an assigned sandbox profile. Updating the user setting there need not change the host's effective configuration. This keeps the existing warning trigger and lets the user confirm the change directly in chat.

  • Profiles supported, no assignment (Default): the confirmation explains that the change applies to all hosts that inherit the user setting.
  • Assigned profile: the confirmation names the profile and leaves user settings untouched. A host-only profile stays on the host. For a locally saved profile, connected hosts using the same profile also receive the change.
  • Profiles not supported: once the connected host's root state loads, the banner offers Open Local Network Settings. This opens the filtered setting without granting access. No action is offered while the state is unavailable.
  • An organization policy that blocks access offers no grant action. If the assignment changes while the dialog is open, confirming does not apply the grant to a different target.

How to test

  1. Connect the Agents window to a Windows agent host that reports local network access is required. With Default selected, click Enable Local Network Access and verify that the dialog identifies user settings. Cancel and verify no setting changes.

  2. In Manage Remote Environments, assign a test sandbox profile that does not enable local network access. From the chat banner, confirm that the dialog names that profile. Accept, then check /sandbox policy in a fresh session and verify local network access is enabled while the user setting remains unchanged.

  3. Connect to a host that reports the warning but does not advertise sandbox profiles. Verify Open Local Network Settings opens the local network setting without changing it.

Validation

  • pnpm run typecheck-client and pnpm run build-fast --client-only — passed.
  • scripts\test.bat --run src\vs\workbench\contrib\chat\test\browser\agentSessions\agentHostSandboxNotification.test.ts --reporter dot — 171 passing, 1 pending after the fallback change, including the regression test for loading versus unsupported host state.
  • pnpm run oxlint src\vs\workbench\contrib\chat\browser\agentSessions\agentHost\agentHostSandboxNotification.ts src\vs\workbench\contrib\chat\test\browser\agentSessions\agentHostSandboxNotification.test.ts — passed.

Live remote Windows testing has not been performed.

Copilot AI balanced review requested due to automatic review settings November 29, 2026 22:34

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

The change removes the Settings remediation link for connected older hosts without sandbox-profile support, leaving local-network warnings without an action even though those hosts can still inherit the user setting.

1 open issue
What changed in this PR

Replaces Settings-only guidance in the chat sandbox banner with a profile-aware confirmation, so enabling local network access updates the configuration used by the connected agent host.

Changes:

  • Updates user settings for Default hosts or the assigned sandbox profile, including connected hosts sharing a locally saved profile.
  • Prevents grants when organization policy blocks access or the target changes during confirmation.
  • Adds tests for grant targets, cancellation, stale assignments, and policy-blocked guidance.
File Description
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentHostSandboxNotification.test.ts Tests confirmation, profile updates, cancellation, and policy behavior.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostSandboxNotification.ts Implements the profile-aware banner action and guarded configuration updates.
src/​vs/​platform/​agentHost/​common/​sandboxProfiles.ts Extracts a helper for writing host profile assignments directly.

Review effort: Balanced

Merged via the queue into microsoft:main with commit 723015b Nov 30, 2026
53 checks passed
@dileepyavan
Dileep Yavanmandha (dileepyavan) deleted the fix/349798-sandbox-local-network branch November 30, 2026 00:29
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: Cannot reach network

4 participants