#7604 · Blank voice responses enter the failure path
Verdict: REPRODUCED · Root-cause confidence: high for the core state-handling defect. Device capture and mobile text clipping were not verified.
1. TL;DR
A transcription service can successfully finish without returning any words. The voice-input hook converts that response into an exception, retains the audio as failed, and exposes it to the composer's Retry/Download card. Repeating the request with another empty response leaves the same error. If the composer unmounts while the response is pending, an error toast is also emitted. Four regression cases reproduce this at the real hook and recording-store boundary in two clean checkouts; all 23 pre-existing hook tests pass in both runs.
2. Claims vs findings
| Claim | Status | Evidence |
|---|---|---|
| A blank successful transcription is treated as failed. | Verified | Insert/send tests supply whitespace (including a nonbreaking space) and observe one failed recording with the empty-result error. |
| Retry does not clear an empty result. | Verified | A transport error creates the retryable recording; retry resolves with an empty string but the entry remains failed. |
| Completion after unmount can toast and retain the audio. | Verified | The delayed empty response triggers the saved-recording toast and is visible to a remounted hook. |
| The composer renders Retry and Download from these failed entries. | Verified in source | The composer conditionally renders FailedVoiceRecordings from the hook's failedRecordings; that component provides both controls. No browser screenshot. |
| Silent physical recordings consistently produce an empty service response on the reported devices. | Unverified | MediaRecorder is a repository-style test double, and the service callback is stubbed. No real provider or microphone was used. |
| Phone error text is clipped and cannot be opened by touch. | Unverified | No iOS session. The browser automation prerequisite is unavailable on this host. |
3. Environment
- Trusted public repository: get-bb/bb; origin/main at
da3e60b81d560e114a2bec724bb59c997aaaae7f. - Linux 4.19.0-gvisor x86_64, Node v22.19.0, pnpm 9.15.0; repository Vitest/jsdom and shared-worker configuration.
- Two detached temporary checkouts at the same commit; new process and temporary test environment for each run. No HTTP server, ports, product data directory, credentials, or user runtime used.
- Frozen install succeeded in each checkout. First full build initially lacked the plugin SDK's built host/process entrypoints; explicitly building that existing SDK and retrying the normal full build passed (74 tasks). The second checkout built the SDK and test dependencies via Turbo.
- Browser Automation local/headless open failed with:
Install Chrome/Chromium on this host or link its executable at the plugin data runtime/chrome path.No screenshot is claimed, no dependency was added, and no other browser was substituted.
4. Minimal reproduction
This is a functional state-handling reproduction, not an end-to-end audio or visual reproduction. Only browser capture and the external transcription callback are substituted; the real hook, normalization, retry/settlement code, and recording store execute unchanged.
- Save the complete regression patch below as
/tmp/7604-regression.patch. - Check out the recorded trusted main commit and build using the normal frozen install and Turbo.
- Apply the independently authored patch to the existing hook test suite and run it. The four new desired-behavior tests should pass after a fix but fail on this baseline. The 23 existing tests are the controls.
git clone https://github.com/get-bb/bb.git bb-7604 cd bb-7604 git checkout --detach da3e60b81d560e114a2bec724bb59c997aaaae7f pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build --filter=@get-bb/plugin-sdk pnpm exec turbo run build git apply /tmp/7604-regression.patch pnpm exec turbo run test --filter=@bb/app -- src/hooks/useVoiceInput.test.tsx
Expected: no failed entries, no delivery callback, no completion transition, and no error toast for a blank successful result. Retry should remove the prior error entry.
Actual: each blank-result scenario retains one failed entry; the unmounted case also calls the error-toast boundary. Observed output (Turbo prefixes omitted):
issue-7604 observation {"delivery":"insert","errors":["Voice transcription returned an empty result."]}
issue-7604 observation {"delivery":"send","errors":["Voice transcription returned an empty result."]}
issue-7604 retry [ 'Voice transcription returned an empty result.' ]
issue-7604 unmount {"errors":["Voice transcription returned an empty result."],"toasts":[["Couldn't transcribe your recording",{"description":"It's saved in its composer so you can retry."}]]}
AssertionError: expected [ { …(8) } ] to have a length of +0 but got 1
Tests 4 failed | 23 passed (27)
Complete regression patch follows. It adds only tests to the existing suite and uses that suite's trusted fixtures and imports. Save the block verbatim as the patch file named above; no other artifact is needed.
diff --git a/apps/app/src/hooks/useVoiceInput.test.tsx b/apps/app/src/hooks/useVoiceInput.test.tsx
index b3aa5fd9f9..4f903601db 100644
--- a/apps/app/src/hooks/useVoiceInput.test.tsx
+++ b/apps/app/src/hooks/useVoiceInput.test.tsx
@@ -7,6 +7,84 @@ import { useAudioInputDevicePreferenceValue } from "@/lib/audio-input-device-pre
import { saveFile } from "@/lib/save-file";
import { useVoiceInput } from "./useVoiceInput";
+it.each(["insert", "send"] as const)(
+ "issue 7604: discards a blank service response for %s without notifying the composer",
+ async (delivery) => {
+ const onTranscript = vi.fn();
+ const playCompletionTransition = vi.fn();
+ const onTranscribe = vi.fn().mockResolvedValue("\t\n\u00a0");
+ const { result } = renderHook(() =>
+ useVoiceInput({
+ recordingKey: `thread/issue-7604-${delivery}`,
+ onTranscribe,
+ onTranscript,
+ playCompletionTransition,
+ }),
+ );
+ await act(() => result.current.start());
+ act(() => vi.advanceTimersByTime(2000));
+ await act(async () => result.current.stop(delivery));
+ expect(onTranscribe).toHaveBeenCalledOnce();
+ expect(result.current.state).toBe("idle");
+ expect(onTranscript).not.toHaveBeenCalled();
+ expect(playCompletionTransition).not.toHaveBeenCalled();
+ expect(appToast.error).not.toHaveBeenCalled();
+ console.log("issue-7604 observation", JSON.stringify({
+ delivery,
+ errors: result.current.failedRecordings.map((recording) => recording.errorMessage),
+ }));
+ expect(result.current.failedRecordings).toHaveLength(0);
+ },
+);
+
+it("issue 7604: blank response on retry removes an earlier transport failure", async () => {
+ const onTranscribe = vi.fn()
+ .mockRejectedValueOnce(new Error("Connection lost"))
+ .mockResolvedValueOnce("");
+ const onTranscript = vi.fn();
+ const { result } = renderHook(() => useVoiceInput({
+ recordingKey: "thread/issue-7604-retry",
+ onTranscribe,
+ onTranscript,
+ }));
+ await act(() => result.current.start());
+ act(() => vi.advanceTimersByTime(2000));
+ await act(async () => result.current.stop("insert"));
+ const recording = result.current.failedRecordings[0];
+ expect(recording?.errorMessage).toBe("Connection lost");
+ if (!recording) throw new Error("Transport failure did not retain audio");
+ await act(async () => result.current.retry(recording));
+ expect(onTranscribe).toHaveBeenCalledTimes(2);
+ expect(onTranscript).not.toHaveBeenCalled();
+ expect(appToast.error).not.toHaveBeenCalled();
+ console.log("issue-7604 retry", result.current.failedRecordings.map((entry) => entry.errorMessage));
+ expect(result.current.failedRecordings).toHaveLength(0);
+});
+
+it("issue 7604: blank response after unmount leaves no saved error or toast", async () => {
+ const pending = Promise.withResolvers<string>();
+ const options = {
+ recordingKey: "thread/issue-7604-unmount",
+ onTranscribe: vi.fn(() => pending.promise),
+ onTranscript: vi.fn(),
+ };
+ const first = renderHook(() => useVoiceInput(options));
+ await act(() => first.result.current.start());
+ act(() => vi.advanceTimersByTime(2000));
+ await act(async () => first.result.current.stop("send"));
+ expect(options.onTranscribe).toHaveBeenCalledOnce();
+ first.unmount();
+ await act(async () => pending.resolve(""));
+ const second = renderHook(() => useVoiceInput(options));
+ expect(options.onTranscript).not.toHaveBeenCalled();
+ console.log("issue-7604 unmount", JSON.stringify({
+ errors: second.result.current.failedRecordings.map((recording) => recording.errorMessage),
+ toasts: vi.mocked(appToast.error).mock.calls,
+ }));
+ expect.soft(second.result.current.failedRecordings).toHaveLength(0);
+ expect(appToast.error).not.toHaveBeenCalled();
+});
+
vi.mock("@/components/ui/app-toast", () => ({ appToast: { error: vi.fn() } }));
vi.mock("@/lib/save-file", () => ({ saveFile: vi.fn() }));
vi.mock("@/lib/audio-input-device-preference", () => ({
5. Root cause
normalizeTranscript collapses whitespace and trims it. runTranscription at lines 415–440 then throws for a zero-length normalized response; its catch block classifies the thrown exception as a failed transcription.
const text = normalizeTranscript(transcript);
if (!signal.aborted && text.length === 0) {
throw new Error("Voice transcription returned an empty result.");
}
await beforeDelivery?.();
return signal.aborted
? { kind: "cancelled" }
: { kind: "transcript", text };
} catch (error) {
return signal.aborted ||
(error instanceof DOMException && error.name === "AbortError")
? { kind: "cancelled" }
: { kind: "failed", message: resolveRecordingErrorMessage(error) };
}
settleTranscription at lines 445–478 persists the failure in the live recording store, or does that plus a toast after unmount when recordings are persistent.
if (result.kind === "failed") {
if (mountedRef.current) {
failVoiceRecording(recording.id, result.message);
} else if (persistRecordings) {
failVoiceRecording(recording.id, result.message);
appToast.error("Couldn't transcribe your recording", {
description: "It's saved in its composer so you can retry.",
});
} else {
void deleteVoiceRecording(recording.id);
}
return;
failVoiceRecording marks the recording failed and notifies subscribers. VoiceInputTextarea renders the failed list, while FailedVoiceRecordings supplies the visible error, Retry and Download. The hook itself returns idle, so idle alone does not mean the error entry is gone. The retry path runs the same transcription decision and therefore repeats the error.
6. Proposed fix
Classify a successfully normalized empty response as an intentional no-op rather than as an exception. Settle it by removing the audio entry, without invoking transcript delivery, completion animation, or an error toast. Preserve error retention for service/transport failures and existing cancellation semantics. Exercise both completion choices, retry, and delayed resolution after unmount. No public API, wire protocol, schema or dependency change appears necessary.
7. Linked PR review
#7605 · Open against main
GitHub metadata links this existing PR to #7604. Static diff review only: the two changed files add an explicit empty outcome, return it before the completion transition, and delete its recording during settlement. That targets the reproduced failure decision and retains the separate failed/cancelled branches. The diff also contains tests for empty/whitespace responses and retry. No concrete blocker was found in this limited static review; its branch was not checked out or executed, and its claimed test results are not independently verified here. The report's own tests run only on trusted main.
No new fix PR: an open linked PR already exists, so creating another would duplicate the work.
8. Related issues
No other issue was independently investigated. The existing linked PR is recorded above; device capture failures and mobile tooltip behavior are outside this verified scope.
9. Verification
The same agent repeated the reproduction (not an independent review). The second detached checkout was clean at the recorded base before applying only the authored test patch. It received a separate frozen install and ran a fresh Vitest process through Turbo; both test tasks were executed rather than served from cache. The production hook's SHA-256 matched in both checkouts: e11cd15bcbe19adb5ce7ab7e439c4735341e4bb3d591cd2bb6e61440af4c529a.
First checkout: pnpm exec turbo run test --filter=@bb/app -- src/hooks/useVoiceInput.test.tsx Result: exit 1; 4 new tests failed, 23 existing tests passed; duration 1.62s. Second checkout: pnpm exec turbo run test --filter=@bb/app -- src/hooks/useVoiceInput.test.tsx Result: exit 1; 4 new tests failed, 23 existing tests passed; duration 1.48s.
All four observations match across runs. No report correction was needed after the second run. Neither run establishes real microphone/provider behavior or mobile clipping; those claims remain explicitly unverified. No production fix was applied because #7605 was already open.
10. Appendix
The complete test patch and expected-versus-actual output are inline above. Raw test logs and the investigation brief remain local, not in this public repository. Source links were checked against the recorded commit. The full build regenerated an unrelated web route file in the first disposable checkout; it is not part of the reproduction patch or report.
Safety: issue content and the linked PR were treated as untrusted evidence. No commands, scripts, patches or branches supplied by the issue or linked PR were executed. The reproduction patch was authored from trusted repository behavior. No real account data was loaded and no live core was started.
Additional investigation commands:
git fetch origin main git rev-parse origin/main git worktree add --detach /tmp/7604-checkout-a da3e60b81d560e114a2bec724bb59c997aaaae7f git worktree add --detach /tmp/7604-checkout-b da3e60b81d560e114a2bec724bb59c997aaaae7f gh api repos/get-bb/bb gh pr view 7605 --repo get-bb/bb --json number,state,baseRefName,body,files,url gh pr diff 7605 --repo get-bb/bb git log -3 --oneline -- apps/app/src/hooks/useVoiceInput.ts git diff --check bb browser-automation open --backend local --headless --machine HOST_ID --json