-
Notifications
You must be signed in to change notification settings - Fork 397
fix: correct Codex plan type detection from JWT auth #392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Fix hardcoded 'plus' planType that was returned as default - Read plan type from correct JWT path: https://api.openai.com/auth.chatgpt_plan_type - Add subscription expiry check - override to 'free' if expired - Use getCodexAuthPath() from @automaker/platform instead of manual path - Remove unused imports (os, fs, path) and class properties - Clean up code and add minimal essential logging Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @Shironex, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the Codex usage service to accurately determine a user's plan type and subscription status. It addresses issues with hardcoded plan values, introduces a mechanism to detect and handle expired subscriptions, and improves the overall reliability of plan detection by prioritizing information from the authentication JWT. Additionally, it includes significant code cleanup and logging enhancements for better maintainability. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request is a great improvement. It correctly fixes the hardcoded planType and introduces a more robust way of detecting the plan from the JWT in the auth file, including checking for subscription expiry. The code cleanup, such as removing unused imports and properties and switching to a structured logger, is also very welcome.
I've added a few suggestions to further improve the robustness of the new JWT parsing logic by adding more type checks, and to refactor a function to reduce code duplication, which will make the code easier to maintain in the future.
- Add typeof checks for fallback claim values to prevent runtime errors - Make openaiAuth parsing more robust with proper type validation - Add isNaN check for date parsing to handle invalid dates - Refactor fetchFromAuthFile to reuse getPlanTypeFromAuthFile (DRY) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
planType: 'plus'that was incorrectly returned as default when CLI test succeededclaims['https://api.openai.com/auth'].chatgpt_plan_type'free'if subscription has expiredgetCodexAuthPath()from@automaker/platforminstead of manual path constructionos,fs,path) and unused class propertiesTest plan
🤖 Generated with Claude Code