Skip to content

fix: reject inline tasks during agent handoff - #7268

Merged
chenghao-mou merged 6 commits into
mainfrom
chenghao/fix/AGT-3502-inline-task-handoff-deadlock
Sep 15, 2026
Merged

chenghao-mou merged 6 commits into
mainfrom
chenghao/fix/AGT-3502-inline-task-handoff-deadlock

Conversation

@chenghao-mou

@chenghao-mou chenghao-mou commented Sep 14, 2026

Copy link
Copy Markdown
Member

An outgoing tool that starts an AgentTask during handoff can deadlock the session. Reject it with a ToolError explaining that the agent transition must finish before retrying. Public drain keeps its existing behavior.

Reproduces @dtran26's report in agents-js#2483. The Python fix was developed independently; the similar JS fix was discovered afterward.

Addresses AGT-3502.

Initial prompt and agent context

Model: GPT-6

can you investigate /tmp/agents-python-2483-investigation.md

Essential follow-up instructions:

how about we raise a tool error if the parent acitivity is draining and let the agent to call it later?

Yeah, it should be obvious to the agent that we are in transition to a new agent, and a tool call is not permitted until the transition is finished

I thought we have handoff first in the initial failure case?

Reject inline tasks from an outgoing activity once handoff starts. This breaks
the circular wait between activity shutdown and a tool awaiting the transition
lock, while preserving normal inline-task pause and resume.

Co-authored-by: Dan Tran <danganhtran@me.com>
@chenghao-mou chenghao-mou added the review_effort:high Needs broad context and substantial validation label Sep 14, 2026
@chenghao-mou
chenghao-mou marked this pull request as ready for review September 14, 2026 14:29
@chenghao-mou
chenghao-mou requested a review from a team as a code owner September 14, 2026 14:30
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@chenghao-mou
chenghao-mou merged commit d3961b9 into main Sep 15, 2026
23 checks passed
@chenghao-mou
chenghao-mou deleted the chenghao/fix/AGT-3502-inline-task-handoff-deadlock branch September 15, 2026 09:36
chenghao-mou added a commit to swayamg20/agents-js that referenced this pull request Sep 15, 2026
Block inline tasks only during agent transitions, so standalone drain can
still finish an in-flight AgentTask. Match the transition error and add the
applicable regression cases from livekit/agents#7268.

Addresses AGT-3502
Refs livekit#2483

Co-authored-by: Dan Tran <danganhtran@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review_effort:high Needs broad context and substantial validation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants