Repository navigation
chat: Fix failures when organization settings load slowly - #342167
Merged
Ross Wollman (rwoll) merged 5 commits intoOct 16, 2026
Merged
Conversation
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]>
Contributor
Contributor
There was a problem hiding this comment.
🟡 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.
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]>
Ross Wollman (rwoll)
marked this pull request as ready for review
October 16, 2026 22:13
Ross Wollman (rwoll)
enabled auto-merge (squash)
October 16, 2026 22:23
Justin Chen (justschen)
approved these changes
Oct 16, 2026
Dmitriy Vasyura (dmitrivMS)
approved these changes
Oct 16, 2026
Ross Wollman (rwoll)
deleted the
agents/fix-handoff-md-after-sync-main
branch
October 16, 2026 22:36
This was referenced Oct 19, 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.*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #342123.
Slow organization-settings checks no longer fail a chat or model change after 3.5 seconds.
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_HOMEoverride removed to use their isolated fixtures.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).