Skip to content

fix: surface task_id in interrupted tool error text for LLM resume#35222

Open
flaxodev wants to merge 1 commit into
anomalyco:devfrom
flaxodev:dev
Open

fix: surface task_id in interrupted tool error text for LLM resume#35222
flaxodev wants to merge 1 commit into
anomalyco:devfrom
flaxodev:dev

Conversation

@flaxodev

@flaxodev flaxodev commented Jul 3, 2026

Copy link
Copy Markdown

The sub-agent session ID was persisted in DB metadata on abort but
never rendered to the LLM. Include task_id in the error text so the
agent can resume aborted sub-agents via the Task tool's task_id
parameter.

Issue for this PR

Related to #35177
Closes #
Closes #35177

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The sub-agent session ID was persisted in DB metadata on abort but
never rendered to the LLM. Include task_id in the error text so the
agent can resume aborted sub-agents via the Task tool's task_id
parameter.

How did you verify your code works?

I tested my changes locally

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…resume them

When a user aborts a running sub-agent, the Task tool's sessionId is persisted in the tool part's metadata but never surfaced to the LLM. The agent only sees "Tool execution aborted" with no way to know the sub-agent's session ID, so it cannot resume the aborted task via the task_id parameter.

Include the task_id in the error text rendered to the LLM for any
interrupted tool call that has sessionId in its state metadata.
The agent will see:

    Tool execution aborted

    `task_id: ses_0d76b70c6ffekT4JcAvvXEuaeI`

And can pass that task_id back to the Task tool to resume the
sub-agent with its full conversation history intact.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@NamedIdentity

NamedIdentity commented Jul 4, 2026

Copy link
Copy Markdown

I've been thinking for a long time to make the task_id return even if the agent stalls out, errors, etc. Just too many higher priority issues to work on. A fix is needed. The recovery pattern for agents is typically trying to resume the session and observing it fail without understanding why, and then just retasking a fresh subagent.

Which works, but its sometimes inefficient and creates more token burn. The additional feature that's needed though is for when subagents fail to return, due to interruption or an error (such as a connection timeout), relaying the error message or the last section of text and message type (e.g. an agent was interrupted or stalled out with last messages being thinking blocks).

That way the tasking agent can have enough information to better infer and understand why the subagent failed to return, and initiate more appropriate recovery processes. This would help make more autonomous workflows; less need for humans to help agents understand why a subagent session failed to return.

I'd suggest expanding the scope of the fix as needed to fully address matters.

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.

[FEATURE]: Make tools return id even if they were aborted

2 participants