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
feat: persist auth session to disk across restarts (#5)
* feat: persist auth session to disk across restarts
The GitHub OAuth token was only stored in-memory (AppState.token),
so every app restart required re-authenticating. Now the token is
saved to/loaded from a file in the app data directory.
Changes:
- auth.rs: added save_token_to_disk(), load_token_from_disk(),
delete_token_from_disk() helpers using app data dir
- auth.rs: poll_for_token_cmd and poll_for_token now persist the
token after successful OAuth
- auth.rs: logout_cmd deletes the persisted token
- lib.rs: setup closure loads saved token before checking auth state
* fix: use SHA-256 for Stronghold key derivation (32 bytes)
DefaultHasher only produced 8 bytes. Stronghold expects a 32-byte key.
Switch to sha2::Sha256 for proper key derivation.
* fix: restrict token file permissions + validate on startup
Addresses review feedback:
- P1: Token file now written with mode 0o600 on Unix (owner-only).
Uses platform-specific write_token_file helper (std::fs::write
fallback on Windows).
- P2: On startup, an async task validates the restored token via
GET /user. If the token is confirmed invalid (401/403), it is
cleared from memory and disk, and the tray falls back to sign-in.
Network errors are tolerated (keeps the session for offline use).
* fix: only invalidate token on 401/403, not transient errors
validate_token now returns None (keep token) for 429/5xx responses
instead of Some(false), avoiding false logouts from rate limits or
GitHub outages.
* fix: guard token clear against race with fresh login
Before clearing an invalid token, re-check that it still matches
the one we validated. If the user re-authenticated while the async
validation was in-flight, keep the new token.
* docs: add Codex review comment workflow to AGENTS.md
Documents the requirement that all Codex review comments must be
resolved before merging, and the poll-fix-resolve loop.
* fix: emit auth-cleared event to frontend + poller detects revoked tokens
- lib.rs: emits 'auth-cleared' event when startup validation clears
an invalid token, so the frontend switches to the login screen
- App.svelte: listens for 'auth-cleared' and resets auth state
- poller.rs: on fetch error, validates the token and clears session
if confirmed invalid (401/403), preventing a stuck auth loop
* fix: poller guards token clear with identity check + clears PR caches
- Guards token clear with as_deref() == Some(&token) check, same as
the startup validator, to avoid wiping a fresh login.
- Clears prs and previous_prs caches when invalidating, preventing
stale data and incorrect notifications on re-login.
* fix: add libayatana-appindicator3 as Linux package dependency
- tauri.conf.json: added deb.depends and rpm.depends so the tray
library installs automatically via .deb/.rpm packages
- AGENTS.md: added Linux Prerequisites section with install commands
for Arch/Manjaro, Ubuntu/Debian, and Fedora
* fix: enable Wayland clipboard support on Linux
arboard's wayland-data-control feature is needed for clipboard
access on Wayland compositors (KDE/GNOME/Sway). Falls back to
X11 automatically when Wayland is unavailable.
* fix: register auth-cleared listener before init + only 401 invalidates token
- App.svelte: moved event listener registration before init() to
avoid missing auth-cleared from fast startup validation
- github.rs: validate_token now only returns Some(false) for 401,
not 403 (GitHub uses 403 for rate limits/abuse, not just bad creds)
* fix: await listener registration before init in App.svelte
listen() is async — fire-and-forget .then() still allowed init()
to race ahead. Now both listeners are awaited in a setup() function
before init() runs, closing the event-drop window.
The `.deb` and `.rpm` bundles declare this as a package dependency so it installs automatically when users install through those package formats. Arch/pacman users must install it manually.
0 commit comments