Repository navigation
feat(gateway): probe the SSO session so a dead refresh token logs out - #342
Closed
quickbeard wants to merge 1 commit into
Closed
quickbeard wants to merge 1 commit into
quickbeard wants to merge 1 commit into
Conversation
loadAccount stayed optimistic about a refresh token the wrapper had already rejected — the avatar showed a session no silent refresh could revive. getAccount now probes the token endpoint when the access token has expired: only a definite rejection (400/401/403) hides the avatar, a network failure or server error proves nothing, and the verdict is cached for a minute since getAccount refetches on every state event. A live probe persists the refreshed (possibly rotated) tokens, so later calls short-circuit on the unexpired access token. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BcADw33oD8qs5jvn5NWMJx
quickbeard
force-pushed
the
feat/account-probe
branch
from
August 28, 2026 06:35
e5d8cf4 to
26ded97
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #341. The sidebar avatar showed a signed-in identity even when the SSO wrapper had already rejected the session's refresh token — a state unknowable from disk alone.
getAccountnow verifies it with a bounded network probe.@codev/gatewaygainsprobeSession(): an unexpired access token is"live"with no network call; no refresh token is"dead"; otherwise it hits${SSO_URL}/tokenwith the refresh grant — a definite rejection (400/401/403) is"dead", a network failure or 5xx is"unknown", and a successful refresh persists the (possibly rotated) tokens before returning"live". The userinfo round-trip honors the injectedfetchImpl; the stale user block stands in if it fails.getAccount()probes only when the access token has expired, capped at 2.5s (timeout counts as"unknown"), and only"dead"hides the avatar — an unreachable IdP never logs anyone out visually (same rule asensureKey). The verdict is cached for 60s sincegetAccountrefires on every state event; a live probe self-heals by persisting tokens, so later calls short-circuit on disk.AccountNavalready renders whatevergetAccountresolves.Testing
bun typecheckclean incodev-gateway,desktop,app.bun test: gateway 65 pass (newprobeSessionsuite: live short-circuit, dead-on-rejection, unknown-on-network/5xx, rotation persistence), desktop 20 pass (newgetAccountpolicy suite: probe skipped on live token, dead hides, unknown optimistic + cached, no probe without identity).Stacked on #341 (
feat/sidebar-account).🤖 Generated with Claude Code
https://claude.ai/code/session_01BcADw33oD8qs5jvn5NWMJx