Skip to content

agentHost: Resolve the Copilot runtime's proxies through SDK callbacks - #346706

Merged
Christof Marti (chrmarti) merged 6 commits into
mainfrom
chrmarti/sdk-network-callbacks
Nov 7, 2026
Merged

Christof Marti (chrmarti) merged 6 commits into
mainfrom
chrmarti/sdk-network-callbacks

Conversation

@chrmarti

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

Copy link
Copy Markdown
Collaborator

The Agent Host now resolves the Copilot runtime's proxies and Kerberos tickets through the Copilot SDK's new network callbacks, instead of forwarding proxy environment variables to the runtime.

This is a draft, to test the published Copilot SDK 1.0.30-preview.0 (runtime 1.0.108-0) in CI.

Changes

  • Update @github/copilot-sdk to 1.0.30-preview.0 and copilotRuntimeVersion to 1.0.108-0. This runtime adds the experimental network.resolveProxy and network.authenticateNegotiate callbacks, and also routes its team_customizations requests through them.
  • Register both callbacks at runtime scope:
    • resolveProxy answers with the full PAC-style result of VS Code's proxy resolution (http.proxy, the proxy environment variables, or the system and PAC settings of a connected client). When no client can answer, or when the resolved http.proxy or environment proxy has credentials, which a PAC-style answer cannot carry, it leaves the request to the runtime's own resolution.
    • authenticateNegotiate acquires this machine's ticket for exactly the principal the runtime requests (as a host-based name for GSSAPI outside Windows, like the runtime), then falls back to a client sharing the Agent Host's network, such as the Windows client of an Agent Host in WSL. Renderers on the same machine are not consulted.
  • The Agent Host's own proxied requests now look up Kerberos tickets the same way a remote extension host does: this machine's ticket first (with http.proxyKerberosServicePrincipal, if set), then a client sharing its network. They no longer ask local renderers for tickets, so the renderer proxy channel drops its Kerberos lookup.
  • Stop forwarding HTTP(S)_PROXY and NO_PROXY to the runtime, except for an http.proxy setting with credentials. The runtime sends those credentials as Basic proxy authorization.
  • Update @vscode/proxy-agent to 0.46.0, whose resolveProxyByURL also returns the full PAC-style result.

Why

Forwarding the proxy environment variables could express only a single proxy. The variables also leaked into the tools the agent runs, so requests to intranet hosts went through a proxy meant for other hosts. When the Agent Host runs in WSL or a dev container, the proxy and Kerberos configuration is on the client machine. The callbacks let the runtime use the connected VS Code client's proxy resolution and Kerberos tickets.

The callbacks are always registered, so the runtime no longer restarts when clients connect or disconnect, or when proxy settings change. Only Kerberos SPN, client certificate, and credentialed http.proxy changes still restart it.

Notes for reviewers

  • In the new SDK, CopilotSession.sessionId is an accessor, so a test fake in copilotSessionLauncher.test.ts now overrides it as a getter.
  • This runtime skips unsupported PAC entry types itself, so a follow-up may be able to drop the RUNTIME_PAC_TYPES filtering in copilotAgent.ts.

How to test

In CI, the Windows Electron-Smoke (WSL) job runs the WSL Kerberos proxy smoke tests (test/smoke/scripts/run-agents-window-wsl-kerberos-proxy.ps1). The macOS PAC and Kerberos proxy smoke tests run in the Azure product build.

Local validation with this SDK, on Windows:

  • pnpm run typecheck-client: passed.
  • scripts\test.bat --reporter dot --runGlob "vs/platform/agentHost/test/node/copilot*.test.js": passed (3875 passing, 11 pending).
  • After the review fixes and again after the Kerberos lookup alignment, scripts\test.bat --reporter dot --run src/vs/platform/agentHost/test/node/copilotAgent.test.ts --run src/vs/platform/agentHost/test/node/agentHostRequestService.test.ts: passed (1082 passing).
  • pnpm run eslint on the changed files: passed.

The WSL Kerberos proxy smoke tests were not run locally against this published runtime. With a locally built runtime containing the same changes, they passed through both an HTTP and an HTTPS proxy, and the runtime's team_customizations requests went through the proxy.

resolveProxyByURL now also returns the full PAC-style result, which the agent host passes to the Copilot runtime.

Co-authored-by: Copilot <[email protected]>
Forwarding HTTP(S)_PROXY and NO_PROXY to the Copilot runtime could only
express a single proxy, and the variables leaked into the tools the agent
runs, sending requests to intranet hosts through a proxy meant for others.

Register the Copilot SDK's network callbacks at runtime scope instead:
- resolveProxy answers with the full PAC-style result of VS Code's proxy
  resolution (http.proxy, proxy environment variables, or the system and
  PAC settings of a connected client). When no client can answer, it
  leaves the request to the runtime's own resolution.
- authenticateNegotiate looks up Kerberos tickets the same way the agent
  host does for its own requests.

The callbacks are always registered, so the runtime no longer restarts
when clients connect or disconnect, or when proxy settings change. Only
Kerberos SPN and client certificate changes still restart it.

Requires the Copilot SDK network callbacks and @vscode/proxy-agent 0.46.0.

Co-authored-by: Copilot <[email protected]>
Picks up runtime 1.0.108-0, which adds the experimental network.resolveProxy and network.authenticateNegotiate callbacks and resolves team_customizations requests through them. CopilotSession.sessionId is now an accessor, so the launcher test fake overrides it as a getter.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 7, 2026 00:57

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

Proxy authentication remains broken because authenticated proxy URL credentials are dropped and native Kerberos ticket acquisition can use the wrong principal or discard its explicit realm.

2 open issues
2 files not reviewed
  • pnpm-lock.yaml: Generated file
  • remote/pnpm-lock.yaml: Generated file
What changed in this PR

This PR moves the Copilot runtime’s proxy resolution and Kerberos authentication into SDK network callbacks backed by VS Code’s Agent Host, replacing injected proxy settings and reducing runtime restarts.

Changes:

  • Upgrade the Copilot SDK, bundled runtime, and proxy-agent dependency.
  • Add runtime-scoped callbacks for PAC proxy lists and Kerberos tokens.
  • Update resolver interfaces, tests, smoke-test expectations, and networking documentation.
File Description
test/​smoke/​src/​areas/​agentsWindow/​remoteDevContainerFixtures.ts Update WSL callback-registration log checks.
src/​vs/​platform/​agentHost/​test/​node/​localModelBridge/​shimLocalModelProvider.test.ts Extend proxy resolver test stubs.
src/​vs/​platform/​agentHost/​test/​node/​localModelBridge/​localModelSetupService.test.ts Extend proxy resolver test stubs.
src/​vs/​platform/​agentHost/​test/​node/​copilotSessionLauncher.test.ts Adapt the session fake to the SDK accessor.
src/​vs/​platform/​agentHost/​test/​node/​copilotAgent.test.ts Cover callbacks and revised restart behavior.
src/​vs/​platform/​agentHost/​test/​node/​agentServiceTestUtils.ts Update the shared resolver stub.
src/​vs/​platform/​agentHost/​test/​node/​agentHostRequestService.test.ts Cover detailed proxy results and exposed Kerberos lookup.
src/​vs/​platform/​agentHost/​node/​serviceBootstrapping.md Document callback-based networking.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgent.ts Register callbacks and remove resolved-proxy environment injection.
src/​vs/​platform/​agentHost/​node/​agentHostProxyResolver.ts Expose detailed proxy resolution and Kerberos lookup.
remote/​pnpm-lock.yaml Lock upgraded remote dependencies.
remote/​package.json Update remote SDK, runtime, and proxy-agent versions.
pnpm-lock.yaml Lock upgraded desktop dependencies.
package.json Update desktop SDK, runtime, and proxy-agent versions.

Review effort: Balanced

… bump

Update the managed settings schema and Copilot prompt snapshots for SDK 1.0.30-preview.0, and accept the pinned WSL server's environment-forwarded proxy in the WSL Kerberos proxy smoke test.

Co-authored-by: Copilot <[email protected]>
…l for the Copilot runtime

A PAC-style proxy answer cannot carry credentials, so a configured http.proxy with credentials is forwarded to the Copilot runtime as HTTP_PROXY/HTTPS_PROXY/NO_PROXY again, and the resolveProxy callback defers to the runtime's own resolution for setting and environment proxies with credentials.

The authenticateNegotiate callback now acquires this machine's ticket for exactly the principal the runtime requests, converted to a host-based name for GSSAPI as the runtime does, before falling back to clients sharing the network. Renderers on the same machine are no longer consulted for the runtime.

Co-authored-by: Copilot <[email protected]>
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Base: d7a72e35 Current: 13b1f8a2

No screenshot changes.

… like a remote extension host

Use this machine's ticket first, then a client sharing its network, without
asking local renderers, which run on the same machine. Remove the now unused
Kerberos lookup from the renderer proxy channel.

Co-authored-by: Copilot <[email protected]>
@chrmarti
Christof Marti (chrmarti) marked this pull request as ready for review November 7, 2026 15:08
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Bhavya U (@bhavyaus)

Matched files:

  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_claude-haiku-4_5.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_claude-opus-4_5.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_claude-opus-4_6.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_claude-opus-4_7.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_claude-opus-5.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_claude-opus-5_5.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_claude-sonnet-4_5.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_claude-sonnet-4_6.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_claude-sonnet-5.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_gemini-2_0-flash.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_gpt-5-codex.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_gpt-5-mini.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_gpt-5.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_gpt-5_1-codex-mini.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_gpt-5_1-codex.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_gpt-5_1.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_gpt-5_6-luna.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_gpt-5_6-sol.prompt.md
  • src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_prompts_gpt-5_6-terra.prompt.md

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.

3 participants