Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/skills/smoke-tests/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Some placement is coupled to the workflows:
- **WSL version:** the agents' Windows Server 2022 image only has the inbox WSL, so provisioning installs the WSL release pinned in `build/checksums/wsl.txt` (see `build/azure-pipelines/common/wsl.psm1`). To update it, put the SHA256 and file name of a newer `wsl.<version>.x64.msi` from the [microsoft/WSL releases](https://github.com/microsoft/WSL/releases) there. The installer caches key on that file; `pr-pnpm-store.yml` fills the GitHub cache on `main`.
- **Prepared WSL distribution:** the `wsl-distro` job of `pr-workspace-images.yml` (1ES pool, daily schedule and manual runs only) runs `wslDevContainer.ps1 -Operation Prepare` and saves the exported VHD in a cache keyed on the hash of `wslDevContainer.ps1` and `build/checksums/wsl.txt`. The WSL job restores the newest entry for its hash and imports it with `wsl --import-in-place` instead of building the distribution. It builds the distribution when there is no entry for its hash (for example after a change to either file, until the next daily run or a manual run of the workflow on `main`), or when the import fails. On Azure Pipelines, the Windows x64 smoke job prepares the distribution itself: on a miss of its daily cache key, it runs Prepare before Setup and saves the VHD when the job succeeds (see `test/smoke/README.md`).
- **macOS proxy runs:** In `pr-darwin-test.yml`, the PAC, Kerberos and Basic proxy Agents Window runs happen only in the last shard, so `test/smoke/src/shard.ts` reserves their time there.
- **Sandbox proxy runs:** `run-agents-window-wsl-kerberos-proxy.ps1 -Sandbox` runs the `…proxy, sandbox` Agents Window suites, which the other runs skip because only `-Sandbox` sets `VSCODE_SMOKE_TEST_SANDBOX_PROXY`. On Azure Pipelines, the Kerberos and Basic PAC proxy steps of `product-build-win32-test.yml` run it after their main run only with the Linux server of the same build, whose Copilot runtime proxies sandboxed commands with the client's credentials; the pinned server's runtime does not, so `pr-win32-test.yml` does not run it yet.

Every shard must register the same suites; otherwise suites can be skipped or run twice. Don't make suite registration depend on anything that differs between shards.

Expand Down
25 changes: 19 additions & 6 deletions build/azure-pipelines/win32/steps/product-build-win32-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -336,23 +336,30 @@ steps:
WSL_SMOKE_DISTRO: $(WSL_SMOKE_DISTRO)
condition: and(succeeded(), or(ne(variables['TEST_CHECKPOINT_SMOKE_WSL_KERBEROS_PROXY_HIT'], 'true'), ne(variables['TEST_CHECKPOINT_SMOKE_WSL_BASIC_PROXY_HIT'], 'true'), and(${{ containsValue(parameters.VSCODE_TEST_IDS, 'smoke-wsl-basic-pac-proxy') }}, ne(variables['TEST_CHECKPOINT_SMOKE_WSL_BASIC_PAC_PROXY_HIT'], 'true'))))

# The script configures a test Kerberos realm, CA and PAC on the elevated agent and reverts them.
# The script configures a test Kerberos realm, CA and PAC on the elevated agent and reverts them. With the server of
# this run, whose Copilot runtime proxies sandboxed commands with the client's Kerberos tickets, the sandbox suite
# runs as well.
- ${{ if and(eq(parameters.VSCODE_ARCH, 'x64'), containsValue(parameters.VSCODE_TEST_IDS, 'smoke-wsl-kerberos-proxy')) }}:
- template: ../../common/run-test-with-checkpoint.yml@self
parameters:
testId: smoke-wsl-kerberos-proxy
testStep:
pwsh: .\test\smoke\scripts\run-agents-window-wsl-kerberos-proxy.ps1 -Distribution $env:WSL_SMOKE_DISTRO -WslServerPath $env:WSL_KERBEROS_SERVER_PATH -Suites $env:WSL_KERBEROS_SUITES --build "$(agent.builddirectory)\test\VSCode-win32-$(VSCODE_ARCH)" --skip-stable-build
pwsh: |
.\test\smoke\scripts\run-agents-window-wsl-kerberos-proxy.ps1 -Distribution $env:WSL_SMOKE_DISTRO -WslServerPath $env:WSL_KERBEROS_SERVER_PATH -Suites $env:WSL_KERBEROS_SUITES --build "$(agent.builddirectory)\test\VSCode-win32-$(VSCODE_ARCH)" --skip-stable-build
if ($env:WSL_KERBEROS_SANDBOX) {
.\test\smoke\scripts\run-agents-window-wsl-kerberos-proxy.ps1 -Distribution $env:WSL_SMOKE_DISTRO -WslServerPath $env:WSL_KERBEROS_SERVER_PATH -Suites AgentsWindow -Sandbox --build "$(agent.builddirectory)\test\VSCode-win32-$(VSCODE_ARCH)" --skip-stable-build
}
env:
WSL_SMOKE_DISTRO: $(WSL_SMOKE_DISTRO)
${{ if eq(parameters.VSCODE_LINUX_X64_COMPILATION_ARTIFACT, true) }}:
WSL_KERBEROS_SERVER_PATH: $(WSL_SMOKE_BUILD_SERVER_PATH)
WSL_KERBEROS_SUITES: All
WSL_KERBEROS_SANDBOX: '1'
${{ else }}:
WSL_KERBEROS_SERVER_PATH: $(WSL_SMOKE_SERVER_PATH)
WSL_KERBEROS_SUITES: AgentsWindow
displayName: 🧪 Run WSL Kerberos proxy smoke tests (Electron)
timeoutInMinutes: 30
timeoutInMinutes: 40

# Only the editor window suite runs, with the proxy and its credentials in the http.proxy setting. The script trusts a
# test CA on the elevated agent and reverts it.
Expand All @@ -370,21 +377,27 @@ steps:

# Only the Agents Window suites run, with a local Agent Host and with one in WSL, which use the PAC and type the proxy's
# credentials into the proxy login dialog. The script trusts a test CA and configures a PAC on the elevated agent and
# reverts them.
# reverts them. With the server of this run, whose Copilot runtime proxies sandboxed commands with the client's
# credentials, the sandbox suites run as well.
- ${{ if and(eq(parameters.VSCODE_ARCH, 'x64'), containsValue(parameters.VSCODE_TEST_IDS, 'smoke-wsl-basic-pac-proxy')) }}:
- template: ../../common/run-test-with-checkpoint.yml@self
parameters:
testId: smoke-wsl-basic-pac-proxy
testStep:
pwsh: .\test\smoke\scripts\run-agents-window-wsl-kerberos-proxy.ps1 -ProxyAuth BasicPac -Distribution $env:WSL_SMOKE_DISTRO -WslServerPath $env:WSL_BASIC_PAC_SERVER_PATH --build "$(agent.builddirectory)\test\VSCode-win32-$(VSCODE_ARCH)" --skip-stable-build
pwsh: |
.\test\smoke\scripts\run-agents-window-wsl-kerberos-proxy.ps1 -ProxyAuth BasicPac -Distribution $env:WSL_SMOKE_DISTRO -WslServerPath $env:WSL_BASIC_PAC_SERVER_PATH --build "$(agent.builddirectory)\test\VSCode-win32-$(VSCODE_ARCH)" --skip-stable-build
if ($env:WSL_BASIC_PAC_SANDBOX) {
.\test\smoke\scripts\run-agents-window-wsl-kerberos-proxy.ps1 -ProxyAuth BasicPac -Sandbox -Distribution $env:WSL_SMOKE_DISTRO -WslServerPath $env:WSL_BASIC_PAC_SERVER_PATH --build "$(agent.builddirectory)\test\VSCode-win32-$(VSCODE_ARCH)" --skip-stable-build
}
env:
WSL_SMOKE_DISTRO: $(WSL_SMOKE_DISTRO)
${{ if eq(parameters.VSCODE_LINUX_X64_COMPILATION_ARTIFACT, true) }}:
WSL_BASIC_PAC_SERVER_PATH: $(WSL_SMOKE_BUILD_SERVER_PATH)
WSL_BASIC_PAC_SANDBOX: '1'
${{ else }}:
WSL_BASIC_PAC_SERVER_PATH: $(WSL_SMOKE_SERVER_PATH)
displayName: 🧪 Run WSL Basic PAC proxy smoke tests (Electron)
timeoutInMinutes: 30
timeoutInMinutes: 40

- ${{ if and(eq(parameters.VSCODE_ARCH, 'x64'), or(containsValue(parameters.VSCODE_TEST_IDS, 'smoke-electron'), containsValue(parameters.VSCODE_TEST_IDS, 'smoke-wsl-kerberos-proxy'), containsValue(parameters.VSCODE_TEST_IDS, 'smoke-wsl-basic-proxy'), containsValue(parameters.VSCODE_TEST_IDS, 'smoke-wsl-basic-pac-proxy'))) }}:
- pwsh: .\test\smoke\wslDevContainer.ps1 -CI AzureDevOps -Operation Cleanup -Distribution $env:WSL_SMOKE_DISTRO -Root $env:WSL_SMOKE_ROOT
Expand Down
4 changes: 4 additions & 0 deletions scripts/chat-simulation/common/mock-llm-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,8 @@ function handleRequest(req: import('http').IncomingMessage, res: import('http').
}

// -- Catch-all GET → empty success --------------------------------
// Captured so tests can assert that a request of their own, such as a sandboxed command's, reached the server.
serverEvents.emit('capturedRequest', { path, method: req.method ?? 'GET', body: '' });
json(200, {});
}

Expand Down Expand Up @@ -1990,6 +1992,8 @@ interface MockLlmServerHandle {
* `body` is the JSON-parsed request payload (or the raw string when parsing
* fails). Used by tests to assert what the client forwarded to the server
* (e.g. `reasoning.effort` or the context-management `compact_threshold`).
* Requests to paths the server does not serve are included with an empty
* `body`, so tests can assert that a request of their own reached it.
*
* Returns an empty array unless the server was started with
* {@link StartServerOptions.captureRequests} set — request capture is off by
Expand Down
14 changes: 9 additions & 5 deletions test/automation/src/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,11 +574,14 @@ export class Chat {
*
* The terminal confirmation renders as a `.chat-confirmation-widget2` whose
* action buttons are `.monaco-button.monaco-text-button` anchors — the primary
* "Allow" (rendered first), then "Skip". The dropdown chevron next to "Allow"
* "Allow" (rendered first), then "Skip". A URL confirmation, such as the one
* the Copilot runtime requests for a URL in a shell command, labels its primary
* button "Allow Once" instead. The dropdown chevron next to "Allow"
* is a `.monaco-dropdown-button.codicon` (no `.monaco-text-button`) and the
* carousel's "Allow All" lives on `.chat-tool-carousel-allow-all-button`, so
* neither is matched here. We verify the first text button actually reads
* "Allow" before clicking to avoid ever hitting "Skip".
* "Allow", "Allow Once" or "Allow in this Session" before clicking to avoid
* ever hitting "Skip".
*
* Uses the VS Code driver (`getElements`/`click`) rather than a raw Playwright
* locator: the confirmation renders outside the chat response/editor
Expand All @@ -587,11 +590,12 @@ export class Chat {
export async function acceptToolConfirmationIfPresent(code: Code): Promise<void> {
const allowButtonSelector = '.chat-confirmation-widget2 .monaco-button.monaco-text-button';
// Agent Host client tools offer "Allow in this Session" as their primary action.
const allowLabel = /^Allow( in this Session)?$/;
const allowLabel = /^Allow(?: Once| in this Session)?$/;
try {
const buttons = await code.driver.getElements(allowButtonSelector, /* recursive */ true);
// The first text button in the widget is "Allow"; only proceed when
// that holds so we never accidentally hit "Skip".
// The first text button in the widget is "Allow", "Allow Once" or
// "Allow in this Session"; only proceed when that holds so we never
// accidentally hit "Skip".
if (!buttons || buttons.length === 0 || !allowLabel.test((buttons[0].textContent ?? '').trim())) {
return;
}
Expand Down
13 changes: 13 additions & 0 deletions test/smoke/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,19 @@ No setting or environment variable of VS Code carries the current credentials: e

The Agents Window suites accept a WSL server of another commit, provided its Agent Host asks the client for Basic proxy credentials. In CI, the Windows Electron smoke job that runs the WSL Dev Container suite runs this mode after the Kerberos run, with the pinned server of `test/smoke/wslDevContainer.ps1`. The Azure product build runs it as `smoke-wsl-basic-pac-proxy`, with the Linux server of the same run's Linux x64 compile job, or the pinned server without one.

#### Sandboxed commands through the proxy

`-Sandbox` runs Agents Window suites with the Copilot runtime's sandbox on instead: with `-ProxyAuth BasicPac`, the `Agents Window (local AgentHost, Basic PAC proxy, sandbox)` and `Agents Window (WSL AgentHost, Basic PAC proxy, sandbox)` suites, and with `-ProxyAuth Kerberos`, the `Agents Window (WSL AgentHost, Kerberos proxy, sandbox)` suite:

```powershell
.\test\smoke\scripts\run-agents-window-wsl-kerberos-proxy.ps1 -ProxyAuth BasicPac -Sandbox -Distribution Ubuntu -WslServerPath ~/devel/vscode -WslNodePath ~/.local/node/bin/node
.\test\smoke\scripts\run-agents-window-wsl-kerberos-proxy.ps1 -ProxyAuth Kerberos -Sandbox -Suites AgentsWindow -Distribution Ubuntu -WslServerPath ~/devel/vscode -WslNodePath ~/.local/node/bin/node
```

Each suite sends a prompt whose scenario runs `curl` against a fresh path of the mock server in the Copilot runtime's own shell tool. The sandbox settings allow only the mock host, forbid unsandboxed commands and, on Windows, allow local network access so that the command reaches the sandbox's network proxy over loopback. Only Squid resolves the mock host, so the command reaches the mock server only when the sandbox's network proxy forwards it to the proxy the client resolves, with the credentials typed into the single proxy login dialog or with the client's Kerberos ticket. The suites accept the runtime's URL confirmation, check that the mock server got the request, and check in the Agent Host log that the runtime's shell tool ran the command with the sandbox configuration of the Agent Host. The WSL suites also check that the client served the PAC proxy and the credentials or Kerberos token. The local suite skips itself when the Copilot runtime reports that the Windows host has no sandbox backend, as on the Azure Windows agents. The distribution additionally needs the `bubblewrap`, `slirp4netns` and `iptables` packages. 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 the script lets the default user own that lock during the run. `-CopilotRuntimePath` selects a Windows `copilot-runtime.exe`, next to its matching `runtime.node`, for the local Agent Host, like `-WslCopilotRuntimePath` for the WSL one. `-ProxyAuth Basic` and `-Suites EditorWindow` are not supported in this mode. Logs are kept in `.build/logs/agents-window-wsl-<auth>-proxy-sandbox`, and the JUnit report goes to `test-results/*-desktop-smoke-tests-wsl-<auth>-proxy-sandbox-results.xml`.

The Azure product build runs these suites after the Kerberos and Basic PAC runs of `smoke-wsl-kerberos-proxy` and `smoke-wsl-basic-pac-proxy`, only with the Linux server of the same run's Linux x64 compile job, since the Copilot runtime of the pinned server does not proxy sandboxed commands with the client's credentials. Pull request CI does not run them until the pinned server's runtime does.

### Dev Container sessions over SSH, Tunnels, and WSL

The Agents Window Dev Container suites require a reachable Linux Docker daemon. The SSH suite runs by default on Linux, and locally on macOS when Docker is available. SSH/Tunnel suites are limited to Linux in CI. The SSH fixture uses a loopback SSH server with an ephemeral port, password, and host key; it does not require system `sshd` or change your SSH configuration.
Expand Down
Loading