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
Stuck session when GitHub token renewal is temporarily unavailable: no way to sign out, refresh retried on every request #3879
When a signed-in user's GitHub token has expired and renewal fails with a temporary error, the API answers every request with 503 GITHUB_TOKEN_REFRESH_UNAVAILABLE (packages/api/auth.ts, ensureAuthenticated; also the socket path and routes/githubRoutes.ts). The UI has no handling for this code. The dashboard loads with errors, the layout never gets a user, and there is no logout button or any other way out. The user is stuck until the session is deleted on the server.
Seen live on a Fly instance (device sign-in from #3868, relay answering 404 before integry/propr-routing#341 was deployed). The instance log showed GitHub user grant refresh failed with HTTP 404twice per request, dozens per minute, because every API call retries the refresh immediately.
Wanted
The session is never cleared automatically on a temporary failure. A fluke (relay restart, GitHub blip, network) must not log anyone out. Keep the current classification: only reauth-required clears the session.
The UI recognises GITHUB_TOKEN_REFRESH_UNAVAILABLE (HTTP 503 and the socket error) and shows a clear, non-blocking state instead of broken pages. For example, a banner or a full-page notice: "GitHub sign-in can't be renewed right now." It offers:
Retry, which re-checks /api/auth/user;
Sign out, which calls /api/auth/logout and then goes to the login page. The user can then sign in again, with a device code or OAuth.
It may retry by itself in the background with backoff, and it clears when a request succeeds.
Logout always works./api/auth/logout (and the UI's logout control) must work whatever the token state, including when the user can't be loaded. Make sure the sign-out control can be reached in this state on desktop and mobile layouts (Layout.tsx, MobileProfileRow.tsx).
Backoff on the server. After a temporary refresh failure for a session or grant, don't call the refresh endpoint again on every request. Remember a short retry-after, for example 30s growing to 5 min, and answer 503 from memory until then. Concurrent requests share one in-flight refresh. The github_user_grants.renewal_retry_after_ms column may already fit this.
Tests:
an API test showing that a temporary failure keeps the session and that refresh calls are throttled;
a UI test showing that a 503 with this code renders the notice with working Retry and Sign out controls;
a test showing that logout succeeds with an expired, unrenewable token.
Out of scope
Classification of which failures need a new sign-in (#3868 handles device sign-ins). Relay-side changes.
Activity
propr-dev commentedon Nov 29, 2026
🤖 AI processing has started for this issue using codex agent with gpt-6.2-sol model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
codexgpt-6.2-sol3879/gpt-6.2-sol-stuck-session-when-github-20261129-0014-j5q3758-epic-runtime-abstraction-sc0issue-3879-20261129-0014-gpt-6.2-sol-j5q🔍 Track Task Execution
chore: keep session on GitHub renewal outage with retry and sign-out
chore: show device sign-in expiry on every request, tab and socket
[3867 by Claude Opus 5.5] Dashboard sign-in via GitHub device flow fo…
integry commentedon Dec 1, 2026
Done in #3880, which merged into the runtime epic; the epic merged into
mainwith #3774 and ships in 0.9.4.