fix(workflow): Isolate delegated task branches - #6495
Closed
March-77 wants to merge 1 commit into
Closed
Conversation
Run each task delegation in a stable sub-branch so resumable LLM flow logic cannot replay the parent coordinator's delegation call as a child tool call. Keep the function-call ID as both the run ID and isolation scope for deterministic resumption and task-local history. Add an end-to-end regression test covering a task sub-agent that pauses for tool confirmation and resumes to completion. Fixes google#6457
Collaborator
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 #6457
Problem and root cause
When resumability is enabled, a task-mode sub-agent runs on the same event branch as its chat coordinator. The resumable LLM flow scans the current branch for an unresolved function call, so it can mistake the coordinator's task-delegation call for a tool call owned by the child and fail with
Tool '<task agent>' not found.Summary
User impact
Resumable task sub-agents no longer attempt to execute their parent coordinator's delegation FunctionCall. Non-resumable task delegation continues to use the same scheduling and isolation identifiers.
Tests
.venv/bin/pytest tests/unittests/workflow -q(676 passed, 11 skipped, 10 xfailed).venv/bin/pytest tests/unittests/workflow/test_task_api_e2e.py tests/unittests/workflow/test_llm_agent_as_node.py tests/unittests/runners/test_run_tool_confirmation.py -q(52 passed, 8 skipped, 1 xfailed).venv/bin/pre-commit run --files src/google/adk/workflow/_llm_agent_wrapper.py tests/unittests/workflow/test_task_api_e2e.pyCompatibility and risk
The behavior change is limited to branch placement for task-agent dispatch. The existing stable run ID, isolation scope, task input reconstruction, and parent-visible synthesized response are unchanged. The full workflow unit-test suite passes.