Repository navigation
fix(usage): recover missing Codex hub plans from auth metadata - #10878
kalvenschraut wants to merge 1 commit into
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused usage bug fix that adds a backward-compatible metadata fallback and verifies both current and legacy Codex plan fields. Existing upstream plan data remains unchanged, while missing-plan accounts now receive the correct label and monthly quota classification. Notes:
You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughCodex plan resolution now falls back to token metadata when upstream usage responses omit plan information. Tests cover current and legacy plan fields for Free and Go accounts. ChangesCodex plan resolution
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Codex usage now recovers missing plan metadata from current and legacy token fields, preserving correct account labels and monthly quota windows for Free and Go plans. No current merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Dismissing prior approval to re-evaluate 836db7a
|
Note Written by Hi! We are cleaning up open PRs, and this one appears to have been created with an older model ( |
|
Note Written by Reopening, this was closed by mistake. Sorry for the noise! |
|
Taking over this one. I’ll reduce the tests to the useful coverage, update the implementation against current main, and verify it before publishing the changes. |
|
Thanks, @RTVision, for identifying the missing account-plan fallback and contributing the fix. The maintainer takeover is now published as #21413. GitHub rejected the push to this fork with HTTP 403 ( I compared the original intent with the full replacement diff: it preserves usage-response → current token → legacy token plan precedence and feeds the resolved value to both the label and quota conversion. The original commits remain in the ancestry, and the replacement points to the exact reviewed commit, with no new source changes or rebase. The test was reduced to one three-account precedence regression; 39 focused tests and two independent reviews passed. Verification is mocked-HTTP service output, not a live hub or browser run. Closing this PR in favor of #21413; the replacement remains open and unmerged. |
What changed
When CLIProxyAPI's usage response omits
plan_type, T3 can lose the account's plan label and classify a Free or Go quota window as a session window even though the auth-file metadata contains the plan.Resolve the plan once from the usage response, then
id_token.plan_type, then the legacyid_token.chatgpt_plan_type. Use that value for both the label and quota conversion. The current CLIProxyAPI management handler emitsplan_type.UI
Synthetic browser fixture generated from the baseline and patched adapters. The usage response omits the plan and window duration; auth metadata contains
plan_type: "free". The quota is now classified as Monthly.Verification
Implemented with GPT-6 in Codex; reviewed with claude-fable-5-1 through Claude Code.
Summary by CodeRabbit