fix(auth): distinguish rejected refresh tokens from transient failures#963
Merged
DaleSeo merged 2 commits intoJul 17, 2026
Conversation
DaleSeo
reviewed
Jul 7, 2026
DaleSeo
left a comment
Member
There was a problem hiding this comment.
Thanks for the contribution, @stevenlee-oai. I have a quick comment and we should address the linting errors to merge this.
Member
There was a problem hiding this comment.
Can we update this public doc about the new error?
Member
|
@stevenlee-oai The linting errors will be gone once you rebase! |
Contributor
|
@stevenlee-oai do you mind rebasing this and addressing #963 (comment)? Then we can get the change in. Thanks! |
alexhancock
self-requested a review
July 16, 2026 20:03
alexhancock
previously approved these changes
Jul 16, 2026
alexhancock
left a comment
Contributor
There was a problem hiding this comment.
Just needs a rebase to fix linting and we can merge
stevenlee-oai
force-pushed
the
dev/stevenlee/oauth-typed-refresh-rejection
branch
from
July 17, 2026 01:55
b9a14e0 to
88cfc78
Compare
DaleSeo
approved these changes
Jul 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 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
AuthError::TokenRefreshFailed(String)currently combines definitive OAuth refresh-token rejection with transient request, parse, and provider failures.try_refresh_or_reauth()then maps the whole variant toAuthorizationRequired, so a temporary provider failure can incorrectly prompt users to sign in again.This change:
TokenRefreshRejectedfor OAuthinvalid_grant;AuthorizationRequiredandTokenRefreshRejectedto reauthorization;temporarily_unavailable, transport, parse, and other failures as retryableTokenRefreshFailed;AuthorizationRequireddirectly when no refresh token exists.Tests
cargo test -p rmcp --all-features invalid_grant_refresh_requires_reauthorizationcargo test -p rmcp --all-features temporary_refresh_failure_does_not_require_reauthorizationcargo test -p rmcp --all-features refresh_token_returns_error_when_no_refresh_tokencargo clippy -p rmcp --all-features --lib --testsThe three focused tests pass. Clippy passes with two pre-existing
sse_stream::from_byte_streamdeprecation warnings.