fix(mcp): map HTTP 4xx auth errors to McpError::HttpAuth in OAuth paths#3590
Merged
fix(mcp): map HTTP 4xx auth errors to McpError::HttpAuth in OAuth paths#3590
Conversation
connect_url_oauth and complete_oauth were using map_err(|e| McpError::Connection { .. })
directly, leaving 401/403 responses classified as retryable. Replace both call sites
with classify_connect_error, consistent with the fix applied to connect_url in #3579.
Adds two unit tests verifying that 401 and 403 transport errors in OAuth paths
produce McpError::HttpAuth rather than McpError::Connection.
Closes #3586
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
connect_url_oauthandcomplete_oauthwere constructingMcpError::Connectiondirectly viamap_err, leaving 401/403 HTTP responses classified as retryable errorsclassify_connect_error, consistent with the fix applied toconnect_urlandconnect_url_with_headersin fix(mcp): map HTTP 4xx auth errors to non-retryable McpError::HttpAuth #3587McpError::HttpAuth(non-retryable)Test plan
cargo nextest run -p zeph-mcp— 462 tests passcargo clippy --workspace --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings— cleancargo +nightly fmt --check— cleanconnect_url_oauth_cached_tokens_401_yields_http_auth,complete_oauth_401_yields_http_authCloses #3586