Skip to content

fix: preserve root task input across clarification turns - #7419

Open
vinitsonawane45 wants to merge 4 commits into
google:mainfrom
vinitsonawane45:fix/issue-7384
Open

vinitsonawane45 wants to merge 4 commits into
google:mainfrom
vinitsonawane45:fix/issue-7384

Conversation

@vinitsonawane45

@vinitsonawane45 vinitsonawane45 commented Oct 5, 2026 •

Copy link
Copy Markdown

Summary

Fixes #7384: Preserve the original task input when a root LlmAgent(mode="task") asks a clarification question and then resumes.

Root cause

Root task agents used a fixed node-path-based isolation scope, allowing separate root task invocations in the same session to share a scope.

When a root task resumed after clarification, the original user message could not be recovered through the existing function-call-based reconstruction because root tasks do not have a delegating function call.

Additionally, nested workflow scopes contain @ characters, so checking only for @ could incorrectly treat a nested scope as a root task scope.

Fix

  • Give each root task invocation its own isolation scope using target_node_name@ctx.invocation_id.
  • Recover the original root user message using the invocation ID encoded in the root scope.
  • Restrict root-scope reconstruction to scopes without /, avoiding incorrect matching of nested workflow-node paths.
  • Preserve existing isolation behavior for delegated task nodes.

Tests

  • Added regression coverage for root-task clarification and resumption.
  • Added a four-turn test covering two sequential root tasks asking separate clarification questions in the same session, ensuring their inputs do not leak across tasks.
  • Added assert len(parts) == 2 to catch duplicated clarification answers.
  • Verified that the original task input and clarification answer are preserved when the task resumes.

Validation

  • Focused workflow tests: 3 passed.
  • Workflow task API test file: 15 passed, 1 xfailed.
  • A2A v1 clarification/resumption integration test: 1 passed.
  • Targeted content tests: 2 passed.
  • Ruff, Pyink, and git diff --check: passed.

The broader unit suite also encountered Windows-specific failures in unrelated Cloud Run and Bash tests; the entire suite should not be described as passing.

Isolation behavior

Root task invocations use per-invocation scopes. Clarification and resumption within the same task are preserved, while separate root task invocations do not share intermediate task execution history.

Fixes #7384

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A task-mode root agent loses its task input once it asks the user a question

2 participants