Skip to content

fix: preserve searchInfo in streaming generation responses#243

Merged
lzsweb merged 1 commit into
mainfrom
dev/issues-3-1
Jul 2, 2026
Merged

fix: preserve searchInfo in streaming generation responses#243
lzsweb merged 1 commit into
mainfrom
dev/issues-3-1

Conversation

@lzsweb

@lzsweb lzsweb commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Add searchInfo accumulation logic to mergeSingleResponse() for both choices format and legacy text format. SearchInfo is now stored in AccumulatedData and restored to output across all streaming chunks.

Also bump version to 2.22.24 and add unit tests.

Add searchInfo accumulation logic to mergeSingleResponse() for both
choices format and legacy text format. SearchInfo is now stored in
AccumulatedData and restored to output across all streaming chunks.

Also bump version to 2.22.24 and add unit tests.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request bumps the SDK version to 2.22.24 and introduces support for accumulating and preserving searchInfo at the output level across streaming chunks in both choices and legacy text formats. It also adds a comprehensive suite of unit tests to verify this behavior. A review comment points out a redundant block of code where searchInfo is restored twice on the same output reference, which can be safely removed.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines 497 to +502
output.setChoices(allChoices);
// Restore searchInfo at output level
AccumulatedData firstData = accumulatedData.get(0);
if (firstData != null && firstData.searchInfo != null) {
output.setSearchInfo(firstData.searchInfo);
}

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.

medium

This block is redundant because searchInfo is already restored at the output level on lines 326-330 of mergeSingleResponse(). Since output is a reference to result.getOutput(), any changes made to it are already reflected, and there is no need to restore it again here.

Suggested change
output.setChoices(allChoices);
// Restore searchInfo at output level
AccumulatedData firstData = accumulatedData.get(0);
if (firstData != null && firstData.searchInfo != null) {
output.setSearchInfo(firstData.searchInfo);
}
output.setChoices(allChoices);

@lzsweb lzsweb merged commit 36ac21e into main Jul 2, 2026
3 checks passed
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.

1 participant