fix(usage): recover missing Codex hub plans from auth metadata - #10878
fix(usage): recover missing Codex hub plans from auth metadata#10878kalvenschraut wants to merge 1 commit into
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrow, well-tested usage-adapter fix that preserves existing behavior when upstream plan metadata is present and recovers only missing Free/Go plan information from existing auth metadata. Its production impact is limited to accurate subscription labels and quota-window presentation. 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 |
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