Skip to content

fix(voice): prevent scheduling deadlock when pipeline task crashes#5678

Merged
theomonnom merged 1 commit intomainfrom
theo/fix-speech-handle-mark-done
May 8, 2026
Merged

fix(voice): prevent scheduling deadlock when pipeline task crashes#5678
theomonnom merged 1 commit intomainfrom
theo/fix-speech-handle-mark-done

Conversation

@theomonnom
Copy link
Copy Markdown
Member

@theomonnom theomonnom commented May 8, 2026

No description provided.

@chenghao-mou chenghao-mou requested a review from a team May 8, 2026 01:34
_mark_done() called _mark_generation_done() inside a
suppress(InvalidStateError) block for _done_fut. When _done_fut was
already resolved (e.g. interrupted speech), the InvalidStateError
suppressed the entire block — skipping _mark_generation_done(). This
left the generation future unresolved, so _wait_for_generation() in
the scheduling task hung forever, blocking all subsequent turns.

Fix: move _mark_generation_done() outside the _done_fut suppress block.

Co-Authored-By: Théo Monnom <theo@livekit.io>
Copy link
Copy Markdown
Contributor

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

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 potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@theomonnom theomonnom force-pushed the theo/fix-speech-handle-mark-done branch from af1ad6f to f1bdbd8 Compare May 8, 2026 01:38
@theomonnom theomonnom merged commit 8711686 into main May 8, 2026
24 checks passed
@theomonnom theomonnom deleted the theo/fix-speech-handle-mark-done branch May 8, 2026 01:47
Copy link
Copy Markdown
Contributor

Note

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 change touches the core voice runtime (speech_handle._mark_done), so it qualifies for porting. Verified that agents-js has the same bug pattern in agents/src/voice/speech_handle.ts::_markDone — the if (!doneFut.done) guard wraps both doneFut.resolve() and _markGenerationDone(), so if doneFut is already resolved (e.g. interrupted before _markDone is called), _markGenerationDone() is skipped and _waitForGeneration() hangs — exactly mirroring the Python contextlib.suppress(InvalidStateError) issue. No prior JS port found.

Porting now under branch claude/quirky-galileo-viXBX.


Generated by Claude Code

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.

3 participants