Fix spacetime logout failing when offline#4361
Merged
Conversation
bfops
reviewed
Feb 20, 2026
Collaborator
bfops
left a comment
There was a problem hiding this comment.
This LGTM - waiting for another human to approve
spacetime logout failing when offline
jdetter
approved these changes
Feb 23, 2026
Collaborator
jdetter
left a comment
There was a problem hiding this comment.
Seems fine to me - haven't tested myself but the change makes sense 👍
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Mar 6, 2026
## Summary Improves the `spacetime login` and `spacetime logout` UX to behave more like standard CLI tools. ### `spacetime login` **Before:** If already logged in, prints "You are already logged in" and exits. User must manually run `logout` first. **After:** If already logged in, automatically logs out the previous session and proceeds with a fresh login. Prints the old identity being logged out and the new identity on success. ``` $ spacetime login Logged out of previous session (identity 0xabc...). Opening https://spacetimedb.com/login/cli?token=... in your browser. Waiting to hear response from the server... Logged in with identity 0xdef... ``` ### `spacetime logout` **Before:** No output on success. Hard failure if offline. **After:** - Prints confirmation: `Logged out (identity 0xabc...).` - Prints `You are not logged in.` if already logged out - Best-effort server-side session invalidation with 5s timeout (prints warning if offline instead of failing) ### Changes - `login.rs`: Remove `spacetimedb_token_cached` early-return; instead log out previous session and proceed. Show identity on login success. - `logout.rs`: Add identity display, not-logged-in check, 5s timeout for server call with warning on failure. Note: This subsumes the offline fix from #4361. --------- Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com> Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com> Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com> Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #2437
spacetime logoutpreviously required a network connection to the auth server, making it impossible to log out (and thus log in with a different method) when offline.This change makes the server-side session invalidation best-effort: if the auth server is unreachable, a warning is printed but local credentials are still cleared. This allows offline development workflows like
spacetime login --server-issued-login local.