sessions: show welcome overlay on explicit sign-out#307191
Merged
joshspicer merged 2 commits intomainfrom Apr 1, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Sessions window welcome/login overlay logic so that a user-initiated sign-out (via account menu) immediately shows the welcome overlay, instead of waiting until the next launch. It does this by listening to default-account changes in addition to the existing entitlement/sentiment observable watcher.
Changes:
- Inject
IDefaultAccountServiceintoSessionsWelcomeContribution. - Extend
watchEntitlementState()to listen for default account removal (null) and show the overlay immediately. - Update the JSDoc explaining why
ChatEntitlement.Unknownremains ignored in the entitlement watcher.
src/vs/sessions/contrib/welcome/browser/welcome.contribution.ts
Outdated
Show resolved
Hide resolved
src/vs/sessions/contrib/welcome/browser/welcome.contribution.ts
Outdated
Show resolved
Hide resolved
When the user signs out via the account menu, show the welcome/login overlay immediately instead of waiting for the next app launch. Listen to IDefaultAccountService.onDidChangeDefaultAccount for the account becoming null, which reliably indicates a user-initiated sign-out. Token refreshes keep the account non-null so there is no false-positive risk. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
cde3502 to
0ef529c
Compare
The tests were missing a mock for IDefaultAccountService which was newly injected. Add an emitter-based stub and a test that verifies the explicit sign-out flow shows the overlay. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bpasero
approved these changes
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the user signs out via the account menu in the Sessions window, the welcome/login overlay now appears immediately instead of waiting for the next app launch.
Problem
After signing out, users were left staring at the sessions UI with no way to re-authenticate without restarting the app. The welcome overlay (which prompts sign-in) was intentionally not shown because
ChatEntitlement.Unknownwas excluded from the runtime watcher to avoid false positives from OAuth token refreshes.Solution
Introduce a
signedOutobservable that tracks whether the default account has been removed. WhenIDefaultAccountService.onDidChangeDefaultAccountfires withnull, this observable flips totrue, which causes the existing watcher autorun to includeChatEntitlement.Unknownin its setup check — triggering the welcome overlay.This avoids the race condition of calling
showOverlay()directly from the account listener (where entitlement hasn't updated yet and the overlay would instantly dismiss itself). Token refresh safety is preserved: the account stays non-null during refresh, sosignedOutstaysfalseandUnknownremains excluded.Changes
signedOutobservable toSessionsWelcomeContributionthat tracks account removalIDefaultAccountService.onDidChangeDefaultAccountinwatchEntitlementState()to update the observablesignedOutand passes it asincludeUnknownto_needsChatSetup(), soChatEntitlement.Unknownonly triggers the overlay after a genuine sign-out