Skip to content

Keep the GitHub MCP registry policy when a refresh fails - #344895

Merged
Ross Wollman (rwoll) merged 3 commits into
mainfrom
rwoll/mcp-registry-keep-policy
Oct 29, 2026
Merged

Ross Wollman (rwoll) merged 3 commits into
mainfrom
rwoll/mcp-registry-keep-policy

Conversation

@rwoll

@rwoll Ross Wollman (rwoll) commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Fixes #294710

Problem

When an organization or enterprise sets MCP access to registry only in its GitHub Copilot policies, VS Code learns about it from /copilot/mcp_registry. If a refresh of that endpoint failed, VS Code dropped the restriction and MCP access became unrestricted until a later refresh succeeded:

  • A network error, 5xx or malformed response removed the cached registry URL and access level.
  • Any 4xx was treated as "this organization has no registry", including a temporary 401, a 429, and a 403 (which the endpoint returns when MCP is turned off for the user or when rate limited). That empty result was also cached until the next scheduled refresh.

Change

Keep the last known registry policy unless GitHub clearly says it changed. This is the same rule that #337583 applies to managed settings.

  • A failed refresh keeps the previous registry URL and access level, with the original timestamp so the next refresh retries.
  • Only a 404 (the user's Copilot seat isn't from an organization or enterprise), or a 200 with no registries, clears the registry policy. Turning MCP off in Copilot policy, signing out, or switching account or tenant also clears it, as before.
  • On a cold start with nothing cached, a failed fetch still leaves MCP unrestricted. Admins who need a hard guarantee can use the ChatMCP device policy, or GitHub managed settings with forceRemoteSettingsRefresh.

Affected settings and policies

  • chat.mcp.access (policy ChatMCP): the GitHub "registry only" value no longer disappears after a failed refresh.
  • chat.mcp.gallery.serviceUrl (policy McpGalleryServiceUrl): the registry URL from GitHub is kept the same way.
  • Not affected: VS Code device policies (MDM, Group Policy, policy files), and the allowedMcpServers / deniedMcpServers managed settings, which already keep the last good value since managed settings: keep policy through transient refresh failures #337583.

Testing

Added a unit test to defaultAccount.test.ts. It checks that failed refreshes keep the registry policy and its original timestamp, and that a 404 or an empty registry list clears it. The test fails without this change.

A failed /copilot/mcp_registry refresh (network error, 5xx, malformed
response, 401/403/429) no longer drops the organization's MCP registry
URL and "registry only" access level. Only a 404 or an empty registry
list clears them, matching how managed settings handle failures.

Fixes #294710

Co-authored-by: Copilot <[email protected]>
@rwoll Ross Wollman (rwoll) self-assigned this Oct 29, 2026
Copilot AI balanced review requested due to automatic review settings October 29, 2026 04:58

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 issues remain for the change to retain cached GitHub MCP registry policy when refreshes fail.

No open issues 🎉

What changed in this PR

This PR keeps VS Code’s last known GitHub MCP registry policy through failed refreshes, extending the retention behavior used for managed settings.

Changes:

  • Preserve the cached registry URL, access level, and original timestamp when a refresh fails.
  • Treat only HTTP 404 or a successful empty registry response as confirmation to clear the registry policy.
  • Add regression coverage for failed refreshes and confirmed policy removal.
File Description
src/​vs/​workbench/​services/​accounts/​test/​browser/​defaultAccount.test.ts Tests policy and timestamp retention on failures, plus clearing on affirmative responses.
src/​vs/​workbench/​services/​accounts/​browser/​defaultAccount.ts Retains cached registry policy on failures and narrows HTTP-based clearing to 404.

Review effort: Balanced

Ross Wollman (rwoll) and others added 2 commits October 28, 2026 22:05
Reviewed-head: a8964c7
Pull-request: #344895
Approved-by: rwoll via PR Sign-Off
Requested-by: copilot
@rwoll
Ross Wollman (rwoll) enabled auto-merge (squash) October 29, 2026 05:10
@rwoll
Ross Wollman (rwoll) merged commit e7fdeb0 into main Oct 29, 2026
55 checks passed
@rwoll
Ross Wollman (rwoll) deleted the rwoll/mcp-registry-keep-policy branch October 29, 2026 05:18
@vs-code-engineering vs-code-engineering Bot added this to the 1.145.0 milestone Oct 29, 2026
@rwoll Ross Wollman (rwoll) added bug Issue identified by VS Code Team member as probable bug chat-mcp-management Issues related to browsing and managing MCP Servers in VS Code on-testplan labels Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue identified by VS Code Team member as probable bug chat-mcp-management Issues related to browsing and managing MCP Servers in VS Code on-testplan

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VS Code no longer respects GH organization MCP settings on v1.109.2

3 participants