Skip to content

fix(patch): cherry-pick 07056c8 to release/v0.28.0-preview.6-pr-18656 to patch version v0.28.0-preview.6 and create version 0.28.0-preview.7#18672

Merged
skeshive merged 1 commit intorelease/v0.28.0-preview.6-pr-18656from
hotfix/v0.28.0-preview.6/0.28.0-preview.7/preview/cherry-pick-07056c8/pr-18656
Feb 9, 2026
Merged

fix(patch): cherry-pick 07056c8 to release/v0.28.0-preview.6-pr-18656 to patch version v0.28.0-preview.6 and create version 0.28.0-preview.7#18672
skeshive merged 1 commit intorelease/v0.28.0-preview.6-pr-18656from
hotfix/v0.28.0-preview.6/0.28.0-preview.7/preview/cherry-pick-07056c8/pr-18656

Conversation

@gemini-cli-robot
Copy link
Copy Markdown
Collaborator

This PR automatically cherry-picks commit 07056c8 to patch version v0.28.0-preview.6 in the preview release to create version 0.28.0-preview.7.

@gemini-cli-robot gemini-cli-robot requested a review from a team as a code owner February 9, 2026 21:10
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @gemini-cli-robot, 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 enhances the robustness of the API response conversion utility by making it more resilient to incomplete or malformed CaGenerateContentResponse objects. It ensures that the system can gracefully handle scenarios where expected properties are absent, thereby improving overall stability and preventing potential crashes.

Highlights

  • Robust API Response Handling: The fromGenerateContentResponse function now gracefully handles cases where the response property might be missing from the CaGenerateContentResponse object, preventing potential runtime errors and ensuring application stability.
  • Improved Default Behavior: If the response property is absent, the candidates array is explicitly initialized as empty, providing a consistent and safe default output rather than throwing an error.
  • New Test Case for Edge Scenario: A new test has been added to converter.test.ts to specifically verify the correct behavior when the response property is missing, ensuring the fix works as expected and preventing regressions.
Changelog
  • packages/core/src/code_assist/converter.test.ts
    • Added a new test case within describe('fromGenerateContentResponse') to validate the function's behavior when CaGenerateContentResponse is missing its response property.
    • The new test asserts that responseId is correctly populated from traceId and candidates is an empty array when the response property is absent.
  • packages/core/src/code_assist/converter.ts
    • Modified the fromGenerateContentResponse function to check for the presence of res.response.
    • If res.response is undefined, out.candidates is now explicitly set to an empty array, and the function returns early to prevent errors.
    • Reordered the assignment of out.responseId to occur earlier in the function.
    • Updated the assignment of out.candidates to use the nullish coalescing operator (?? []) to ensure candidates is always an array, even if inres.candidates is undefined.
Activity
  • This pull request is an automated cherry-pick of commit 07056c8f16a9340aedcc716a5c247da07c135cf2.
  • The purpose of this cherry-pick is to patch version v0.28.0-preview.6 in the preview release.
  • The successful merge of this PR will result in the creation of version 0.28.0-preview.7.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@skeshive skeshive enabled auto-merge (squash) February 9, 2026 21:11
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a 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 cherry-picks a fix to handle cases where the response property is missing in CaGenerateContentResponse, preventing a potential crash. The change is correct and includes a corresponding test case. I've suggested a small refactoring to make the implementation more concise using modern TypeScript features.

Comment on lines +138 to 147
const inres = res.response;
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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This logic can be simplified by using optional chaining (?.) and removing the explicit if check. This makes the code more concise and easier to read.

Suggested change
const inres = res.response;
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;
const inres = res.response;
out.candidates = inres?.candidates ?? [];
out.automaticFunctionCallingHistory = inres?.automaticFunctionCallingHistory;
out.promptFeedback = inres?.promptFeedback;
out.usageMetadata = inres?.usageMetadata;
out.modelVersion = inres?.modelVersion;

Copy link
Copy Markdown
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 9, 2026

Size Change: +67 B (0%)

Total Size: 23.7 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 23.7 MB +67 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B

compressed-size-action

@skeshive skeshive disabled auto-merge February 9, 2026 21:14
@skeshive skeshive merged commit 39eea4b into release/v0.28.0-preview.6-pr-18656 Feb 9, 2026
23 of 24 checks passed
@skeshive skeshive deleted the hotfix/v0.28.0-preview.6/0.28.0-preview.7/preview/cherry-pick-07056c8/pr-18656 branch February 9, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants