Skip to content

Coalesce concurrent connection-sharing permission prompts - #22617

Closed
Chris Johnstone (cjohnsto-nz) wants to merge 2 commits into
microsoft:mainfrom
cjohnsto-nz:feature/connection-sharing-prompts
Closed

Coalesce concurrent connection-sharing permission prompts#22617
Chris Johnstone (cjohnsto-nz) wants to merge 2 commits into
microsoft:mainfrom
cjohnsto-nz:feature/connection-sharing-prompts

Conversation

@cjohnsto-nz

Copy link
Copy Markdown
Contributor

Description

This PR extracts the connection-sharing prompt improvement from #22614 into a focused change.

Concurrent connection-sharing requests from the same extension can arrive before the user's permission choice has been persisted. Previously, each request could display its own permission prompt.

This change tracks the in-flight permission request for each extension and shares its result with concurrent callers. The request is removed after completion so later permission checks and retries continue to work normally. Requests from different extensions remain independent.

A regression test verifies that two concurrent requests from the same extension display only one permission prompt.

Validation performed:

  • npm run build -- --target mssql
  • npm run test -- --target mssql --coverage=false
  • npm run package -- --target mssql --online
  • Manual VSIX installation and connection-sharing testing

Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (npm run test)
  • Code follows contributing guidelines
  • Telemetry/logging updated if relevant — existing logging retained
  • No regressions or UX breakage

Reviewers: Please read our reviewer guidelines

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

This PR prevents duplicate connection-sharing permission prompts by coalescing concurrent permission requests per calling extension, so multiple simultaneous callers from the same extension share a single in-flight prompt/result.

Changes:

  • Track in-flight permission requests in ConnectionSharingService keyed by extensionId and share the same Promise<boolean> with concurrent callers.
  • Ensure the in-flight entry is cleaned up on completion (success or failure) so later checks/retries behave normally.
  • Add a unit test covering concurrent requests from the same extension to ensure only one prompt is shown.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
extensions/mssql/src/connectionSharing/connectionSharingService.ts Adds per-extension in-flight permission request tracking and coalescing logic.
extensions/mssql/test/unit/connectionSharingService.test.ts Adds a regression test for concurrent permission requests sharing one prompt.

Comment thread extensions/mssql/test/unit/connectionSharingService.test.ts
Copilot AI review requested due to automatic review settings August 5, 2026 05:20

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@Benjin

Copy link
Copy Markdown
Contributor

Chris Johnstone (@cjohnsto-nz) Are you building anything that uses the connection sharing mechanism? We're actually thinking about deprecating due to near-zero usage, but if there's still interest from the community, that'd be good to know.

@cjohnsto-nz

Copy link
Copy Markdown
Contributor Author

Benjin Dubishar (@Benjin) I did once upon a time, when I added SQL Notebook support to .NET Interactive, but that didn't last long 🥲

No future plans from me.

The embedded AI tools in vscode mssql are the killer feature for me honestly. They reduce most of my need for connection sharing, since I can just get GHCP to execute whatever requests are required.

@Benjin

Copy link
Copy Markdown
Contributor

Chris Johnstone (@cjohnsto-nz) Gotchya. I'll close this PR in that case. Please file an issue to let us know if you ever start looking to build tooling on top of vscode-mssql again, and we'll see what we can do to help you out!

Also, really glad to hear this. 🙂 I'll share that bit of praise with the team.

The embedded AI tools in vscode mssql are the killer feature for me honestly.

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.

3 participants