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
{{ message }}
Repository navigation
Account: sign-out races left after #3193 (epoch on every attempt, in-flight link redemption, retry backoff) #3198
Follow-up of #3164 and #3193. #3193 (parked as draft) makes a sign-out win over sign-ins still on their way (a sign-out epoch) and keeps unconfirmed revocations to retry. The merge pass's delta review at ead7c40 reproduced the following on adjacent paths. They need one design pass across the client and the account service instead of more fix rounds on #3193.
HIGH: a request made before a sign-out can still run with a later sign-in (src/lib/account/service.ts:498, AccountService.call).
The sign-out epoch is read when call() starts, but compared only before the 401 retry. A request whose first attempt picks up its session after a sign-out and a new sign-in (same account) runs with that new session.
Expected: call() captures the epoch with the session it was made for, and refuses to send under any other epoch, on the first attempt as on the retry.
HIGH: a link redemption already in flight still adds the identity after a local sign-out whose revoke failed (src/lib/account/signin.ts:97, finishSignIn with bearer).
The client checks the epoch before redeeming at /v1/token, but a sign-out that lands while that request is in flight cannot stop it. If the sign-out's revoke then fails (429, 5xx or network), the bearer is still valid at the service, and the link commits.
Expected: the account service binds link redemption to a session that is still valid when it commits (for example, the link token is consumed or refused once that session's family is signed out, or the client's sign-out is acknowledged before redemption). This needs a change in the account service, not only the client.
MEDIUM: the retry list for unconfirmed revocations ignores Retry-After and has no storage bound (ending in src/lib/account/service.ts and store.ts).
Every account screen load and sign-out retries every entry right away, also after a 429 with Retry-After, which spends the account's request limit. The list has no cap or age limit, so refresh tokens can stay in IndexedDB indefinitely when the service stays unreachable.
Expected: back off per entry (honouring Retry-After), and bound the list (drop entries past the refresh token's lifetime, since they no longer redeem) without silently dropping a revocation that could still matter.
Pre-0.5.3 triage: this waits for after the release, together with #3164. Items 1 and 3 are client changes in the sign-out epoch design; item 2 needs a change in the account service (binding link redemption to a session that is still valid when it commits), which is outside the client release anyway.
Fixed by fix(account): a sign-out wins over account requests and sign-ins on their way #4857: AccountService.call() now captures the sign-out generation with its session once and checks both before every send, first attempt and 401 retry alike (src/lib/account/signInGeneration.test.ts: "does not send the first account request after sign-out and same-account sign-in", "drops a delayed 401 instead of returning or retrying it under a later sign-in"; 9 pass, 0 fail).
The account service already commits a link only while the linking session still exists, in the same write as the identity insert, so a sign-out whose revoke reaches the service refuses an in-flight link (reproduced against the in-repo fake: revoke 204 leaves the methods unchanged). What remains is the case where the revoke never reaches the service (429/5xx/network): the service cannot know about that sign-out, and the method added is one the same signed-in person started (single-use link token, 10-minute window, shown in the account's method history). No further service change planned.
Activity
devswha commentedon Nov 11, 2026
Pre-0.5.3 triage: this waits for after the release, together with #3164. Items 1 and 3 are client changes in the sign-out epoch design; item 2 needs a change in the account service (binding link redemption to a session that is still valid when it commits), which is outside the client release anyway.
fix(account): a sign-out wins over account requests and sign-ins on t…
devswha commentedon Nov 28, 2026
Checked against main at df6bd8a.
AccountService.call()now captures the sign-out generation with its session once and checks both before every send, first attempt and 401 retry alike (src/lib/account/signInGeneration.test.ts: "does not send the first account request after sign-out and same-account sign-in", "drops a delayed 401 instead of returning or retrying it under a later sign-in"; 9 pass, 0 fail).Closing; a durable retry of failed revokes would be a new design item.