fix(sessions): preserve original Event.id from raw_event in VertexAiSessionService (v1) - #6545
Open
chelsealong wants to merge 1 commit into
Open
fix(sessions): preserve original Event.id from raw_event in VertexAiSessionService (v1)#6545chelsealong wants to merge 1 commit into
chelsealong wants to merge 1 commit into
Conversation
…essionService _from_api_event overwrote the ADK event id with the Vertex resource name, so the same logical event reported a different id depending on whether it was seen via streaming or via a reload. Fall back to the resource name only when raw_event carries no id, which keeps older data working. Port of google#6531 to the v1 line, requested by @ashubham on that PR.
6 tasks
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.
Ports #6531 to the
v1line, as requested by @ashubham there ("The fix works, can we please port to 1.x as well").Problem
_from_api_eventoverwrote the ADKEvent.idwith the last segment of the Vertex event resource name, so the same logical event reported a different id depending on how it was observed — one value while streaming, another after a reload. Anything keyed onEvent.idacross a reload boundary saw them as two distinct events.Fix
Stop clobbering
idin theevent_dict.update({...})call and fall back to the resource name only whenraw_eventcarries no id:Older data without a
raw_eventid keeps the previous behaviour.Evidence
Identical source change to #6531 (verified with a diff of both patches). Added the same regression test,
test_get_session_preserves_original_event_id_from_raw_event, which puts a distinct id inraw_eventand assertsget_sessionreturns it rather than the resource name.Branch is cut from current
upstream/v1.Prepared with the help of Claude Code (Anthropic's AI coding assistant); I reviewed the diff and the test output before pushing.