-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Restore activationBlockers on auth #1878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Restore activationBlockers on auth
There was a problem hiding this comment.
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 introduces an activation blocker mechanism to prevent the extension from completing activation until critical async operations (authentication and embeddings registration) are complete. Previously, chat requests could fail if they arrived before authentication was ready.
Key Changes:
- Added
activationBlockerproperty toIExtensionContributioninterface that delays extension activation - Modified
ConversationFeatureandLanguageModelAccessto wait for authentication before completing activation - Removed redundant request blocking logic from
ChatAgents(formerlyChatParticipants) class
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/extension/common/contributions.ts | Added activationBlocker property to contribution interface and logic to wait for all blockers before activation completes |
| src/extension/extension/vscode/extension.ts | Updated to await waitForActivationBlockers() and removed unused log service import |
| src/extension/conversation/vscode-node/conversationFeature.ts | Implemented activationBlocker that resolves when authentication token is available |
| src/extension/conversation/vscode-node/languageModelAccess.ts | Implemented activationBlocker for chat provider and embeddings registration, improved embeddings re-registration on auth change |
| src/extension/conversation/vscode-node/chatParticipants.ts | Removed redundant request blocking logic (now handled by ConversationFeature), renamed class from ChatParticipants to ChatAgents |
| src/extension/conversation/vscode-node/test/conversationFeature.test.ts | Added test to verify feature behavior when interactive version doesn't match |
| this.activated = false; | ||
| } | ||
|
|
||
| activationBlockerDeferred.complete(); |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The activationBlockerDeferred.complete() can be called multiple times if the authentication changes multiple times. DeferredPromise.complete() should only be called once. Consider adding a check to ensure it's only called once, or restructure to complete the promise on the first authentication event (whether token exists or not).
| const sw = StopWatch.create(); | ||
| const id = instance.id || 'UNKNOWN'; | ||
| this.allActivationBlockers.push(instance.activationBlocker.finally(() => { | ||
| logService.info(`activationBlocker from '${id}' took for ${Math.round(sw.elapsed())}ms`); |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected grammar: 'took for' should be 'took'.
| logService.info(`activationBlocker from '${id}' took for ${Math.round(sw.elapsed())}ms`); | |
| logService.info(`activationBlocker from '${id}' took ${Math.round(sw.elapsed())}ms`); |
…#1878) Restore activationBlockers on auth Co-authored-by: Logan Ramos <loganramos@microsoft.com>
Merge candidate PR #1860 to main