Improve login/logout CLI UX#4367
Merged
clockwork-labs-bot merged 20 commits intomasterfrom Mar 6, 2026
Merged
Conversation
login: - If already logged in, automatically log out of the previous session and proceed with a fresh login (instead of refusing with 'already logged in') - Print the identity on successful login - Show which identity was logged out when re-logging in logout: - Print confirmation message with identity on logout - Print 'You are not logged in.' if already logged out (instead of silently doing nothing) - Best-effort server-side session invalidation with 5s timeout (does not fail if offline, but prints a warning)
…nto bot/login-logout-ux
bfops
reviewed
Feb 24, 2026
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
bfops
reviewed
Feb 24, 2026
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
…om:clockworklabs/SpacetimeDB into bot/login-logout-ux
cloutiertyler
approved these changes
Mar 5, 2026
Contributor
cloutiertyler
left a comment
There was a problem hiding this comment.
Spoke with Zeke on a call
clockwork-labs-bot
added a commit
that referenced
this pull request
Mar 6, 2026
PR #4367 (login/logout UX overhaul) accidentally removed the early return after saving a token via `spacetime login --token`. This caused the command to fall through into the web login flow, which fails when no browser/server is available. This breaks all Private repo smoketests that use `spacetime login --token` (replication tests, teams tests — 9 failures total).
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 7, 2026
## Bug PR #4367 (login/logout UX overhaul) accidentally removed the early `return Ok(())` after saving a token via `spacetime login --token`. This caused the command to fall through into the web login flow (`spacetimedb_login_and_save`), which fails when no browser or server is available. ## Impact All tests that use `spacetime login --token` are broken: - 4 replication tests (`test_enable_disable_replication`, `test_enable_replication_on_suspended_database`, `test_enable_replication_fails_if_not_suspended`, `test_prefer_leader`) - 5 teams tests (`test_permissions_clear_org`, `test_permissions_delete_org`, `test_org_permissions_mut_sql_org_members`, `test_org_permissions_private_tables`, `test_permissions_publish_org_members`) ## Fix One line: restore `return Ok(())` after the `--token` branch. --------- 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.
Summary
Improves the
spacetime loginandspacetime logoutUX to behave more like standard CLI tools.spacetime loginBefore: If already logged in, prints "You are already logged in" and exits. User must manually run
logoutfirst.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 logoutBefore: No output on success. Hard failure if offline.
After:
Logged out (identity 0xabc...).You are not logged in.if already logged outChanges
login.rs: Removespacetimedb_token_cachedearly-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.