Repository navigation
Keep failed voice recordings in the composer and retry with the original send choice - #5590
Merged
Merged
Conversation
…nal send choice A failed transcription now leaves a "Voice input failed" banner in the composer with Retry, Download, and discard. Recordings are saved per composer in IndexedDB until they transcribe or are discarded, so they survive navigation, unmount, and reloads. Retry keeps whether the recording was sent or added to the draft. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Retry no longer moves the composer into the transcribing state. The banner shows "Retrying…" while the composer stays free for typing or a new recording; success delivers with the original send or insert choice, failure returns the banner with the new error, and discarding aborts the retry. The completion transition now runs only for live recordings, through a playCompletionTransition option on useVoiceInput. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ariofrio
added a commit
to ariofrio/bb
that referenced
this pull request
Oct 16, 2026
Takes upstream's post-get-bb#5590 voice files, since get-bb#5590 applies on top of 0.46.1, and keeps 0.46.1's plugin SDK version and API audit doc, which already include get-bb#5508. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
added a commit
that referenced
this pull request
Oct 30, 2026
## 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 #4330/#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](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
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
When voice transcription failed, the only way back to the audio was a sticky "Voice input failed" toast. Its Retry ignored how the recording was ended:
usePromptVoicereset its pending-send flag when the hook reached theerrorstate (createPromptVoiceIntent().settle), so a retried recording that had been ended with Send was always inserted into the draft instead. The audio also lived only in the toast's closure. Dismissing the toast, or reloading the page or the iOS webview, lost the recording, and on iOS the toast's "Download recording" couldn't save it (#5302).What changed
useVoiceInput.stop(delivery)takes"insert" | "send". The choice is stored with the recording and passed toonTranscript(text, delivery), so Retry respects it. The old send-flag state machine inprompt-voice-intent.tsis gone, and the double-stop guard now relies onMediaRecorder.state.lib/voice-recording-store.tskeeps recordings per composer, keyed bycomposerScopeIdentity. It saves a recording to IndexedDB (viaidb-keyval) when transcription starts and removes it on success or discard. Recordings therefore survive navigation, composer unmount, and page or webview reloads. A recording interrupted by a reload comes back as failed, with "Transcription did not finish".FailedVoiceRecordings.tsxshows "Voice input failed · " with Retry, Download, and an X to discard. It is one row on desktop and two rows on narrow screens. Question-form dictation (VoiceInputTextarea) shows the same banner, but those recordings are not saved across reloads because that input has no draft key.playCompletionTransitionoption onuseVoiceInput. This replacestranscribeAfterCompletionTransition.idb-keyval(runtime) andfake-indexeddb(dev, for the store test).There are no server, daemon, CLI, or configuration changes.
Behavior notes:
How you verified
pnpm exec turbo run test --filter=@bb/app -- src/hooks/useVoiceInput.test.tsx src/lib/voice-recording-store.test.tsxpasses all 24 tests;pnpm exec turbo run lint typecheck --filter=@bb/apppasses with existing lint warnings;git diff --checkpasses.voice-recording-store.test.tsx: an unfinished recording is restored after a simulated reload against fake IndexedDB, and deleting a recording before its save finishes leaves nothing stored.useVoiceInput.test.tsx: retry keeps the original send or insert choice, prompt context, and audio file; a stop/send double click keeps the first choice; a retry leaves the composer idle, allows a new recording, and is aborted by discarding; a live transcript waits for the completion transition while a retry skips it; a failure after unmount shows the toast and the recording on remount.pnpm exec turbo run typecheck lint --filter='...[origin/main]'passes; lint shows existing warnings only.pnpm exec turbo run test --filter=@bb/app: 5852 passed. An earlier run across all affected packages had one failure,PluginSettings.test.tsx > autosaves the latest text value on blur; that test is untouched by this change and passed 3 of 3 runs on its own.pnpm start:worktreebuild is up for manual checking; setting Voice input to Off in Settings → AI services makes transcription fail on demand.Fixes #5302