Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts the default account MCP registry caching behavior to reduce renderer startup stalls caused by repeated sequential 404/empty responses from the GitHub MCP registry endpoint.
Changes:
- Introduces a 24-hour negative-cache interval for MCP registry lookups when the last fetch yielded no registry URL.
- Adds
isMcpRegistryDataStaleto choose between the standard 1-hour window and the new negative-cache window. - Updates
getMcpRegistryProviderto use the MCP-specific staleness logic.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/services/accounts/browser/defaultAccount.ts | Extends MCP registry negative caching to 24h and centralizes the staleness decision in a helper to avoid repeated 404 fetches during startup. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
Contributor
blocks-ci screenshots changedReplace the contents of Updated blocks-ci-screenshots.md<!-- auto-generated by CI — do not edit manually -->
#### editor/codeEditor/CodeEditor/Dark

#### editor/codeEditor/CodeEditor/Light

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Dark

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Light

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Dark

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Light
 |
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 #315314
The built-in
defaultAccountprovider blocks workbench startup with the MCP registry fetch when:mcp=1enabled, butTwo things make this worse than it has to be:
init(), so it sits in the renderer's critical path.request()helper retries 401/404 across every authenticated GitHub session — so a single registry call fans out into 3+ sequential requests for users with multiple accounts (~500ms each, hence the "VERY LONG TASK 536ms / 494ms" warnings in the report).Changes
retryOn404option on the sharedrequest()helper (defaults to existing behavior; only the MCP path passesfalse). 401 retry is preserved.getDefaultAccountFromAuthenticatedSessionsreturns immediately with the cached MCP registry value, andrefreshMcpRegistryInBackgroundperforms the network round-trip and firesonDidChangePolicyDatawhen it resolves. The background path drops the result if the active account changed in the meantime.forceRefresh. When the caller explicitly requests a fresh result (e.g. theDeveloper: Sync Account Policycommand,forceResolveEntitlement), the MCP fetch is awaited inline so the returned data is genuinely fresh. Startup and event-driven refreshes (noforceRefresh) take the non-blocking path.Reactive consumers — the
ChatMCPandMcpGalleryServiceUrlpolicy bindings inchat.contribution.ts— re-evaluate ononDidChangePolicyData, so they pick up the background refresh result automatically.Expected impact
Developer: Sync Account PolicyThe two
VERY LONG TASK (536ms / 494ms)warnings in the report should disappear, and the "UI freezing for 1-2 seconds on every startup" symptom is removed.Notes
The CPU profile attached to the issue (
renderer-86585e.cpuprofile.json) does not contain the MCP-blocking task — the capture window appears to start after the freeze. The bug is corroborated by the reporter's other evidence (threeGET .../copilot/mcp_registry 404console entries, twoVERY LONG TASKwarnings matching expected request latency, and a stack trace throughrequestMcpRegistryProvider→getMcpRegistryProvider→getDefaultAccountFromAuthenticatedSessions) and by reading the code path.This complements the prior fix in #306467, which already gated the MCP fetch on
mcp=1in the Copilot token. This PR addresses the remaining case where the token hasmcp=1but no registry endpoint is provisioned for the account.