You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: auth credential storage and transient error handling (#81)
* fix: make credential and config stores keychain-primary with file fallback
Both stores now follow the same pattern: write to system keychain first,
only write to file when keychain is unavailable, never proactively delete
existing file backups.
config-store: removed deleteFile() calls from saveConfig() and getConfig()
migration path that caused environment configs to vanish after addon
rebuilds or keychain access failures.
credential-store: stopped always writing to file alongside keychain.
File is now only written as fallback when keychain write fails.
* feat: add cross-process file locking for token refresh
Prevents race condition where two concurrent CLI processes both attempt
to refresh the same token, causing one to get invalid_grant when the
server rotates the refresh token.
New file-lock utility uses atomic file creation (O_EXCL) with stale
lock detection (30s timeout). New refreshAccessTokenSafe() wraps the
existing refresh with lock-acquire-then-recheck pattern: after acquiring
the lock, re-reads credentials in case another process already refreshed.
Falls back to unlocked refresh if lock acquisition fails (degraded but
functional). All callers (ensure-auth, background-refresh, credential-proxy)
now use the safe variant.
* Revert "feat: add cross-process file locking for token refresh"
This reverts commit 98095ab.
* fix: don't clear credentials on transient refresh errors
Only clear credentials on invalid_grant (refresh token permanently dead).
Network and server errors are transient — preserve credentials so the
user can retry without being forced to re-login.
Previously, any refresh failure wiped the keychain, destroying a
potentially valid refresh token over a temporary server hiccup.
* fix: eliminate redundant keyring reads and migration retries
- ensure-auth: collapse hasCredentials() + getCredentials() two-step
into single getCredentials() call, eliminating double keyring read
and fixing semantic mismatch (hasCredentials returns true for corrupt
files, getCredentials returns null)
- credential-store/config-store: add migrationAttempted flag to prevent
repeated failed keyring writes on every read when keyring is
unavailable (e.g., headless Linux with no keyring daemon)
* fix: move session refresh message to debug log
The "(Session refreshed)" message is implementation detail noise for
users. Moved to debug log, keeping only "Already logged in as ..."
in user-facing output.
0 commit comments