Fix: Deep-copy session for single_turn and explicitly set branch on injected user events (issue #5686)#5768
Closed
9chait9 wants to merge 1 commit into
Closed
Fix: Deep-copy session for single_turn and explicitly set branch on injected user events (issue #5686)#57689chait9 wants to merge 1 commit into
9chait9 wants to merge 1 commit into
Conversation
…njected user events to correctly scope node_input in sequential ctx.run_node calls (issue google#5686)
Collaborator
|
Response from ADK Triaging Agent Hello @9chait9, thank you for submitting this PR to fix #5686! To help our reviewers process this change more efficiently, please ensure the following sections from our contribution guidelines are addressed:
Thank you for your valuable contribution! |
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.
Fixes #5686
This PR addresses an issue where sequential calls to
ctx.run_node()withsingle_turnagents fail to receive theirnode_input. The fix involves:prepare_llm_agent_context, the session copy is changed from shallow to deep, and thesession.eventslist is explicitly cleared forsingle_turnagents. This ensures eachsingle_turnagent starts with an isolated and clean event history.prepare_llm_agent_input, theuser_event.branchis explicitly set toctx._invocation_context.branch. This ensures thenode_inputis correctly scoped to the child agent's branch, preventing it from being filtered out by_is_event_belongs_to_branch.