fix: extract interaction_id from SSE events for Interactions API chaining#5208
Open
enjoykumawat wants to merge 1 commit intogoogle:mainfrom
Open
fix: extract interaction_id from SSE events for Interactions API chaining#5208enjoykumawat wants to merge 1 commit intogoogle:mainfrom
enjoykumawat wants to merge 1 commit intogoogle:mainfrom
Conversation
…ning SSE streaming events carry the interaction ID in different attributes than the non-streaming Interaction response: - InteractionStartEvent/CompleteEvent: event.interaction.id - InteractionStatusUpdate: event.interaction_id The code only checked event.id which doesn't exist on SSE event types, so current_interaction_id was never set during streaming. This caused _find_previous_interaction_id() to fail, breaking function calling with StreamingMode.SSE + Interactions API. Fixes google#5169
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.
Summary
StreamingMode.SSE+ Interactions APIevent.interaction.id(start/complete events) orevent.interaction_id(status_update), notevent.idas the code assumedRoot Cause
call_interactions_api()checkedevent.idto extract the interaction ID during SSE streaming, but SSE event types (InteractionStartEvent,InteractionStatusUpdate,ContentDelta, etc.) don't have a top-levelidattribute:id?interaction_id?interaction.id?ContentDeltaContentStopInteractionStatusUpdateInteractionStartEventInteractionCompleteEventAs a result,
current_interaction_idwas never set, all session events hadinteraction_id=None, and_find_previous_interaction_id()could not chain interactions — causing a 400 error on the second LLM call.Test Plan
event.interaction.idevent.interaction_idFixes #5169