Repository navigation
fix(tts): cancel() ends a reader following the request being written - #280
Merged
Merged
Conversation
A `Cancel` takes the next flush_id, the same id `audio()` with no id uses for the text being written, so the watermark comparisons (`<`, `>`) missed that reader by one and it waited until the session ended. Compare with `<=` / `>=` and start the watermark at -1 so the first request is not dropped. Found porting the session to the Node SDK. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
What
session.cancel()did not end anaudio()iteration opened with no id (the one that follows the text being written, the README's token-streaming pattern) when the cancel came before the flush: the cancel takes the same flush id that reader was waiting on, and the watermark checks compared with<and>, so the reader missed it by one and waited until the session ended. The comparisons are now<=/>=, and the watermark starts at -1 so request 0 is not dropped by the initial value. Sync and async; three tests. Found while porting the session to the Node SDK (assemblyai-node-sdk #200).🤖 Generated with Claude Code