fix(claude): recognize OAuth subscription type#836
Closed
shixy96 wants to merge 1 commit intosteipete:mainfrom
Closed
fix(claude): recognize OAuth subscription type#836shixy96 wants to merge 1 commit intosteipete:mainfrom
shixy96 wants to merge 1 commit intosteipete:mainfrom
Conversation
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.
Owner
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
subscriptionTypefrom Claude Code OAuth credentials.subscriptionTypeoverrateLimitTierwhen deriving the Claude OAuth login method, while keepingrateLimitTieras a fallback.subscriptionTypewhen refreshed OAuth credentials are written back to CodexBar's cache.rateLimitTier: "default_claude_ai".Root Cause
Claude Code can store OAuth credentials for a Pro account with
subscriptionType: "pro"whilerateLimitTieris set todefault_claude_ai, as documented in anthropics/claude-code#38909. CodexBar only usedrateLimitTierto infer the plan, so it could not deriveClaude Pro; downstream subscription checks then treated the account as unknown and used the generic Claude dashboard URL.Solution
Use the explicit OAuth
subscriptionTypeas the primary plan signal and fall back torateLimitTieronly whensubscriptionTypeis 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.
subscriptionTypeis the stable account-level signal in this credential shape.rateLimitTiercan still identify Max, Team, Enterprise, and other known tiers, so CodexBar keeps it as a fallback. The fix does not map baredefault_claude_aito 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 Testsswiftlint --strictpnpm checkgit diff --checkswift test --filter 'ClaudePlanResolverTests|ClaudeOAuthTests'swift test --filter OpenAIDashboardNavigationDelegateTestsswift test --filter CodexAccountScopedRefreshTestsTZ=UTC swift test --filter MistralUsageParserTests./Scripts/compile_and_run.sh