Skip to content

cleanup(auth): update retry loop #2706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

harkamaljot
Copy link
Collaborator

@harkamaljot harkamaljot commented Jul 16, 2025

What this PR does

  • Modifies the authentication retry loop to consistently wrap and return a non-transient error.

Why this change is needed

  • The previous implementation returned either transient or non-transient errors, forcing the GAX retry policy to have complex, special-case logic to handle them. As auth errors should never be retried from Gax layer.

Important Caveat

  • This PR does not yet implement a default retry policy for the auth layer.
  • As a result, clients without a custom retry policy we add a default retry policy with attempts equal to 1.

@harkamaljot harkamaljot requested a review from a team as a code owner July 16, 2025 21:43
@harkamaljot harkamaljot marked this pull request as draft July 16, 2025 21:43
@coryan
Copy link
Collaborator

coryan commented Jul 16, 2025

We already have this:

pub struct NeverRetry;

@harkamaljot
Copy link
Collaborator Author

We already have this:

pub struct NeverRetry;

Got it, thanks @coryan. In that case, I'm still unclear on the use case for NoRetryPolicy, since my goal is to retry on most errors while avoiding retries on authentication failure.

Is the expectation that our default policy handles this correctly (by not retrying auth errors), and that we should honor any custom policy a customer provides to Gax, even if it retries on everything?

@coryan
Copy link
Collaborator

coryan commented Jul 17, 2025

We already have this:

pub struct NeverRetry;

Got it, thanks @coryan. In that case, I'm still unclear on the use case for NoRetryPolicy, since my goal is to retry on most errors while avoiding retries on authentication failure.

Then you need to change Aip194Strict.

Is the expectation that our default policy handles this correctly (by not retrying auth errors), and that we should honor any custom policy a customer provides to Gax, even if it retries on everything?

Yes.

Copy link

codecov bot commented Jul 17, 2025

Codecov Report

Attention: Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 95.58%. Comparing base (0e5bd3d) to head (bed0e15).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
src/auth/src/retry.rs 91.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2706   +/-   ##
=======================================
  Coverage   95.58%   95.58%           
=======================================
  Files          93       93           
  Lines        4006     4010    +4     
=======================================
+ Hits         3829     3833    +4     
  Misses        177      177           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@harkamaljot harkamaljot changed the title cleanup(gax): Add DontRetryAuthPolicy retry_policy cleanup(auth): update retry loop return value Jul 18, 2025
@harkamaljot harkamaljot changed the title cleanup(auth): update retry loop return value cleanup(auth): update retry loop Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants