Repository navigation
Commit 8d389e2
fix: scope single-turn node inputs to workflow branch
Merge #6008
## Summary
Fixes #5989.
`prepare_llm_agent_input()` appends the single-turn node input directly to
`session.events`, so it bypasses `NodeRunner._enrich_event()`. In a dynamic
workflow sub-branch, that left the private node input as a branchless user event.
Branchless user events are visible to sibling branches, which can make another
worker pick the wrong "current turn" boundary and slice out its own function
call.
This stamps the single-turn input event with the current invocation branch when
one exists, while preserving the existing isolation-scope stamping.
## To verify
- `PYTHONPATH=src python -m pytest tests\unittests\workflow\test_llm_agent_as_node.py -q -k "single_turn_input_event_inherits_branch_and_scope"`
- `PYTHONPATH=src python -m pytest tests\unittests\workflow\test_llm_agent_as_node.py -q`
- `python -m py_compile src\google\adk\workflow\_llm_agent_wrapper.py tests\unittests\workflow\test_llm_agent_as_node.py`
- `python -m pyink --check src\google\adk\workflow\_llm_agent_wrapper.py tests\unittests\workflow\test_llm_agent_as_node.py`
- `python -m isort --check-only src\google\adk\workflow\_llm_agent_wrapper.py tests\unittests\workflow\test_llm_agent_as_node.py`
- `git diff --check`
Co-authored-by: George Weale <[email protected]>
COPYBARA_INTEGRATE_REVIEW=#6008 from he-yufeng:fix/node-input-branch-scope f178fb9
PiperOrigin-RevId: 9387120821 parent febb250 commit 8d389e2
2 files changed
Lines changed: 27 additions & 2 deletions
File tree
- src/google/adk/workflow
- tests/unittests/workflow
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
239 | | - | |
| 238 | + | |
| 239 | + | |
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
250 | 253 | | |
251 | 254 | | |
252 | 255 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
215 | 237 | | |
216 | 238 | | |
217 | 239 | | |
| |||
0 commit comments