Fix #498: Implement consistent logout experience across VS Code windows #563
+54
−0
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.
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