← Back to Pull requests

fix(agenttool): propagate child state updates to parent #1651

Open
unknown opened this pull request with 236 lines diff across 2 files
View on GitHub
unknown unknown commented on Sep 25, 2026 14:19 UTC
Author

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_StateDelta fails 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

  • Read CONTRIBUTING.md.

  • Reviewed the full diff.

  • Added regression tests and verified they fail without the fix.

  • Build, tests, lint, and tidy checks pass.

  • Manually tested end-to-end.
  • 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.

    Diff: 236 lines (+177 / -59) across 2 files Reviewer: ktsoator Review duration: 38994m
    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
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37.2% (MEDIUM) · Higher = larger blast radius
    37.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.8% · Safe to merge
    19.8%
    Repository