android: l'app restava bloccata sullo splash con un refresh token scaduto #5

Merged
claudia merged 1 commit from fix/refresh-deadlock into main 2026-09-28 16:34:09 +00:00
Owner

Il bug

Con un refresh token non più valido (scaduto, o jwt_secret del bridge cambiato) l'app restava per sempre su "Pronto." invece di andare al login.

/auth/me → 401 → il refreshInterceptor chiama /auth/refresh, che passa dallo stesso interceptor: 401 → nuovo refresh → … Ogni livello blocca un thread OkHttp in runBlocking sul successivo; dopo 5 richieste allo stesso host (limite del dispatcher) la sesta resta in coda per sempre. Nel logcat: 1 me + 4 refresh, poi silenzio.

Il fix

Un 401 su /auth/refresh viene restituito così com'è: il chiamante cancella i token, /me torna 401 e lo splash porta al login.

Verifica

Sull'emulatore con il vecchio token: me 401 → refresh 401 → me 401 → schermata di login.

🤖 Generated with Claude Code

## Il bug Con un refresh token non più valido (scaduto, o `jwt_secret` del bridge cambiato) l'app restava per sempre su **"Pronto."** invece di andare al login. `/auth/me` → 401 → il `refreshInterceptor` chiama `/auth/refresh`, che passa **dallo stesso interceptor**: 401 → nuovo refresh → … Ogni livello blocca un thread OkHttp in `runBlocking` sul successivo; dopo 5 richieste allo stesso host (limite del dispatcher) la sesta resta in coda per sempre. Nel logcat: 1 `me` + 4 `refresh`, poi silenzio. ## Il fix Un 401 su `/auth/refresh` viene restituito così com'è: il chiamante cancella i token, `/me` torna 401 e lo splash porta al login. ## Verifica Sull'emulatore con il vecchio token: `me 401 → refresh 401 → me 401` → schermata di login. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
With a dead refresh token (expired, or a new jwt_secret on the bridge)
the /auth/refresh call went through the same refreshInterceptor, got a
401 and tried to refresh again. Each level blocked an OkHttp thread in
runBlocking on the next one; after five requests to the same host the
dispatcher queued the sixth forever and the app hung on the splash
("Pronto.") instead of falling back to the login screen.

Return a 401 from /auth/refresh untouched: the caller clears the tokens
and the splash routes to login.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claudia deleted branch fix/refresh-deadlock 2026-09-28 16:34:09 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Soltea-org/skynet-ha!5
No description provided.