Skip to content

sessions: return to sign-in screen after sign out (#307660)#307781

Open
hawkticehurst wants to merge 2 commits intomainfrom
copilot/static-dinosaur
Open

sessions: return to sign-in screen after sign out (#307660)#307781
hawkticehurst wants to merge 2 commits intomainfrom
copilot/static-dinosaur

Conversation

@hawkticehurst
Copy link
Copy Markdown
Member

Fixes #307660

Summary

  • wait for the default account sign-out flow to complete before resetting the sessions welcome state
  • reopen the sessions welcome/sign-in walkthrough after entitlement falls back to Unknown
  • keep transient Unknown entitlement handling unchanged for token refreshes and add regression coverage for the sign-out path

Testing

  • npm run compile-check-ts-native
  • npm run valid-layers-check
  • node --experimental-strip-types build/hygiene.ts src/vs/sessions/common/welcome.ts src/vs/sessions/contrib/accountMenu/browser/account.contribution.ts src/vs/sessions/contrib/accountMenu/test/browser/account.contribution.test.ts src/vs/sessions/contrib/welcome/browser/welcome.contribution.ts src/vs/sessions/contrib/welcome/test/browser/welcome.contribution.test.ts src/vs/workbench/services/accounts/browser/defaultAccount.ts

Notes

  • Targeted unit tests could not be run locally because the Electron test harness in this environment crashes before loading tests (test/unit/electron/index.js sees app as undefined).

Copilot AI review requested due to automatic review settings April 4, 2026 04:09
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 adjusts the Agents (“sessions”) sign-out flow so that, after signing out, the app returns users to the Sessions welcome/sign-in walkthrough instead of leaving them in a partially signed-in state.

Changes:

  • Await the default account sign-out command to ensure the sign-out flow completes before downstream logic runs.
  • Introduce a shared WELCOME_COMPLETE_KEY constant and update welcome logic to treat Unknown entitlement differently depending on whether welcome was previously completed.
  • Add unit coverage for the sign-out → entitlement Unknown → welcome overlay behavior, and for canceled sign-out.

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/vs/workbench/services/accounts/browser/defaultAccount.ts Awaits the underlying sign-out command to make sign-out completion deterministic.
src/vs/sessions/common/welcome.ts Adds a shared export for the sessions welcome completion storage key.
src/vs/sessions/contrib/welcome/browser/welcome.contribution.ts Uses the shared key and updates entitlement watching logic to optionally include Unknown when welcome completion is cleared.
src/vs/sessions/contrib/welcome/test/browser/welcome.contribution.test.ts Adds regression coverage for explicit sign-out behavior (welcome key cleared + Unknown entitlement shows overlay).
src/vs/sessions/contrib/accountMenu/browser/account.contribution.ts Introduces a sign-out helper that waits for entitlement to become Unknown before resetting the sessions welcome flow.
src/vs/sessions/contrib/accountMenu/test/browser/account.contribution.test.ts Adds tests validating sign-out sequencing and ensuring canceled sign-out does not reset the welcome flow.

Wait for the default account sign-out flow to finish before resetting the sessions welcome state, then reopen the welcome overlay once entitlement falls back to Unknown.

This preserves the existing transient Unknown handling for token refreshes while making explicit sign-out immediately return users to the sign-in screen and block the sessions UI until they sign in again.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@hawkticehurst hawkticehurst force-pushed the copilot/static-dinosaur branch from ef7dd83 to cca35bb Compare April 4, 2026 04:24
@hawkticehurst
Copy link
Copy Markdown
Member Author

Rebased this PR onto the latest origin/main and addressed the Copilot review feedback.

Updates in cca35bbf41a:

  • kept the new upstream sign-out confirmation/removal flow from sessions: use generic sign out confirmation copy #307727 and layered the sessions welcome reset on top
  • moved skip-sessions-welcome handling into workbench.action.resetSessionsWelcome so sign-out respects the existing skip behavior
  • removed the redundant welcome-key removal from the sign-out helper and simplified the helper/tests accordingly

Validation rerun after the rebase:

  • npm run compile-check-ts-native
  • npm run valid-layers-check
  • node --experimental-strip-types build/hygiene.ts src/vs/sessions/common/welcome.ts src/vs/sessions/contrib/accountMenu/browser/account.contribution.ts src/vs/sessions/contrib/accountMenu/test/browser/account.contribution.test.ts src/vs/sessions/contrib/welcome/browser/welcome.contribution.ts src/vs/sessions/contrib/welcome/test/browser/welcome.contribution.test.ts src/vs/workbench/services/accounts/browser/defaultAccount.ts

The local Electron unit-test harness is still crashing before loading targeted tests in this environment, so I wasn’t able to rerun those here.

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

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

@hawkticehurst
Copy link
Copy Markdown
Member Author

Addressed the latest Copilot review feedback in a follow-up update.

Latest change:

  • fixed the showSessionsWelcomeAfterSignOut race by attaching the entitlement listener before re-checking for ChatEntitlement.Unknown, then canceling the listener once the wait is no longer needed
  • added regression coverage for the edge case where entitlement flips to Unknown while the listener is being attached

I intentionally did not add a timeout fallback here because resetting the welcome flow before entitlement reaches Unknown can immediately auto-complete the walkthrough and regress the sign-out experience.

Validation rerun:

  • npm run compile-check-ts-native
  • npm run valid-layers-check
  • node --experimental-strip-types build/hygiene.ts src/vs/sessions/common/welcome.ts src/vs/sessions/contrib/accountMenu/browser/account.contribution.ts src/vs/sessions/contrib/accountMenu/test/browser/account.contribution.test.ts src/vs/sessions/contrib/welcome/browser/welcome.contribution.ts src/vs/sessions/contrib/welcome/test/browser/welcome.contribution.test.ts src/vs/workbench/services/accounts/browser/defaultAccount.ts

Attach the entitlement listener before re-checking for the Unknown state so the sessions sign-out flow cannot miss the transition while the listener is being registered.

Also add regression coverage for the edge case while preserving the existing welcome-reset behavior after sign-out.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

Agents: Signing out should take you back to the sign in screen

3 participants