fix: clear stale paused speech state across generation steps#5594
Merged
fix: clear stale paused speech state across generation steps#5594
Conversation
When a SpeechHandle advances through multiple generation steps (e.g. silent tool call followed by a tool reply), false-interruption pause state captured during an earlier step could leak into the next step, causing the agent to restore to a stale agent_state on resume. Reset _paused_speech (and the matching false-interruption timer + audio output) at the scheduling-loop boundary between generation steps for the same SpeechHandle, so the next step records fresh state.
jayeshp19
approved these changes
Apr 29, 2026
davidzhao
approved these changes
Apr 29, 2026
Contributor
|
This is an automated Claude Code Routine created by @toubatbrian. Right now it is in experimentation stage. The automation will start porting this PR into agents-js automatically. This PR ( Generated by Claude Code |
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
Alternative fix for the bug described in #5533.
When a
SpeechHandleadvances through multiple generation steps within a single turn (e.g. a silent tool-call step followed by a tool-reply step), the false-interruption_paused_speechstate captured during an earlier step could leak into the next step.This fix resets
_paused_speech— together with the matching false-interruption timer and the paused audio output — at the scheduling-loop boundary in_scheduling_task, right after each generation step finishes. The next step that runs on the sameSpeechHandlethen records fresh paused state with the correctagent_state.