Skip to content

Keep a voice recording when its composer unmounts mid-recording - #6673

Merged
ymichael merged 1 commit into
mainfrom
bb/fix-issue-6660-in-bb-thr_ewxtueqs8y
Oct 30, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/fix-issue-6660-in-bb-thr_ewxtueqs8y

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

useVoiceInput's unmount cleanup treated a still-running recording as cancelled: it set shouldTranscribeRef to 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.html

What changed

  • apps/app/src/hooks/useVoiceInput.ts: a recording started in a composer with a persisted draft (recordingKey set) is accepted as Stop with insert delivery 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.
  • The question field (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).
  • No wire, CLI, or doc changes.

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 with insert and 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/app typecheck and lint pass.
  • Ran a pnpm start:worktree instance with two threads for a manual check; bb voice transcribe succeeded on that instance.

Fixes #6660

AGENT GENERATED

🤖 Generated with Claude Code

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]>
@ymichael
ymichael merged commit 57f41b4 into main Oct 30, 2026
30 checks passed
@ymichael
ymichael deleted the bb/fix-issue-6660-in-bb-thr_ewxtueqs8y branch October 30, 2026 16:52
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.

Voice input: in-progress recording is silently discarded when the composer unmounts

1 participant