Skip to content

agentHost: Retry session config after a proxy restarts the client - #345546

Merged
Ladislau Szomoru (lszomoru) merged 1 commit into
release/1.145from
chrmarti/devcontainer-proxy-restart-1.145
Nov 2, 2026
Merged

Ladislau Szomoru (lszomoru) merged 1 commit into
release/1.145from
chrmarti/devcontainer-proxy-restart-1.145

Conversation

@chrmarti

Copy link
Copy Markdown
Collaborator

Fixes the Agents Window (Dev Container AgentHost) > Starts a session in a Dev Container smoke test failure in build 491729. Follow-up to #345225.

Cause

The main build has no published CLI for its commit, so the container's Agent Host falls back to the latest insider: release/1.145 @ 6771084, which includes #345225. That Agent Host resolves proxies through the client, and the Linux CI agent has an egress proxy (PROXY 10.1.0.30:18080):

  1. Product race. The proxy resolution landed while the first CopilotClient was starting, so it was restarted right after the start. resolveSessionConfig then resolved managed settings on the stopped client: Unable to load your organization's managed settings. Please try again. Pending response rejected since connection got disposed. The session was never created. Any user behind a proxy can hit this on their first Dev Container or WSL session.
  2. Test environment. The mock CAPI host vscode-smoke.test only resolves inside the container (--add-host), so the CI machine's proxy returns 502 Bad Gateway for it.

Changes

  • CopilotAgent.resolveChatConfig retries managed-settings resolution on the current client when the acquired client is stopped or replaced before the query settles (bounded to 3 clients). It still fails when the client is unchanged, e.g. for a superseded account.
  • The local Dev Container smoke suite sets http.useLocalProxyConfiguration: false, keeping the CI machine's proxy out of the container.
  • Unit test reproducing the restart: a resolved proxy restarts the first client while eager config resolution is in flight.

Note: main runs its own copy of the smoke test, so the test change also needs to land there; the product fix reaches main builds once a new 1.145 insider is published.

Validation

  • .\scripts\test.bat --run src\vs\platform\agentHost\test\node\copilotAgent.test.ts --grep "managed settings|proxy|Proxy": 47 passing.
  • New test without the product fix: fails with Your account or organization settings changed while loading. Please try again.; passes with it.
  • npm run typecheck-client: passed.
  • npm run eslint -- <changed files>: passed.
  • Not run locally: the Dev Container smoke test itself (needs Linux with Docker).

An Agent Host in a local Dev Container or WSL resolves proxies through the
client (#345225). The resolution can land while the first CopilotClient
starts, restarting it right away. resolveSessionConfig then resolved
managed settings on the stopped client and failed with "Unable to load your
organization's managed settings", so the first session never started. Retry
on the current client when the acquired one is stopped or replaced.

The Dev Container smoke test now keeps the CI machine's proxy out of the
container: its mock CAPI host only resolves inside the container.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 2, 2026 11:04

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.

🟢 Approval recommended

No active review findings remain to block approval.

No open issues 🎉

What changed in this PR

Fixes a session-startup race in Agent Host when proxy resolution restarts the Copilot client while managed settings are loading.

Changes:

  • Retries chat configuration resolution across up to three SDK client attempts when the client is stopped or replaced.
  • Adds a regression test for a proxy-triggered restart during managed-settings resolution.
  • Disables client proxy forwarding in the local Dev Container smoke suite so the container-only mock host remains reachable.

No actionable findings remain. The PR reports passing targeted unit tests, type checking, and linting; the Dev Container smoke test was not run locally.

File Description
test/​smoke/​src/​areas/​agentsWindow/​agentsWindow.test.ts Disables local proxy forwarding for the Dev Container fixture.
src/​vs/​platform/​agentHost/​test/​node/​copilotAgent.test.ts Tests managed-settings recovery after a proxy-triggered client restart.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgent.ts Adds bounded retries when managed-settings resolution loses its SDK client.

Review effort: Balanced

Copilot AI commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

One or more custom setup steps configured for this repository failed during this Copilot code review run:

Setup pnpm

Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review.

Note

You can configure setup steps for Copilot code review separately from Copilot cloud agent with a copilot-code-review.yml file. Read the docs for details.

@lszomoru
Ladislau Szomoru (lszomoru) merged commit 64a255f into release/1.145 Nov 2, 2026
55 of 56 checks passed
@lszomoru
Ladislau Szomoru (lszomoru) deleted the chrmarti/devcontainer-proxy-restart-1.145 branch November 2, 2026 12:56
@vs-code-engineering vs-code-engineering Bot added this to the 1.145.0 milestone Nov 2, 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.

3 participants