Skip to content

fix(claude): recognize OAuth subscription type#836

Closed
shixy96 wants to merge 1 commit intosteipete:mainfrom
shixy96:codex/fix-claude-oauth-subscription-type
Closed

fix(claude): recognize OAuth subscription type#836
shixy96 wants to merge 1 commit intosteipete:mainfrom
shixy96:codex/fix-claude-oauth-subscription-type

Conversation

@shixy96
Copy link
Copy Markdown
Contributor

@shixy96 shixy96 commented May 4, 2026

Summary

  • Fixes Claude Usage Dashboard opens to wrong page #824.
  • Parse and retain subscriptionType from Claude Code OAuth credentials.
  • Prefer subscriptionType over rateLimitTier when deriving the Claude OAuth login method, while keeping rateLimitTier as a fallback.
  • Preserve subscriptionType when refreshed OAuth credentials are written back to CodexBar's cache.
  • Add regression coverage for Pro credentials that report rateLimitTier: "default_claude_ai".

Root Cause

Claude Code can store OAuth credentials for a Pro account with subscriptionType: "pro" while rateLimitTier is set to default_claude_ai, as documented in anthropics/claude-code#38909. CodexBar only used rateLimitTier to infer the plan, so it could not derive Claude Pro; downstream subscription checks then treated the account as unknown and used the generic Claude dashboard URL.

Solution

Use the explicit OAuth subscriptionType as the primary plan signal and fall back to rateLimitTier only when subscriptionType is absent. This avoids a broad "all OAuth means subscription" shortcut and keeps non-subscription OAuth accounts from being misclassified.

Why This Fix

This changes the shared Claude OAuth credential model and plan resolver instead of patching the dashboard action. The dashboard was only the visible symptom; the broken state was that OAuth Pro credentials could not resolve to a subscription plan.

subscriptionType is the stable account-level signal in this credential shape. rateLimitTier can still identify Max, Team, Enterprise, and other known tiers, so CodexBar keeps it as a fallback. The fix does not map bare default_claude_ai to Pro, and it does not treat every OAuth account as a subscription.

The refreshed credential cache now preserves subscriptionType, so the fix survives token refresh instead of working only until the next cache write.

Validation

  • swiftformat Sources Tests
  • swiftlint --strict
  • pnpm check
  • git diff --check
  • swift test --filter 'ClaudePlanResolverTests|ClaudeOAuthTests'
  • swift test --filter OpenAIDashboardNavigationDelegateTests
  • swift test --filter CodexAccountScopedRefreshTests
  • TZ=UTC swift test --filter MistralUsageParserTests
  • ./Scripts/compile_and_run.sh

Prefer Claude OAuth subscriptionType before rateLimitTier so Pro accounts with default_claude_ai are recognized as subscriptions without treating every generic OAuth tier as paid.

Preserve subscriptionType when refreshed credentials are cached and add regression coverage for the Claude Code credential shape observed locally and in upstream reports.
@steipete
Copy link
Copy Markdown
Owner

steipete commented May 4, 2026

Thanks @shixy96, this is fixed on main in 275c195. I landed the same underlying fix with the regression coverage expanded to the actual menu dashboard URL, plus docs/changelog, and preserved co-author credit.

@steipete steipete closed this May 4, 2026
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.

Claude Usage Dashboard opens to wrong page

2 participants