Skip to content

fix: surface Anthropic OAuth rate limits#1958

Merged
guillaumegay13 merged 2 commits into
mnfst:mainfrom
guillaumegay13:fix/anthropic-oauth-rate-limit
May 26, 2026
Merged

fix: surface Anthropic OAuth rate limits#1958
guillaumegay13 merged 2 commits into
mnfst:mainfrom
guillaumegay13:fix/anthropic-oauth-rate-limit

Conversation

@guillaumegay13

@guillaumegay13 guillaumegay13 commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Preserve Anthropic OAuth token-exchange rate-limit failures as HTTP 429 instead of collapsing them to a generic bad-request error.
  • Surface the backend exchange error message in the Anthropic subscription UI so users see the rate-limit retry guidance.
  • Add focused backend and frontend regression coverage.

Validation

  • npm run build --workspace=packages/shared
  • npm test --workspace=packages/backend -- src/routing/oauth/anthropic/anthropic-oauth.service.spec.ts src/routing/oauth/anthropic/anthropic-oauth.controller.spec.ts
  • npm test --workspace=packages/frontend -- AnthropicOAuthDetailView.test.tsx
  • git diff --check

Notes

Split out of #1950 so the MPS refactor stays focused on model parameter schema and scoped saved values.


Summary by cubic

Preserves Anthropic OAuth token-exchange rate limits as HTTP 429 and surfaces the provider’s guidance in the UI. This helps users retry correctly instead of seeing a generic expired-code error.

  • Bug Fixes
    • Map both HTTP 429 and provider rate_limit_error bodies to 429 via AnthropicOauthExchangeError.
    • Controller forwards the service error status instead of collapsing to 400.
    • UI shows the backend error message in AnthropicOAuthDetailView, and falls back to a generic message for non-Error failures.
    • Added tests for 429 handling, message rendering, and the non-Error fallback path.

Written for commit a764018. Summary will update on new commits. Review in cubic

@codecov

codecov Bot commented May 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.25%. Comparing base (5a35436) to head (a764018).
⚠️ Report is 23 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1958      +/-   ##
==========================================
- Coverage   99.31%   99.25%   -0.07%     
==========================================
  Files         170      169       -1     
  Lines       14903    15337     +434     
  Branches     5820     5993     +173     
==========================================
+ Hits        14801    15222     +421     
- Misses        101      113      +12     
- Partials        1        2       +1     
Flag Coverage Δ
frontend 99.26% <100.00%> (-0.05%) ⬇️
shared 98.75% <ø> (-1.25%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@guillaumegay13 guillaumegay13 marked this pull request as ready for review May 21, 2026 09:12

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

Re-trigger cubic

@codecov

codecov Bot commented May 21, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 11.9kB (0.61%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
manifest-frontend-esm 1.96MB 11.9kB (0.61%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: manifest-frontend-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-*.css 3.45kB 187.79kB 1.87%
assets/Routing-*.js 8.24kB 117.82kB 7.52% ⚠️
assets/ProviderSelectModal-*.js 32 bytes 111.93kB 0.03%
assets/index-*.js 47 bytes 56.73kB 0.08%
assets/Overview-*.js -3 bytes 32.81kB -0.01%
assets/overview-*.js -1.66kB 25.37kB -6.14%
assets/MessageLog-*.js 2 bytes 10.47kB 0.02%
assets/Select-*.js (New) 3.68kB 3.68kB 100.0% 🚀
assets/api-*.js 41 bytes 3.48kB 1.19%
assets/AuthBadge-*.js (Deleted) -1.93kB 0 bytes -100.0% 🗑️

Files in assets/ProviderSelectModal-*.js:

  • ./src/components/AnthropicOAuthDetailView.tsx → Total Size: 13.22kB

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.

1 participant