Repository navigation
fix(voice): retry preemptive generation after a barge-in - #3134
Open
rosetta-livekit-bot[bot] wants to merge 1 commit into
Open
rosetta-livekit-bot[bot] wants to merge 1 commit into
rosetta-livekit-bot[bot] wants to merge 1 commit into
Conversation
Contributor
|
This PR bumps
Also bumped
|
Contributor
There was a problem hiding this comment.
🔍 Devin Review: 2 flags
Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports livekit/agents#8892.
Testing
pnpm test agents(5,262 passed, 10 skipped)pnpm build:agentspnpm --filter @livekit/agents typecheckpnpm --filter @livekit/agents lintpnpm format:checkcue-cliframework-event validation could not be run because the binary is unavailable in the execution environment. The ported deterministicAgentSessionregression suite validates the interruption lifecycle without external providers.Source diff coverage
Source diff coverage
livekit-agents/livekit/agents/voice/agent_activity.py->agents/src/voice/agent_activity.ts. Ported refused-attempt tracking, callback cleanup, interrupted-task and current-transcript guards, stale-attempt replacement, turn/cancellation clearing, and hook-context preservation. Pythoncontextvars.copy_context()maps to NodeAsyncLocalStorage.snapshot(), and Python task completion maps to targetTask.done.tests/test_agent_interruptions.py->agents/src/voice/agent_activity_preemptive_pause_deadlock.test.ts. Ported every added scenario and parameterized case with the target's realAgentSessionandSpeechHandlelifecycle plus a deterministic gated LLM, because the target has no PythonFakeActionsvirtual-time harness. Coverage includes pause/no-pause barge-ins, interrupted tool results, preflight supersession,IGNORE_ON_ENTERcontext, interrupted and uninterrupted completion, cleared or extended transcripts, and stale-attempt replacement.Ported from livekit/agents#8892
Original PR description
A final transcript that barges in on agent speech skipped preemptive generation. With
resume_false_interruption, the speech is paused but not yet interrupted when the hook runs, so the reply waited for the turn commit.The refused attempt now retries once the interrupted speech is done, so its chat context includes the interrupted reply and tool results. Only the latest attempt retries, and only while its transcript is still current.
The issue report supplied the diagnosis and an offline reproduction.
Addresses AGT-4149
Initial prompt and agent context
Model: Claude Opus 5.5
Summary: investigate a reported issue where preemptive generation is skipped while agent speech is paused, implement a retry with tests, and revise it through several two-model code reviews.