Skip to content

fix(mcp): map HTTP 4xx auth errors to McpError::HttpAuth in OAuth paths#3590

Merged
bug-ops merged 1 commit intomainfrom
3586-mcp-oauth-4xx-auth
May 4, 2026
Merged

fix(mcp): map HTTP 4xx auth errors to McpError::HttpAuth in OAuth paths#3590
bug-ops merged 1 commit intomainfrom
3586-mcp-oauth-4xx-auth

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented May 4, 2026

Summary

  • connect_url_oauth and complete_oauth were constructing McpError::Connection directly via map_err, leaving 401/403 HTTP responses classified as retryable errors
  • Both call sites replaced with classify_connect_error, consistent with the fix applied to connect_url and connect_url_with_headers in fix(mcp): map HTTP 4xx auth errors to non-retryable McpError::HttpAuth #3587
  • Adds two unit tests verifying 401 and 403 transport errors in OAuth paths produce McpError::HttpAuth (non-retryable)

Test plan

  • cargo nextest run -p zeph-mcp — 462 tests pass
  • cargo clippy --workspace --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings — clean
  • cargo +nightly fmt --check — clean
  • New tests: connect_url_oauth_cached_tokens_401_yields_http_auth, complete_oauth_401_yields_http_auth

Closes #3586

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
@github-actions github-actions Bot added rust Rust code changes bug Something isn't working size/S Small PR (11-50 lines) labels May 4, 2026
@bug-ops bug-ops enabled auto-merge (squash) May 4, 2026 18:48
@bug-ops bug-ops merged commit db72797 into main May 4, 2026
32 checks passed
@bug-ops bug-ops deleted the 3586-mcp-oauth-4xx-auth branch May 4, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working rust Rust code changes size/S Small PR (11-50 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(mcp): HTTP 4xx auth errors in connect_url_oauth/complete_oauth remain retryable

1 participant