fix(auth): `auth logout` removes the saved Altimate gateway key
Problem
altimate-code auth logout → "altimate-backend" removed only the auth.json entry. Browser sign-in also saves the gateway key to ~/.altimate/altimate.json, and the provider loader and all workspace calls (api-client, state, identity, memory/skill sync, link, datamate) read that file first. After sign-out the key stayed on disk and still worked, so delegated runs (e.g. /altimate-code:altimate from Claude Code) kept sending requests as the signed-out user. On a shared machine, the next person's runs go out under the previous user's identity.
Fix
-
AltimateApi.signOut(projectDir): removes MCP entries in the global and project config whoseAuthorizationheader is exactlyBearer <saved key>(standalonedatamate addwrites the key there), then deletes~/.altimate/altimate.json. CLI logout and TUI/logoutboth call it and list what they removed. Entries in other projects' config files aren't reachable; the follow-up is to stop saving the key in MCP headers. -
providers.ts: logging out ofaltimate-backendcallssignOut(viacliTry; on failure it names the file to delete manually instead of reporting "Logout successful"). -
providers.ts: the logout picker listsaltimate-backendwhen onlyaltimate.jsonexists (credentials pasted in the TUI dialog). Before, the CLI reported "No credentials found" and gave no way to sign out. -
provider-credentials.tsx: TUI/logoutalso removes theauth.jsonentry (withthrowOnError, so a failure shows an error toast). A pastedurl::instance::keythere would otherwise keep the provider loader's fallback path working.
After sign-out, workspace calls hit NotConfiguredError ("Altimate credentials not configured — sign in first.").
Not in scope
The key is only removed locally; it is not revoked on the server. Revoking it at sign-out needs a backend endpoint.
Testing
- New CLI tests in
test/cli/providers-logout.test.tscover browser sign-in (both stores), file-only credentials, and MCP entry removal (an unrelated entry is kept). It fails onmain(altimate.jsonstill present) and passes with this change. bun test test/cli test/upstream/fork-feature-guards.test.ts: 1187 pass. 4 failures intest/cli/run/{json-output,budget-finalization}.test.tsalso fail onmainand are unrelated.
🤖 Generated with Claude Code
Summary by CodeRabbit
- Bug Fixes
- Logging out of the Altimate backend removes saved credentials from both Altimate settings and the shared authentication store, while preserving credentials for other providers.
- Logout removes remote MCP servers with a matching authorization key from global and current-project configurations. Other project configurations remain unchanged.
- Command-line and interface logout report which entries were removed. If the saved key cannot be read, logout fails without deleting credentials.
- Documentation
- Added instructions for signing out of the Altimate LLM Gateway, including which configurations are affected and when sessions may need to be restarted.