Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Conversation

OyinloluB
Copy link

Problem

Issue#498 reported inconsistent behavior when users are logged out of Coder:

  • Window A might show clear "please login" messages
  • Window B would show confusing errors like "Invalid argument 'uriOrString'"
  • Windows became unusable with no clear indication of what was wrong

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:

  • Inconsistent UI states across windows
  • Confusing error messages instead of clear logout notifications
  • Poor user experience

Solution

Implemented event-driven authentication synchronization using VS Code'sctx.secrets.onDidChange API:

  1. Authentication Sync Function:syncAuth() updates REST client, VS Code contexts, and workspace providers when auth state changes
  2. Event Listener: Detects session token changes across all windows
  3. Consistent Notifications: All windows show clear "You've been logged out of Coder!" messages
  4. UI State Sync: Sidebars and contexts update consistently across windows

Implementation

  • Usesctx.secrets.onDidChange for immediate, event-driven updates (no polling)
  • Reuses existing logout notification patterns fromCommands.logout()
  • UpdatesrestClient, VS Code contexts, and workspace providers consistently
  • Proper cleanup viactx.subscriptions for extension disposal

Testing

  • A/B Validation: Confirmed bug exists without fix, disappears with fix
  • Multi-window Testing: Tested logout sync across multiple Extension Development Host windows
  • User Experience: Verified clear notifications replace confusing errors
  • Debug Logs: Added logging to help reviewers verify fix during testing

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

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
@OyinloluB
Copy link
Author

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 usesctx.secrets.onDidChange to detect session token changes and synchronizes the authentication state across all windows immediately.

I would be happy to address any feedback you have!

Thanks for taking the time to review!

@matifalimatifali requested a review fromaslilacAugust 4, 2025 08:36
@EhabY
Copy link
Collaborator

EhabY commentedSep 23, 2025
edited
Loading

Closing this in favor of#590 since it handles both login and logout consistency and we need some urgency to land it.

@EhabYEhabY closed thisSep 23, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@aslilacaslilacAwaiting requested review from aslilac

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Improve consistency in client-side logout experience
2 participants
@OyinloluB@EhabY

[8]ページ先頭

©2009-2025 Movatter.jp