Skip to content

fix: cancel parked preemptive generation during handoff - #7016

Open
mikemikimike wants to merge 1 commit into
livekit:mainfrom
mikemikimike:fix/agent-task-preemptive-deadlock
Open

fix: cancel parked preemptive generation during handoff#7016
mikemikimike wants to merge 1 commit into
livekit:mainfrom
mikemikimike:fix/agent-task-preemptive-deadlock

Conversation

@mikemikimike

Copy link
Copy Markdown
Contributor

Summary

When an uninterruptible speech is active, a preemptive generation cannot be used and must be cancelled before the user-turn task returns. This prevents AgentTask handoffs from waiting on orphaned speech work.

Changes

  • Cancel parked preemptive generation when an uninterruptible speech causes a user reply to be skipped.
  • Add a deterministic regression test for the cleanup path.

Tests

  • uv run --frozen pytest tests/test_wait_for_idle_cancellation.py -q
  • uv run --frozen ruff check livekit-agents/livekit/agents/voice/agent_activity.py tests/test_wait_for_idle_cancellation.py
  • uv run --frozen ruff format --check livekit-agents/livekit/agents/voice/agent_activity.py tests/test_wait_for_idle_cancellation.py
  • git diff --check

Closes #6858.

@mikemikimike
mikemikimike requested a review from a team as a code owner August 27, 2026 15:19

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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.

AgentTask handoff deadlocks when a preemptive generation is left parked

1 participant