Repository navigation
fix(llminternal): backport streaming aggregator and response fixes (#2071, #1249, #2070, #2190, #2301, #2310, #2308) - #2350
Merged
Conversation
wojtas000
approved these changes
Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Seven defects in the streaming response path are present on 1.x.
UsageMetadatawipes the usage an earlier chunk reported, so the final response carried no token counts (seen with Vertex AI grounding streams).ModelVersion, although every chunk and every non-streamed response reports it.setupComplete, and the session kept it.IncludeContents: noneagent could anchor its turn on that empty event and lose the user's input.Summary
Backports #2071, #1249, #2070, #2190, #2301, #2310 and #2308, one commit each, in the order they landed on main.
StreamingResponseAggregatordoes.UsageMetadata(the guard itself is already on 1.x).ModelVersionfrom the last chunk onto the aggregated response.postprocess_live_flow. The resumption handle is still recorded before the check.IncludeContents: noneturn start skip empty events.User-visible behavior changes:
Adaptations for 1.x:
#2301: 1.x'sLiveConnection.Recvdoes not populateUsageMetadatauntil#2215lands (in the live-config backport PR), so the wire-level "usage metadata" row moves fromTestRunLiveSkipsEmptyResponsestoTestIsEmptyLiveResponse, which checks the same branch directly.#2310:isEmptyEventomits the 2.x-onlycompactioninternal.HasUsableSummaryarm, and the test builds its run config throughInvocationContextParams.RunConfigsince 1.x has norunconfigpackage.#2308: the lazy event-ID reuse is integrated into 1.x's inline span handling ingenerateContent, which main had already extracted intotelemetry.InstrumentGenerateContent.agent.CallbackContext.