Retry failed JWT key refreshes with exponential backoff - #8226
Open
Amaury Chamayou (achamayou) with Copilot wants to merge 3 commits into
Open
Retry failed JWT key refreshes with exponential backoff#8226Amaury Chamayou (achamayou) with Copilot wants to merge 3 commits into
Amaury Chamayou (achamayou) with Copilot wants to merge 3 commits into
Conversation
Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add retry logic for JWT refresh handling errors
Retry failed JWT key refreshes with exponential backoff
Aug 27, 2026
Amaury Chamayou (achamayou)
marked this pull request as ready for review
August 28, 2026 17:17
Copilot started reviewing on behalf of
Amaury Chamayou (achamayou)
August 28, 2026 17:17
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves JWT/JWK auto-refresh robustness in CCF by adding per-issuer retry scheduling with exponential backoff, so transient OpenID/JWKS endpoint failures recover quickly rather than waiting for the (often long) periodic refresh interval.
Changes:
- Add per-issuer retry state and delayed-task scheduling to retry failed refreshes quickly, then exponentially back off up to the configured refresh interval.
- Extend the connection-failure e2e test to verify recovery once the OpenID endpoint becomes available.
- Document the retry behavior in the JWT operator guide and add a changelog entry.
Custom instructions used:
.github/copilot-instructions.md.github/instructions/reviewing.instructions.md.github/instructions/changelog.instructions.md
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/node/jwt_key_auto_refresh.h |
Adds per-issuer retry scheduling with exponential backoff and cancellation on success/issuer removal/role change. |
tests/jwt_test.py |
Extends the connection-failure test to start the issuer after an initial failure and assert refresh recovery. |
doc/build_apps/auth/jwt.rst |
Documents the new retry + exponential backoff behavior. |
CHANGELOG.md |
Records the user-visible behavior change for JWT auto-refresh retries. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
457
to
461
| with reserve_unlistened_local_port() as issuer_port: | ||
| issuer = infra.jwt_issuer.JwtIssuer( | ||
| f"https://{issuer_host}:{issuer_port}", cn=issuer_host | ||
| ) | ||
| add_auto_refresh_jwt_issuer(network, primary, issuer, "jwt_connection_failure") |
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.
JWT key refresh previously waited for the configured periodic interval after failures, which defaults to 30 minutes. Existing outage coverage checked failure metrics but not subsequent recovery.
Changes
Retry scheduling
min(5 seconds, key_refresh_interval).Outage recovery coverage
Documentation