fix(runners): Preserve state_delta in NodeRunner path#5767
fix(runners): Preserve state_delta in NodeRunner path#5767trongthanht3 wants to merge 5 commits into
Conversation
|
@gemini-cli /review |
|
🤖 Hi @DeanChensj, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
There was a problem hiding this comment.
The changes look solid and correctly address the issue where state_delta was not being attached to the initial user event in the ADK 2.0 NodeRunner path. This ensures that session state updates requested via /run or /run_sse are visible to nodes and agents before they execute.
I've left one minor suggestion for code conciseness in runners.py, but overall this is a great fix with excellent test coverage. Approving!
| author='user', | ||
| actions=EventActions(state_delta=state_delta), | ||
| content=content, | ||
| ) |
There was a problem hiding this comment.
This is a good fix. It correctly threads state_delta through the NodeRunner path, ensuring the session state is updated before any nodes or agents execute.
One minor suggestion: this block could be slightly more concise, though the current version is perfectly clear.
event = Event(
invocation_id=ic.invocation_id,
author='user',
actions=EventActions(state_delta=state_delta) if state_delta else None,
content=content,
)| @@ -0,0 +1,161 @@ | |||
| # Copyright 2026 Google LLC | |||
There was a problem hiding this comment.
Excellent test coverage. Verifying both BaseNode and LlmAgent callback scenarios ensures that the state delta is correctly applied in different execution paths.
| @@ -0,0 +1,161 @@ | |||
| # Copyright 2026 Google LLC | |||
There was a problem hiding this comment.
Could you move the tests to tests/unittests/runners/test_runner_node.py?
There was a problem hiding this comment.
I moved tests to tests/unittests/runners/test_runner_node.py as your request
|
Response from ADK Triaging Agent Hello @trongthanht3, thank you for creating this PR! Your PR description is very detailed, and we appreciate the thorough testing plan and logs! However, we noticed that the To resolve any formatting or style issues, please ensure you run pre-commit locally across all files: pre-commit run --all-filesYou can refer to the Development Setup section of our contributing guidelines for details. This will help us review and merge your changes more quickly. Thanks! |
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
state_deltapassed to/runendpoint is silently ignored in Workflow (NodeRunner) path #5763Problem:
/runand/run_ssealready passstate_deltaintoRunner.run_async, but the ADK 2.0 NodeRunner execution path was not attaching that delta to the initial user event. As a result, workflow nodes and rootLlmAgentexecutions could not see the requested state before running.Solution:
Thread
state_deltathrough the NodeRunner path and persist non-empty deltas on the initial user event viaEventActions, matching the legacy runner behavior while preserving existing user-event isolation-scope handling.Testing Plan
Unit Tests:
Passed results:
Manual End-to-End (E2E) Tests:
Ran
adk webwith an agent callback that logs session state before execution:Sent
/runand/run_sserequests with:{ "app_name": "state_delta_app", "user_id": "e2e-user", "session_id": "e2e-session", "new_message": { "role": "user", "parts": [ { "text": "hello" } ] }, "state_delta": { "test_state": "must_change" } }Observed:
Checklist
Additional context
No dependent changes are required.