- Notifications
You must be signed in to change notification settings - Fork34
Fix #498: Implement consistent logout experience across VS Code windows#563
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Fixescoder#498 by implementing event-driven authentication synchronization.When a user logs out from one VS Code window, all other windows nowimmediately show a clear 'You've been logged out of Coder!' notificationinstead of confusing errors like 'Invalid argument uriOrString'.Uses ctx.secrets.onDidChange to detect session token changes andsyncAuth() to update all windows consistently.- Add syncAuth() function to handle auth state changes- Listen for sessionToken changes via ctx.secrets.onDidChange- Update REST client, VS Code contexts, and workspace providers- Show consistent logout notifications across windowsTested: A/B validation confirms fix eliminates confusing user experience.
Add debug output to syncAuth function and event listener to help
Move syncAuth function and event listener to better location in codeCleaned up logs
Hi@aslilac Connor asked me to tag you for review of this PR. This fix addresses Issue#498 by implementing event-driven authentication synchronization across VS Code windows. When a user logs out from one window, all other windows now receive consistent "You've been logged out of Coder!" notifications instead of confusing error messages. The solution uses I would be happy to address any feedback you have! Thanks for taking the time to review! |
EhabY commentedSep 23, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Closing this in favor of#590 since it handles both login and logout consistency and we need some urgency to land it. |
Problem
Issue#498 reported inconsistent behavior when users are logged out of Coder:
Cause
Multiple VS Code windows share the same authentication storage, but when one window logs out, other windows aren't notified of the state change. This leads to:
Solution
Implemented event-driven authentication synchronization using VS Code's
ctx.secrets.onDidChange
API:syncAuth()
updates REST client, VS Code contexts, and workspace providers when auth state changesImplementation
ctx.secrets.onDidChange
for immediate, event-driven updates (no polling)Commands.logout()
restClient
, VS Code contexts, and workspace providers consistentlyctx.subscriptions
for extension disposalTesting
Result
Eliminates confusing "Invalid argument" errors
Provides consistent logout experience across all windows
Clear user messaging with actionable "Login" button
Immediate synchronization (no delays)
Fixes#498