Skip to content

sessions: show welcome overlay on explicit sign-out#307191

Merged
joshspicer merged 2 commits intomainfrom
copilot/accessible-mosquito
Apr 1, 2026
Merged

sessions: show welcome overlay on explicit sign-out#307191
joshspicer merged 2 commits intomainfrom
copilot/accessible-mosquito

Conversation

@joshspicer
Copy link
Copy Markdown
Member

@joshspicer joshspicer commented Apr 1, 2026

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.Unknown was excluded from the runtime watcher to avoid false positives from OAuth token refreshes.

Solution

Introduce a signedOut observable that tracks whether the default account has been removed. When IDefaultAccountService.onDidChangeDefaultAccount fires with null, this observable flips to true, which causes the existing watcher autorun to include ChatEntitlement.Unknown in 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, so signedOut stays false and Unknown remains excluded.

Changes

  • Add signedOut observable to SessionsWelcomeContribution that tracks account removal
  • Listen to IDefaultAccountService.onDidChangeDefaultAccount in watchEntitlementState() to update the observable
  • The watcher autorun reads signedOut and passes it as includeUnknown to _needsChatSetup(), so ChatEntitlement.Unknown only triggers the overlay after a genuine sign-out
  • Updated JSDoc to reflect the new behavior

Copilot AI review requested due to automatic review settings April 1, 2026 16:27
Copy link
Copy Markdown
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

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 IDefaultAccountService into SessionsWelcomeContribution.
  • Extend watchEntitlementState() to listen for default account removal (null) and show the overlay immediately.
  • Update the JSDoc explaining why ChatEntitlement.Unknown remains ignored in the entitlement watcher.

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>
@joshspicer joshspicer force-pushed the copilot/accessible-mosquito branch from cde3502 to 0ef529c Compare April 1, 2026 16:46
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>
@joshspicer joshspicer merged commit fd640bb into main Apr 1, 2026
19 checks passed
@joshspicer joshspicer deleted the copilot/accessible-mosquito branch April 1, 2026 20:22
@vs-code-engineering vs-code-engineering bot added this to the 1.115.0 milestone Apr 1, 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.

3 participants