-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Harded code assist converter. #18656
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
|
Hi @jacob314, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
Summary of ChangesHello @jacob314, 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 focuses on improving the resilience and stability of the code assist converter by making its Highlights
Changelog
Activity
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 hardens the fromGenerateContentResponse function in the code assist converter to gracefully handle malformed API responses where the response field might be missing. This is a good improvement that prevents potential runtime errors. A new unit test is also added to verify this behavior. I have one suggestion to further simplify the implementation for better readability and maintainability.
| if (!inres) { | ||
| out.candidates = []; | ||
| return out; | ||
| } | ||
| out.candidates = inres.candidates ?? []; | ||
| out.automaticFunctionCallingHistory = inres.automaticFunctionCallingHistory; | ||
| out.promptFeedback = inres.promptFeedback; | ||
| out.usageMetadata = inres.usageMetadata; | ||
| out.modelVersion = inres.modelVersion; |
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.
While the current implementation is correct, it can be simplified by removing the conditional branch and early return. Using optional chaining (?.) for all property assignments from inres would make the code more concise, readable, and create a single execution path. This reduces complexity and makes the function easier to maintain and less prone to errors in future modifications.
| if (!inres) { | |
| out.candidates = []; | |
| return out; | |
| } | |
| out.candidates = inres.candidates ?? []; | |
| out.automaticFunctionCallingHistory = inres.automaticFunctionCallingHistory; | |
| out.promptFeedback = inres.promptFeedback; | |
| out.usageMetadata = inres.usageMetadata; | |
| out.modelVersion = inres.modelVersion; | |
| out.candidates = inres?.candidates ?? []; | |
| out.automaticFunctionCallingHistory = inres?.automaticFunctionCallingHistory; | |
| out.promptFeedback = inres?.promptFeedback; | |
| out.usageMetadata = inres?.usageMetadata; | |
| out.modelVersion = inres?.modelVersion; |
|
Size Change: +67 B (0%) Total Size: 23.9 MB ℹ️ View Unchanged
|
gundermanc
left a comment
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.
LGTM.
Validated that it works with my repro.
|
/patch stable |
|
✅ Patch workflow(s) dispatched successfully! 📋 Details:
🔗 Track Progress: |
|
/patch preview |
|
✅ Patch workflow(s) dispatched successfully! 📋 Details:
🔗 Track Progress: |
|
🚀 Patch PR Created! 📋 Patch Details:
📝 Next Steps:
🔗 Track Progress: |
|
🚀 Patch PR Created! 📋 Patch Details:
📝 Next Steps:
🔗 Track Progress: |

Summary
Fixes #18621
To Repro, auth with google and verify things work.
We should also rollback on the backend.