Skip to content

agentHost: Smoke test sandboxed commands through the client's proxy - #348673

Draft
Christof Marti (chrmarti) wants to merge 3 commits into
mainfrom
chrmarti/agent-host-sandbox-proxy-smoke
Draft

Christof Marti (chrmarti) wants to merge 3 commits into
mainfrom
chrmarti/agent-host-sandbox-proxy-smoke

Conversation

@chrmarti

@chrmarti Christof Marti (chrmarti) commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Adds smoke tests for the certificate, proxy and proxy authentication support of sandboxed commands in the Agent Host: a sandboxed shell command of the Copilot runtime fetches a URL through the sandbox's network proxy, which has to forward it to the proxy the client resolves, with the client's credentials.

Needs a Copilot runtime with github/copilot-agent-runtime#40748 (the sandbox network proxy forwards to the client-resolved upstream proxy with Kerberos, Basic and PAC support). The Copilot SDK 2.0.3 on main (#350441) bundles runtime 1.0.116, which includes it; the local Agent Host suite uses the runtime bundled with the packaged client.

Changes

  • agentsWindow.test.ts: three suites, registered only with VSCODE_SMOKE_TEST_SANDBOX_PROXY=1:
    • Agents Window (local AgentHost, Basic PAC proxy, sandbox): Windows Agent Host, PAC proxy, exactly one proxy login dialog.
    • Agents Window (WSL AgentHost, Basic PAC proxy, sandbox): Agent Host in WSL, the Windows PAC proxy and credentials through the client, exactly one proxy login dialog.
    • Agents Window (WSL AgentHost, Kerberos proxy, sandbox): Agent Host in WSL, the Windows proxy with the Windows Kerberos ticket through the client.
    • The sandbox settings allow only the mock host, forbid unsandboxed commands and, on Windows, allow local network access (sandboxed commands reach the sandbox proxy over loopback). Only Squid resolves the mock host, so the request can only arrive through the sandbox proxy and then the authenticated upstream proxy. The tests check that the mock server got the probe request, that the Agent Host applied the sandbox config and the runtime's own shell tool ran the command, and, for WSL, that the client served the PAC and the credentials or Kerberos token.
    • The local suite skips itself when the Copilot runtime reports that the Windows host has no sandbox backend (the Azure Windows agents have no BaseContainer), instead of timing out. The WSL suites still fail in that case.
  • shellScenarios.ts: shellNetworkProbeScenario, which echoes the reply only after curl fetched the URL.
  • mock-llm-server.ts: captures catch-all GET requests so tests can assert their own request arrived.
  • test/automation/src/chat.ts: also accepts the runtime's URL confirmation, whose primary button reads "Allow Once".
  • run-agents-window-wsl-kerberos-proxy.ps1: -Sandbox (BasicPac or Kerberos, Agents Window suites only; logs and JUnit results get a -sandbox suffix) and -CopilotRuntimePath for the local Agent Host's runtime; installs bubblewrap slirp4netns iptables in the distribution for -Sandbox. With the legacy iptables backend, which the Dev Container smoke tests select for Docker, the sandbox installs its network rules without privilege only when /run/xtables.lock is writable, so -Sandbox lets the default user own that lock during the run and restores it afterwards.
  • wslDevContainer.ps1: adds bubblewrap slirp4netns iptables to the prepared distribution. This changes the hash of the script, so the prepared-distribution caches are rebuilt.
  • product-build-win32-test.yml: the smoke-wsl-kerberos-proxy and smoke-wsl-basic-pac-proxy steps chain the -Sandbox run after their main run, only with the Linux server of the same build (VSCODE_LINUX_X64_COMPILATION_ARTIFACT), and their timeouts go from 30 to 40 minutes. Chaining in the existing steps keeps the test checkpoint IDs unchanged.
  • pr-win32-test.yml is unchanged: its pinned server's runtime does not include the fix yet, so the PR workflow will run the sandbox suites once $serverCommit in wslDevContainer.ps1 moves to a server that bundles it.
  • README and the smoke-tests skill document the mode.

Validation

On the branch rebased onto main (Copilot SDK 2.0.3, runtime 1.0.116):

  • cd test/smoke && pnpm run compile: passed.
  • pnpm run oxlint test/smoke/src/areas/agentsWindow/agentsWindow.test.ts test/smoke/src/areas/chat/shellScenarios.ts test/automation/src/chat.ts scripts/chat-simulation/common/mock-llm-server.ts: passed.
  • Azure product build (VSCODE_PUBLISH=false), which runs the sandbox suites with the Linux server of the same build: the WSL Kerberos and WSL Basic PAC sandbox suites passed once the script made the legacy iptables lock writable (before that, the runtime disabled the sandbox's network capability on the CI distribution). The local Windows suite timed out there because the agents have no Windows sandbox backend; it now skips itself in that case. With that change, all three WSL proxy steps (Basic, Kerberos and Basic PAC, each with its sandbox run) passed, and the local Windows sandbox suite reported pending. The Windows, Linux, macOS x64 and Web stages succeeded; Alpine and macOS ARM64 stopped at the branch protection check that applies to personal branches.

Run locally on Windows with an Ubuntu WSL distribution. The WSL Agent Host covers the Linux leg.

With the released runtime: the branch with the SDK bumped locally to 2.0.2-preview.6 (runtime 1.0.115-7, which also includes github/copilot-agent-runtime#40748), the WSL server built from the same commit, and no runtime overrides:

  • .\test\smoke\scripts\run-agents-window-wsl-kerberos-proxy.ps1 -ProxyAuth BasicPac -Distribution Ubuntu -WslServerPath <WSL checkout of the branch> -WslNodePath <linux node> -Sandbox: passed (2 passing: the local Windows and WSL Basic PAC sandbox suites; Squid logged only tunnels authenticated as smoketest after the expected 407 challenges).
  • .\test\smoke\scripts\run-agents-window-wsl-kerberos-proxy.ps1 -ProxyAuth Kerberos -Suites AgentsWindow -Distribution Ubuntu -WslServerPath <WSL checkout of the branch> -WslNodePath <linux node> -Sandbox: passed (1 passing; after the expected 407 challenges, Squid logged only tunnels authenticated as smoketest@VSCODE.PROXY.TEST).

Earlier, against Copilot runtimes built from github/copilot-agent-runtime#40748:

  • .\test\smoke\scripts\run-agents-window-wsl-kerberos-proxy.ps1 -ProxyAuth BasicPac -Distribution Ubuntu -WslServerPath ~/devel/vscode -WslNodePath <linux node> -Sandbox -CopilotRuntimePath <win32-x64 copilot-runtime.exe> -WslCopilotRuntimePath <linux-x64 copilot-runtime>: passed (local Windows and WSL Basic PAC sandbox suites, one login dialog each).
  • .\test\smoke\scripts\run-agents-window-wsl-kerberos-proxy.ps1 -ProxyAuth Kerberos -Suites AgentsWindow -Distribution Ubuntu -WslServerPath ~/devel/vscode -WslNodePath <linux node> -Sandbox -WslCopilotRuntimePath <linux-x64 copilot-runtime>: passed (after the expected 407 challenges, Squid logged only tunnels authenticated as smoketest@VSCODE.PROXY.TEST).
  • cd test/smoke && pnpm run compile: passed.
  • pnpm run oxlint test/smoke/src/areas/agentsWindow/agentsWindow.test.ts test/smoke/src/areas/chat/shellScenarios.ts test/automation/src/chat.ts scripts/chat-simulation/common/mock-llm-server.ts: passed.
  • cd build && node --test lib/test/testCheckpointTemplates.test.ts: 14 of 15 passed; the remaining test compares \ and / path separators on Windows and fails the same way without this change.

Copilot AI balanced review requested due to automatic review settings November 16, 2026 19: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.

🔵 Needs a closer look

The Windows/WSL product-build path remains unvalidated and depends on an unreleased runtime and pending SDK bump, requiring maintainer confirmation of runtime bundling and successful chained CI runs.

No open issues 🎉

What changed in this PR

Adds smoke coverage for Agent Host sandboxed shell commands reaching an authenticated upstream proxy through the client, covering local Windows and WSL sessions.

Changes:

  • Adds Basic PAC and Kerberos sandbox suites that verify probe delivery, runtime shell execution, and client proxy support.
  • Extends smoke automation with network probes, request capture, URL confirmation handling, and sandbox runner options.
  • Chains sandbox runs into eligible Azure product-build steps and documents setup. Azure validation remains pending the required runtime release and SDK bump.
File Description
test/​smoke/​wslDevContainer.ps1 Adds Linux sandbox dependencies to prepared WSL distributions.
test/​smoke/​src/​areas/​chat/​shellScenarios.ts Adds a shell scenario that fetches a URL before echoing success.
test/​smoke/​src/​areas/​agentsWindow/​agentsWindow.test.ts Adds three sandbox proxy suites and shared assertions.
test/​smoke/​scripts/​run-agents-window-wsl-kerberos-proxy.ps1 Adds sandbox mode, local runtime selection, and separate output names.
test/​smoke/​README.md Documents sandbox proxy execution, prerequisites, and CI coverage.
test/​automation/​src/​chat.ts Accepts “Allow Once” URL confirmations.
scripts/​chat-simulation/​common/​mock-llm-server.ts Captures catch-all requests for probe assertions.
build/​azure-pipelines/​win32/​steps/​product-build-win32-test.yml Chains sandbox runs when using the same-build Linux server and extends timeouts.
.github/​skills/​smoke-tests/​SKILL.md Documents sandbox suite gating and pipeline placement.

Review effort: Balanced

@chrmarti
Christof Marti (chrmarti) force-pushed the chrmarti/agent-host-sandbox-proxy-smoke branch 2 times, most recently from 5297a58 to b4be16e Compare November 23, 2026 10:37
Add Agents Window suites in which a sandboxed shell command fetches a URL of
the mock server through the sandbox's network proxy, which forwards it to the
proxy the client resolves, with the credentials typed into the proxy login
dialog (local and WSL Agent Host, Basic PAC) or the client's Kerberos ticket
(WSL Agent Host). run-agents-window-wsl-kerberos-proxy.ps1 -Sandbox runs them,
and the Azure product build chains them after the Kerberos and Basic PAC runs
with the Linux server of the same build.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@chrmarti
Christof Marti (chrmarti) force-pushed the chrmarti/agent-host-sandbox-proxy-smoke branch from b4be16e to d3bee8c Compare November 26, 2026 16:47
…dbox runs

With the legacy iptables backend, which the Dev Container smoke tests select
for Docker, the Copilot runtime's sandbox can only install its network rules
without privilege when /run/xtables.lock is writable, so sandboxed commands
failed in the CI distribution. Hand the lock to the default user for the run
and restore it afterwards.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ackend

The Azure Windows agents have no Windows sandbox backend (BaseContainer), so the
Copilot runtime cannot run the sandboxed probe there. Skip the local Agent Host
suite with the runtime's reason when the Agent Host logs that the backend is
unavailable, instead of timing out. The WSL suites keep failing on it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

2 participants