Skip to content

Fix persisted Agent Host MCP authentication - #327154

Merged
Ulugbek Abdullaev (ulugbekna) merged 1 commit into
mainfrom
ulugbekna/fix-agent-host-mcp-auth-restore
Jul 23, 2026
Merged

Ulugbek Abdullaev (ulugbekna) merged 1 commit into
mainfrom
ulugbekna/fix-agent-host-mcp-auth-restore

Conversation

@ulugbekna

Copy link
Copy Markdown
Contributor

Fixes #327137

cc Connor Peet (@connor4312)

Summary

  • restore persisted dynamically registered MCP OAuth providers during silent Agent Host authentication after an extension-host restart
  • preserve existing account preference and MCP URL access consent before forwarding tokens
  • keep silent token refresh non-interactive when the stored OAuth client is invalid
  • serialize each Agent Host provider authentication transaction through token forwarding so concurrent client configurations cannot replace a provider mid-request

Testing

  • NODE_OPTIONS=--max-old-space-size=8192 npm run typecheck-client
  • ./scripts/test.sh --run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostAuth.test.ts --run src/vs/workbench/api/test/browser/extHostAuthentication.test.ts
  • ./scripts/test.sh --run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts --grep "mcp auth prompt|silently authenticates|deduplicates concurrent silent authentication"
  • npm run valid-layers-check
  • npm run precommit

Restore persisted dynamic OAuth providers silently after extension host restarts while preserving consent and noninteractive client behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 111cc987-c300-40e6-83f7-f5f524b35fed
Copilot AI review requested due to automatic review settings July 23, 2026 16:21
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

TylerLeonhardt

Matched files:

  • src/vs/workbench/api/common/extHostAuthentication.ts
  • src/vs/workbench/services/authentication/common/authentication.ts

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.

Pull request overview

Fixes persisted Agent Host MCP OAuth authentication after extension-host restarts.

Changes:

  • Restores persisted dynamic OAuth providers during silent authentication.
  • Prevents interactive client rotation during silent token refresh.
  • Serializes provider authentication and adds regression tests.
Show a summary per file
File Description
authentication.ts Adds silent session-resolution options.
agentHostAuth.ts Restores providers and serializes authentication.
agentHostAuth.test.ts Covers restoration and concurrency.
extHostAuthentication.ts Makes refresh behavior silence-aware.
extHostAuthentication.test.ts Tests invalid-client silent refresh.

Review details

  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Medium

@ulugbekna
Ulugbek Abdullaev (ulugbekna) merged commit 0fcfb10 into main Jul 23, 2026
30 checks passed
@ulugbekna
Ulugbek Abdullaev (ulugbekna) deleted the ulugbekna/fix-agent-host-mcp-auth-restore branch July 23, 2026 17:46
@vs-code-engineering vs-code-engineering Bot added this to the 1.131.0 milestone Jul 23, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Sep 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agents window repeatedly prompts for MCP authentication after extension host restart

3 participants