fix(login): keep the account session when logging in to a Personal Server - #38
Merged
Merged
Conversation
…rver `saveCredentials` rewrites the whole auth file, and the self-hosted branch passed a freshly built account block with an empty token and the server owner's address. Logging in to a Personal Server therefore signed the user out of their account and silently switched the CLI identity to whoever owns that server. `vana login` could not repair the state it diagnosed either: the server URL is resolved only from env and auth.json, so a machine with a detected but unauthenticated server fell through to the cloud branch, reported "Already logged in", and printed the very command it had just refused to act on. That left `connect` failing every sync with MISSING_AUTH and no way out. - carry a live account session across a server login, and say so when the server belongs to a different address - acquire the server session from the already-logged-in path instead of suggesting it, unless --no-input - stop telling the user to log out first when the advice above it is to log in
github-actions Bot
pushed a commit
that referenced
this pull request
Sep 17, 2026
## [0.23.13](v0.23.12...v0.23.13) (2026-09-17) ### Bug Fixes * **login:** keep the account session when logging in to a Personal Server ([#38](#38)) ([a665dc5](a665dc5))
Contributor
|
🎉 This PR is included in version 0.23.13 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
What broke
Two separate faults in
vana login, both hit while chasing whyvana connectreported "Personal Server sync failed / requires authentication".
1. Logging in to a Personal Server signed you out of your account.
saveCredentialsrewrites the whole auth file. The self-hosted branch handedit a freshly built account block:
So
vana login --server <url>silently replaced the CLI identity withwhoever owns that server and destroyed a valid account session. On a machine
where the CLI account and the local server owner differ, that is a real
identity swap with no warning and no confirmation.
2.
vana logincould not fix the state it had just diagnosed.The server URL is resolved only from env vars and
auth.json. Withpersonal_server: nullthe URL is unknown, so the command took the cloudbranch, saw a valid account token, printed
Already logged in, and returned0 having done nothing. It then suggested
vana login --server <url>for a URLit had detected through a different code path, and immediately below that
told the user to run
vana logoutfirst. Everyconnectkept failing withMISSING_AUTHand the two printed remedies contradicted each other.What changed
accountSessionToPreservedecides which account block survives a serverlogin. A live session is carried across; a tokenless or env-sourced one is
not persisted, so a first-time self-hosted user still gets seeded from the
server owner as before.
says so instead of quietly switching.
rather than printing the command back at the user. Gated on
--no-input,and on the server actually being self-hosted, so agents and CI keep the old
reporting behaviour.
logout firstline now reads as what it is: how to signin as someone else.
The self-hosted flow moved into
loginToPersonalServerso both entry pointsshare it. That move is most of the diff; the logic inside is unchanged apart
from the credential merge.
Test plan
pnpm validate(367 tests)accountSessionToPreserveafter the fix. Before:
account_addressbecame the server owner and thetoken was emptied. After: account address and token intact, server
session stored, mismatch reported.
server: plain
vana loginnow completes the server login and writespersonal_server, where it previously exited 0 with nothing saved.--no-inputstill takes the reporting path