Skip to content

Copilot CLI: Fix Initializing Connections#3618

Merged
rebornix merged 2 commits intomainfrom
mrayermannmsft/bug/fixcliconnecting
Feb 10, 2026
Merged

Copilot CLI: Fix Initializing Connections#3618
rebornix merged 2 commits intomainfrom
mrayermannmsft/bug/fixcliconnecting

Conversation

@MRayermannMSFT
Copy link
Member

@MRayermannMSFT MRayermannMSFT commented Feb 10, 2026

Fix session ID mismatch in MCP transport registration. The transport was registered under the client's x-copilot-session-id, but the MCP SDK generated a different mcp-session-id via sessionIdGenerator. Follow-up requests using the SDK-assigned ID couldn't find the transport, causing "Bad Request: No valid session ID provided" errors. Fixed by using the client's session ID as the MCP session ID.

Also, added code to not allow multiple clients to connect for the same CLI session ID.

@MRayermannMSFT MRayermannMSFT force-pushed the mrayermannmsft/bug/fixcliconnecting branch 2 times, most recently from 0ef36d0 to 1497216 Compare February 10, 2026 18:49
alexweininger
alexweininger previously approved these changes Feb 10, 2026
@MRayermannMSFT MRayermannMSFT force-pushed the mrayermannmsft/bug/fixcliconnecting branch from 1497216 to 325a244 Compare February 10, 2026 19:03
@MRayermannMSFT MRayermannMSFT marked this pull request as ready for review February 10, 2026 19:10
Copilot AI review requested due to automatic review settings February 10, 2026 19:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Copilot CLI MCP session routing by aligning the MCP SDK session ID with the client-provided CLI session ID, so follow-up requests can reliably resolve the correct in-proc HTTP transport.

Changes:

  • Use the client’s session ID as the MCP transport session ID (via sessionIdGenerator) and register transports under that ID.
  • Reject duplicate initialize requests for an already-connected session ID with an explicit conflict response.

@rebornix rebornix added this pull request to the merge queue Feb 10, 2026
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 10, 2026
Merged via the queue into main with commit f015c12 Feb 10, 2026
19 checks passed
@rebornix rebornix deleted the mrayermannmsft/bug/fixcliconnecting branch February 10, 2026 20:24
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