Repository navigation
Keep a voice recording when its composer unmounts mid-recording - #6673
Merged
Merged
Conversation
A composer that left the screen while its microphone was still recording treated the unmount as Cancel and dropped the captured audio. Composers with a persisted draft now treat unmount as Stop: the recording is accepted with insert delivery and transcribed into the originating draft through the existing accepted-recording path, and a failed transcription is kept in the composer's failed recordings. The question field, which has no durable destination, still discards. Fixes #6660 Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 tasks done
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.
Human comments
What was wrong
useVoiceInput's unmount cleanup treated a still-running recording as cancelled: it setshouldTranscribeRefto false before stopping the recorder, so the stop handler cleared the captured chunks and returned before anything reached the recording store. Leaving a thread while dictating lost the audio with no transcript, retry entry, or toast. Investigation report: https://get-bb.github.io/reports/issues/6660.htmlWhat changed
apps/app/src/hooks/useVoiceInput.ts: a recording started in a composer with a persisted draft (recordingKeyset) is accepted as Stop withinsertdelivery when the composer unmounts. It then follows the existing accepted-recording path from Preserve accepted voice transcription across navigation #4330/Keep failed voice recordings in the composer and retry with the original send choice #5590: transcribe into the originating draft, or keep it in that composer's failed recordings with the "saved in its composer" toast. It is never sent automatically. Explicit Cancel still discards.VoiceInputTextarea,recordingKey: null) still discards on unmount because it has no durable destination after the question closes. That needs a separate ownership decision (issue options 1/3 are not implemented here).How you verified
useVoiceInput.test.tsx: new test records 3 minutes, emits a chunk, unmounts, then finishes the recorder late; asserts all chunks are transcribed once and delivered withinsertand no error toast. It fails on main (1 failed, 22 passed) and passes with the fix. The old discard-on-unmount test now covers the question field only.pnpm exec turbo run test --filter=@bb/app -- src/hooks/useVoiceInput.test.tsx src/components/promptbox: 559 passed.@bb/apptypecheck and lint pass.pnpm start:worktreeinstance with two threads for a manual check;bb voice transcribesucceeded on that instance.Fixes #6660
🤖 Generated with Claude Code