Skip to content

fix(workflow): Isolate delegated task branches - #6495

Closed
March-77 wants to merge 1 commit into
google:mainfrom
March-77:agent/issue-6457-isolate-task-delegation
Closed

fix(workflow): Isolate delegated task branches#6495
March-77 wants to merge 1 commit into
google:mainfrom
March-77:agent/issue-6457-isolate-task-delegation

Conversation

@March-77

Copy link
Copy Markdown
Contributor

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

  • run each task delegation in a stable sub-branch derived from the task FunctionCall ID
  • retain the FunctionCall ID as the scheduler run ID and isolation scope
  • add an end-to-end regression test that pauses a task child for tool confirmation and resumes it to completion

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.py

Compatibility 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.

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
@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Jul 27, 2026
copybara-service Bot pushed a commit that referenced this pull request Jul 27, 2026
Merge #6495

Fixes #6457

PiperOrigin-RevId: 954877821
@adk-bot

adk-bot commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Thank you @March-77 for your contribution! 🎉

Your changes have been successfully imported and merged via Copybara in commit 95feafa.

Closing this PR as the changes are now in the main branch.

@adk-bot adk-bot added the merged [Status] This PR is merged label Jul 27, 2026
@adk-bot adk-bot closed this Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core [Component] This issue is related to the core interface and implementation merged [Status] This PR is merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Task sub-agent attempts to execute the parent coordinator's delegation FunctionCall when resumability is enabled

3 participants