Repository navigation
fix(ui): first sign-in after a session expiry no longer bounces back to the login screen - #150
pyramation wants to merge 4 commits into
Conversation
…to the login screen
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Review complete. 🟡 1 medium 💬 Inline comments (1)
This PR threads a
Reviewed commit: b9fb8e9 |
There was a problem hiding this comment.
Adds a per-login token to the UI's connection state so stale diagnosis verdicts can be distinguished across logins; one medium-severity race remains within a single token's reconnect cycles.
Key findings
- 🟡 Stale
diagnoseConnectionverdicts clobber newer close states — use-socket.ts:76
…es a newer verdict
…n-twice # Conflicts: # packages/settings/src/sessions.ts
Summary
Operators reported: after being kicked to the login screen, the first correct login "doesn't work", the second one does. UI-only; the 30-day session TTL landed separately in #151.
Bounce-back bug. After a session expires,
useSocketleavesconnection = { state: 'down', cause: 'sessionExpired' }. On login the token changes, and theapp.tsxeffectre-runs with the new token but the old verdict, so it signs the operator straight out again. Fix:
ConnectionInfocarries thetokenthedownverdict was reached with (set inuse-socket.ts), and the effect only acts whenconnection.token === token.Stale diagnosis race (review finding). Each
ws.onclosefires an asyncdiagnoseConnection; a slow verdict from a superseded socket could overwrite a newer one (e.g. mask a 4001sessionExpired).connect()now bumps agenerationand the verdict is dropped unlessgen === generation.Deploy: UI-only rebuild, no server restart, no receiver change.
Link to Devin session: https://app.devin.ai/sessions/c4872c2982734093bdee80d04a7d5ceb
Open in Devin Desktop: https://app.devin.ai/desktop/session/c4872c2982734093bdee80d04a7d5ceb?variant=devin
Requested by: @pyramation