Skip to content

agentHost: preserve static MCP OAuth client IDs - #334135

Merged
Paul (pwang347) merged 1 commit into
mainfrom
pwang/fix-agent-host-mcp-oauth-client
Sep 2, 2026
Merged

agentHost: preserve static MCP OAuth client IDs#334135
Paul (pwang347) merged 1 commit into
mainfrom
pwang/fix-agent-host-mcp-oauth-client

Conversation

@pwang347

Copy link
Copy Markdown
Member

Supersedes #328347.

Problem

Agent Host reconstructs workspace and plugin MCP server configuration before handing it to the Copilot SDK. The current path:

  • drops nested oauth.clientId and SDK-style oauthClientId during workspace normalization;
  • omits the static OAuth client ID from toSdkMcpServer; and
  • drops an ID-only staticClientConfig unless publicClient is explicitly true.

For servers such as Slack that require a pre-registered client and do not support Dynamic Client Registration, the runtime consequently receives no client ID. VS Code falls back to DCR and prompts the user to manually provide client registration details.

Fix

  • Normalize both supported workspace client-ID shapes into the internal oauth.clientId representation.
  • Project the internal client ID to the SDK as oauthClientId.
  • Preserve ID-only static clients when publicClient is omitted, matching the runtime public-client default.
  • Let a supplied clientSecret take priority over publicClient, and cover that behavior with a regression test requested on Preserve static MCP OAuth client id in agent host #328347.

Validation

  • npm run typecheck-client
  • Targeted ESLint on all six changed files
  • ./scripts/test.sh --grep "pluginParsers|copilotPluginConverters" (99 passing)
  • ./scripts/test.sh --grep "CopilotAgentSession MCP server inventory" (27 passing)
  • npm run precommit

Copilot AI balanced review requested due to automatic review settings September 2, 2026 22:25

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.

Copilot review overview

🟢 Approval recommended

The narrowly scoped OAuth propagation changes are consistent and covered by targeted regression tests.

Review tier: Balanced
Findings: None

What changed in this PR

Preserves static MCP OAuth client IDs through Agent Host normalization, SDK conversion, and authentication handling.

Changes:

  • Normalizes VS Code and SDK OAuth client-ID formats.
  • Forwards client IDs to the Copilot SDK.
  • Correctly prioritizes secrets and defaults ID-only clients to public.
File Description
pluginParsers.test.ts Tests both OAuth input formats.
pluginParsers.ts Normalizes OAuth client IDs.
copilotPluginConverters.test.ts Tests SDK conversion.
copilotAgentSession.test.ts Covers secret priority and public default.
copilotPluginConverters.ts Forwards oauthClientId.
copilotAgentSession.ts Corrects static-client selection.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@pwang347
Paul (pwang347) marked this pull request as ready for review September 2, 2026 22:37
@pwang347
Paul (pwang347) enabled auto-merge (squash) September 2, 2026 22:37
@pwang347
Paul (pwang347) merged commit 0d08695 into main Sep 2, 2026
41 checks passed
@pwang347
Paul (pwang347) deleted the pwang/fix-agent-host-mcp-oauth-client branch September 2, 2026 23:44
@vs-code-engineering vs-code-engineering Bot added this to the 1.137.0 milestone Sep 2, 2026
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.

4 participants