fix(agenttool): propagate child state updates to parent #1651
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.37) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 236 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.327
Real PR Conversation Timeline
1 comments
"Review active on #1651"
general
weight: 0.35
ktsoator
Linked issue
Fixes #1644.
AgentTool copies parent state into the child session but drops the child's updates. Forward non-temporary child event deltas through the parent tool context.
Behavior change
OutputKey and callback updates to session-, app-, and user-scoped state now reach the parent and are persisted with the tool response. Later updates to the same key win. Parent state write errors stop the child run and are returned to the caller.
Child temp: updates, including temporary OutputKey values, are not forwarded to the parent. Existing parent temporary values are preserved, and child-only temporary keys stay out of the parent. Parent-to-child state copying is unchanged; #1612 covers that direction.
Testing Plan
Workspace build and race tests passed, along with lint and tidy in both modules.
TestAgentTool_Run_StateDeltafails with the fix reverted. Mutation checks also cover partial-event filtering and state-write errors.Mutation checks also fail when state propagation, partial-event filtering, or state-write error handling is removed, and when the temporary-key filter is inverted.
Checklist
Additional context
Python's session service strips temporary keys from event deltas before AgentTool forwards them(https://github.com/google/adk-python/blob/9625b06c9a1be6b9ecd85225657690ae5c0e9d3e/src/google/adk/tools/agent_tool.py#L328-L331). Go now applies the same child-to-parent filtering explicitly. Go also excludes partial events for the reason above.