Skip to content

fix(a2a): start a new task after a terminal task state#960

Open
radugheo wants to merge 1 commit into
mainfrom
fix/a2a-new-task-after-terminal
Open

fix(a2a): start a new task after a terminal task state#960
radugheo wants to merge 1 commit into
mainfrom
fix/a2a-new-task-after-terminal

Conversation

@radugheo

@radugheo radugheo commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator
  • After a remote A2A task reaches a terminal state (completed/canceled/failed/rejected), drop its task_id and start a new task on the next call, keeping context_id so the conversation continues.
  • Prevents re-sending a message to a terminal task, which a spec-compliant server rejects (Task ... is in terminal state).
  • Adds regression tests: task_id cleared on a terminal state, kept on a non-terminal one (input-required).
  • Bumps version to 0.13.19.

An A2A task in a terminal state (completed/canceled/failed/rejected) is
immutable, and a spec-compliant server rejects any further message that
references its task_id. The A2A tool persisted the returned task_id
unconditionally, so once a task completed the next turn reused it and the
remote call was rejected.

Clear the stored task_id when the task reaches a terminal state, keeping
the context_id so the next message starts a fresh task in the same
conversation.
Copilot AI review requested due to automatic review settings July 1, 2026 16:53
@radugheo radugheo requested a review from edis-uipath July 1, 2026 16:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the A2A tool’s conversation persistence logic so that once a remote task reaches a terminal state (completed/canceled/failed/rejected), the stored task_id is cleared while context_id is retained—ensuring the next turn starts a fresh task within the same conversation context and avoids server rejections for “terminal task” reuse.

Changes:

  • Clear task_id in tool state persistence when the returned task_state is terminal, while keeping context_id.
  • Add regression tests covering both terminal (completed) and non-terminal (input_required) task states.
  • Bump package version to 0.13.19 (including lockfile update).

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
src/uipath_langchain/agent/tools/a2a/a2a_tool.py Adds terminal-state detection and clears persisted task_id after terminal task completion while preserving context_id.
tests/agent/tools/test_a2a_tool.py Adds regression tests asserting task_id is dropped for terminal states and retained for non-terminal states.
pyproject.toml Bumps project version to 0.13.19.
uv.lock Updates locked package version to 0.13.19 to match CI’s uv sync --locked behavior.

@radugheo radugheo self-assigned this Jul 1, 2026
@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2026

Copy link
Copy Markdown

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.

2 participants