Skip to content

chat: Fix failures when organization settings load slowly - #342167

Merged
Ross Wollman (rwoll) merged 5 commits into
mainfrom
agents/fix-handoff-md-after-sync-main
Oct 16, 2026
Merged

Ross Wollman (rwoll) merged 5 commits into
mainfrom
agents/fix-handoff-md-after-sync-main

Conversation

@rwoll

Copy link
Copy Markdown
Member

Fixes #342123.

Slow organization-settings checks no longer fail a chat or model change after 3.5 seconds.

  • Show “Loading your organization's managed settings” only when the check takes longer than 3.5 seconds, then continue automatically when it finishes.
  • Offer Retry for failed requests, with a 30-second limit rather than an indefinite wait.
  • Keep Stop responsive while settings load, including when starting a new chat.

Organization restrictions still apply before a request runs. No new settings or policy bypasses.

Validation: 3,191 tests passed, 1 skipped; build, type-check, lint, and formatting passed. Live Windows/WSL testing remains outstanding.

Test commands and results

All commands below passed. Tests ran with the inherited COPILOT_HOME override removed to use their isolated fixtures.

fnm exec --using 24.18.0 npm run build-fast -- --client-only
fnm exec --using 24.18.0 npm run typecheck-client
git diff --name-only --diff-filter=ACM -z -- '*.ts' | xargs -0 fnm exec --using 24.18.0 npm run eslint --
git diff --name-only --diff-filter=ACM -z -- '*.ts' | xargs -0 fnm exec --using 24.18.0 node build/lib/formatter.ts --verify
git diff --check

Regression suites: 3,191 passed, 1 skipped.

env -u COPILOT_HOME fnm exec --using 24.18.0 ./scripts/test.sh \
  --run src/vs/platform/agentHost/test/node/copilotManagedSettings.test.ts \
  --run src/vs/platform/agentHost/test/node/copilotAgent.test.ts \
  --run src/vs/platform/agentHost/test/node/copilotSessionLauncher.test.ts \
  --run src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts \
  --run src/vs/platform/agentHost/test/node/agentHostTurnTelemetry.test.ts \
  --run src/vs/platform/agentHost/test/node/agentSideEffects.test.ts \
  --run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostDownloadProgress.test.ts \
  --run src/vs/workbench/contrib/chat/test/browser/remoteAgentHost/remoteAgentHostChatContribution.test.ts \
  --run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts \
  --run src/vs/workbench/contrib/chat/test/browser/widget/chatContentParts/chatErrorConfirmationPart.test.ts \
  --reporter dot

🤖 Authored with GitHub Copilot on behalf of Ross Wollman (@rwoll).

Keep slow Copilot managed-settings queries pending, show delayed progress, and offer retry without weakening policy enforcement. Preserve cancellation and runtime recovery across chat creation and model changes.

Fixes #342123.

🤖 Authored with GitHub Copilot on behalf of @rwoll.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 20:28
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: a7e1fc08 Current: a63598d1

Changed (1)

sessions/sessionActivityBar/sessionActivityBar/SubmenuOpen/Light
Before After
before after

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

First-send Retry handling, companion-selection cancellation, and timeout listener cleanup remain incomplete.

3 open findings
What changed in this PR

Updates Agent Host chat setup to tolerate slow organization-policy checks while preserving policy enforcement.

Changes:

  • Replaces the 3.5-second failure deadline with delayed progress and a 30-second timeout.
  • Adds retryable policy errors and cancellation support during setup.
  • Expands regression tests and accessibility guidance.
File Description
src/​vs/​workbench/​contrib/​chat/​test/​browser/​widget/​chatContentParts/​chatErrorConfirmationPart.test.ts Tests saved-request Retry behavior.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​remoteAgentHost/​remoteAgentHostChatContribution.test.ts Tests remote progress cleanup.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentHostDownloadProgress.test.ts Tests indeterminate policy progress.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentHostChatContribution.test.ts Tests policy Retry as a fresh send.
src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​remoteAgentHostChatContribution.ts Displays remote setup progress.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostSessionHandler.ts Adds Retry for policy turn errors.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostDownloadProgress.ts Supports indeterminate setup progress.
src/​vs/​workbench/​contrib/​chat/​browser/​actions/​chatAccessibilityHelp.ts Documents Retry and Stop.
src/​vs/​platform/​agentHost/​test/​node/​copilotSessionLauncher.test.ts Tests policy enforcement after slow resolution.
src/​vs/​platform/​agentHost/​test/​node/​copilotManagedSettings.test.ts Tests sharing, timeout, cancellation, and invalidation.
src/​vs/​platform/​agentHost/​test/​node/​copilotAgentSession.test.ts Tests model refresh after idle abort.
src/​vs/​platform/​agentHost/​test/​node/​copilotAgent.test.ts Tests slow setup, cancellation, and recovery.
src/​vs/​platform/​agentHost/​test/​node/​agentSideEffects.test.ts Tests host-wide progress forwarding.
src/​vs/​platform/​agentHost/​test/​node/​agentHostTurnTelemetry.test.ts Tests policy-error and cancellation reporting.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotSessionLauncher.ts Threads cancellation through policy-gated launch.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotManagedSettings.ts Implements shared, bounded policy resolution.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentSession.ts Adds launch and lifetime cancellation.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgent.ts Integrates resolution and cancellable model selection.
src/​vs/​platform/​agentHost/​node/​agentSideEffects.ts Forwards progress and classifies policy failures.
src/​vs/​platform/​agentHost/​common/​agent.ts Defines policy errors and provider progress.
src/​vs/​platform/​agentHost/​AGENTS.md Documents managed-settings behavior.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Ross Wollman (rwoll) and others added 4 commits October 16, 2026 13:43
Construct the resolver and its progress event in the CopilotAgent constructor so native class-field initialization never reads the log service before it is assigned. This fixes the Compile & Hygiene define-class-fields check.

🤖 Authored with GitHub Copilot on behalf of @rwoll.

Co-authored-by: Copilot <[email protected]>
Preserve upstream per-chat credential scoping and Copilot home injection alongside cancellable managed-settings resolution.

🤖 Authored with GitHub Copilot on behalf of @rwoll.

Co-authored-by: Copilot <[email protected]>
Unblock validation after merging main: consolidate the branch changeset helper imports and remove a duplicate gitService fixture property introduced by #342128. No runtime behavior changes.

🤖 Authored with GitHub Copilot on behalf of @rwoll.

Co-authored-by: Copilot <[email protected]>
Cancel queued agent selection alongside model selection, release generation listeners when policy queries time out, and preserve retryable policy errors across JSON-RPC and IPC before the first turn starts. Add paired-selection, listener cleanup, and first-send Retry regressions.

🤖 Authored with GitHub Copilot on behalf of @rwoll.

Co-authored-by: Copilot <[email protected]>
@rwoll
Ross Wollman (rwoll) marked this pull request as ready for review October 16, 2026 22:13
@rwoll
Ross Wollman (rwoll) enabled auto-merge (squash) October 16, 2026 22:23
@rwoll
Ross Wollman (rwoll) merged commit 1278559 into main Oct 16, 2026
49 checks passed
@rwoll
Ross Wollman (rwoll) deleted the agents/fix-handoff-md-after-sync-main branch October 16, 2026 22:36
@vs-code-engineering vs-code-engineering Bot added this to the 1.143.0 milestone Oct 16, 2026
Ross Wollman (rwoll) added a commit that referenced this pull request Oct 20, 2026
…ts (#342937)

Follow-up to #342167.

When an organization's managed settings load slowly, users saw several identical "Loading your organization's managed settings" toasts stacked up. Most were for background work they weren't waiting on.

The message now appears only in the chat that is waiting for these settings, inline in its progress row like "Working…". It disappears when the settings load. Background loading no longer interrupts the user.

Known gap (follow-up): the first send in a new chat can still pause before the message moves into the chat while settings load, now without a toast.

The mock policy server also gets a **Response delay (ms)** setting (`delayMs`, default 0) to reproduce slow delivery.

## Screenshot

<img width="582" height="224" alt="Screenshot 2026-10-20 at 9 26 54 AM" src="https://github.com/user-attachments/assets/5ca50e4b-5231-48d2-8cdb-051d61832963" />

## How to test

1. Run `npm run mock-policy-server` and route the client to it.
2. Clear the policy cache in the GUI, then set **Response delay (ms)** to `8000` for Managed Settings.
3. Send a message in a new chat. After about 3.5 seconds the loading message appears inline in the chat, and no toasts appear.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*
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.

Model selection times out in 3.5 seconds, fails prompt

4 participants