Skip to content

fix(ui): recover from a dead session instead of stranding the operator - #93

Merged
pyramation merged 1 commit into
mainfrom
feat/session-expiry-recovery
Aug 9, 2026
Merged

fix(ui): recover from a dead session instead of stranding the operator#93
pyramation merged 1 commit into
mainfrom
feat/session-expiry-recovery

Conversation

@pyramation

Copy link
Copy Markdown
Contributor

Summary

#92 made the red dot say "Your session expired or was revoked — sign in again", but there was nothing to sign in with: the header still showed the username, useSocket kept reconnecting with the same dead token, and every retry re-diagnosed the same 401. A dead-end.

Sessions are stored per project, so this is easy to hit now that switching the project in use restarts the brain — the token was minted against the previous project's session list.

A sessionExpired diagnosis (which only fires when /api/config is healthy and /api/me 401s, so the server is definitively rejecting this token) now clears it:

// app.tsx
useEffect(() => {
  if (token && connection.state === 'down' && connection.cause === 'sessionExpired') {
    sessionEnded();  // drop the token → `!user` → <LoginScreen/>
  }
}, [token, connection.state, connection.cause, sessionEnded]);

useAuth grows sessionEnded() (a logout that records why) and remembers the last username in wg_last_user, so the login screen returns with a reason and one field left to fill:

Your session ended — it expired, was revoked, or the show switched project.

rejected deliberately does not sign out: /api/me passed there, so the token is fine and signing out would lose a good session over a server-side problem.

Link to Devin session: https://app.devin.ai/sessions/972698f89f494b86828010666a002b8f
Requested by: @pyramation

A token the server no longer accepts (expired, revoked, or issued for a
project the show is no longer running) left the artist UI retrying forever
behind a red dot with no way out — the diagnosis said "sign in again" but
there was nothing to sign in with.

The dead token is now dropped and the login screen comes back, saying why
it appeared and prefilling the username that was last signed in here.
@pyramation pyramation self-assigned this Aug 9, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@pyramation
pyramation merged commit 8203273 into main Aug 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant