fix(coderd/externalauth): retry transient refresh failures with backoff (backport #25686 to 2.32)#26162
Merged
f0ssel merged 1 commit intoJun 17, 2026
Conversation
External providers (GitHub in particular) intermittently fail token refreshes with transient errors such as 5xx responses, network timeouts, and rate-limited 429s. A single hiccup currently surfaces as an InvalidTokenError and forces users to re-authenticate. Wrap the TokenSource refresh in an exponential-backoff retry loop bounded by a 10s total budget. Errors classified as permanent by isFailedRefresh (e.g. revoked or rotated refresh tokens) skip the retry loop so a doomed refresh is not repeated, which is especially important for providers with single-use refresh tokens. The retry parameters are exposed on Config so tests can run quickly without depending on global state. (cherry picked from commit dfef6f5)
code-asher
approved these changes
Jun 17, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Backport of #25686 to
release/2.32.Wraps external auth token refresh in an exponential-backoff retry so transient upstream failures no longer surface as
InvalidTokenErrorand force users to re-authenticate.Original PR: #25686 — fix(coderd/externalauth): retry transient refresh failures with backoff
Original commit: dfef6f5
Backport commit: b8a770c912c091180b2b8597dd7861d3e066d57d
Cherry-picked cleanly with
git cherry-pick -x; no conflict resolution was needed.Note
Generated with Codex by @maschwenk