Repository navigation
fix(voice): retry preemptive generation after a barge-in interrupts speech - #8892
Merged
chenghao-mou merged 3 commits intoDec 2, 2026
Merged
Conversation
…peech The preemptive generation hook refuses a final transcript that arrives while agent speech is playing. With resume_false_interruption, that speech is paused but not yet interrupted when the hook runs, so nothing started the reply until the turn commit. The refused attempt now retries once the speech is done and interrupted, so its chat context includes the interrupted reply and tool results. Only the latest refused attempt retries, only while its transcript is still the current one, and never after the turn is committed or cancelled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chenghao-mou
marked this pull request as ready for review
December 1, 2026 23:56
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)
A speech handle keeps its done callbacks after it calls them, so each retry callback held its transcript and copied context until the handle was collected. The callback now removes itself when it runs. The barge-in test with an interrupted tool call now asserts that the retried request carries the tool call and its result. Before, the timing and request count passed even if the result never reached the chat context. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
longcw
approved these changes
Dec 2, 2026
longcw
left a comment
Contributor
There was a problem hiding this comment.
One non-blocking question: the retry skips when _preemptive_generation already holds an attempt for the same words. That attempt was created before the interrupted reply landed in the chat context, so it fails is_equivalent at the end of turn and gets regenerated.
JustinScitech
approved these changes
Dec 2, 2026
A preemptive reply can start before the agent speech that a barge-in later interrupts. Its chat context then lacks the interrupted reply, so the turn commit cannot adopt it. The retry skipped such a reply when it had the same words, which brought back the end-of-turn delay. The retry now skips only when the commit can still adopt the existing reply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chenghao-mou
deleted the
t3/investigate-preemptive-generation-paused-speech
branch
December 2, 2026 10:35
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.
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.