Repository navigation
Add voice transcription retries and preserve fallback billing - #4774
Merged
Merged
Conversation
This was referenced Oct 2, 2026
ymichael
added a commit
that referenced
this pull request
Oct 5, 2026
## Human comments ## What was wrong Navigating away during voice transcription cleared the pending send intent. The accepted recording continued, but the fallback only appended its transcript to the original draft. New-thread programmatic submission also retained an empty-draft readiness check after its composer unmounted. ## What changed Preserve voice send intent after unmount and submit through the originating composer host after updating its draft. Keep Add to draft behavior, cancellation, and the mounted composer path intact. Check new-thread input from the current draft at submission time, and await asynchronous transcript submission so failures use the voice error path and draft recovery. No public API, CLI, database, or server/daemon wire changes. Related PR #4774 changes the same voice hook for retries; this PR keeps that work separate. ## How you verified - Regression tests failed before repair for navigation losing send intent, detached new-thread submission rejecting newly populated input, and asynchronous submission failures not surfacing. - Final-head focused tests: 316 passed through Turbo. App typecheck, formatting and lint passed (lint: 0 errors, existing warnings). - Matched base/PR real-app QA with labelled synthetic speech fixture audio, real MediaRecorder/Codex transcription, and a delayed real response to ensure navigation unmounted the original composer. Both new-thread and follow-up sends preserve original destination, existing text and attachment. Add to draft remains unsent; cancellation and injected transcription failures never send; unmount/remount sends at most once. - Background submission error injection restores draft/attachments. Optimized final-head new-thread manual recovery succeeds once; empty new-thread and follow-up controls pass. - Persistent isolated optimized review fixture: https://ymichael--24571.getbb.app/threads/thr_krtagwujqs. No physical microphone or native-device coverage is claimed. - Final-head CI: 31 passed, 3 skipped, no failures or pending checks. > AGENT GENERATED
ymichael
force-pushed
the
bb/add-retry-button-support-thr_vagugikv8r
branch
2 times, most recently
from
October 5, 2026 17:04
d082f9f to
1108bdc
Compare
ymichael
force-pushed
the
bb/add-retry-button-support-thr_vagugikv8r
branch
from
October 5, 2026 17:19
1108bdc to
06b21b2
Compare
ymichael
added a commit
that referenced
this pull request
Oct 5, 2026
## Human comments ## What was wrong The composer exposed no direct microphone preferences, and a missing selected microphone only fell back to the system default when capture started. A microphone can remain enumerated while providing silence, so device presence alone could not establish usable input. ## What changed Add a microphone context popover on desktop and persistent drawer on mobile, with automatic local waveform preview and directly selectable inputs. Capture failures show a decorative badge on the idle mic; the full warning button opens preferences. Keep healthy click-to-record behavior. No composer chevron, header icon, recording-row mic control, new mobile gesture, or background audio monitoring. Visiting Settings changes the saved input without opening capture. Failed previews report Unavailable rather than retaining a Connecting label. Try the saved input, system default, then other inputs for missing/unreadable devices; preserve the saved preference and keep a stable recorder through active-input disconnect recovery. Release preview capture on close/navigation, including late permission results. Near-silence warns in the preview; recording silence is accessible status only after removal of the recording-row control. Healthy mobile idle discovery and a visible recording-silence affordance remain product decisions. No public SDK, CLI, database, or server/daemon wire changes. Browser-local selection remains documented. Overlaps with #4774 (transcription retry) and #4780 (voice send after navigation) in useVoiceInput/usePromptVoice; neither PR is incorporated here. ## How you verified - 192 relevant app tests passed through Turbo, plus app typecheck and lint (0 errors). - Browser checks of picker selection, simulated device disconnect recovery, near-silence, and preview release. Synthetic input/audio is explicitly labelled; no physical microphone or laptop-lid behavior is claimed. - Built base and final head with `pnpm start:worktree` in separate disposable stores. Matched real-app light-mode screenshots show the missing base picker/badge and new behavior; checked dark and Chromium touch emulation too. - After the Settings privacy fix, 8 affected component tests passed; typecheck and lint passed. Final one-line error-label behavior was rechecked in-browser and typechecked. - Real Codex transcription of synthetic spoken audio inserted text into the draft; preview-only capture never transcribes. - iOS Simulator Safari: deferred drawer rendering and non-inert root verified via DOM-click fallback. WebDriver tap did not activate the control and synthetic AudioContext remained gesture-blocked; real Safari touch/audio are not claimed. - Isolated review instance is configured and left running; canonical thread HANDOFF.md includes precise provenance, matched inline images, final CI matrix, reset/stop instructions, and outstanding discoverability choices. > AGENT GENERATED
ymichael
added a commit
that referenced
this pull request
Oct 5, 2026
## Human comments ## What was wrong The custom-answer field in question forms had no microphone input. Users could dictate into the composer but had to type their own answers to agent questions. ## What changed Add bb's voice input to the free-text answer in shared question forms, with the mic inside the answer field at the bottom right. Recording, transcription, and cancellation use the existing voice capture hook and transcription service. Transcripts append to the editable text; submission stays explicit. Navigation and submission wait while voice input is active, and a closed answer field ignores late transcripts. The field reserves space below its text for the controls, including narrow touch layouts. Transcripts go through the same state update as typed text, so they persist in the question form drafts from #4781. The answer-field microphone reuses the promptbox voice button, including right-click and Shift+F10 access to microphone preferences and capture-warning recovery. A local tooltip provider keeps the exported textarea self-contained. Expose it to plugins as a top-level host component, `experimental_VoiceInputTextarea` (`@get-bb/plugin-sdk/app`), next to `experimental_NewThreadComposer` and the pickers: - Controlled textarea: `value`, `onValueChange(value)`, optional `onVoiceInputActiveChange(active)`. Every other textarea attribute, including `ref` and `className`, reaches the inner `<textarea>`. The host owns the mic, waveform, cancel/stop controls, padding, and transcript appending, and renders a plain textarea when voice input is unsupported. - App implementation: `apps/app/src/components/promptbox/VoiceInputTextarea.tsx`, registered in the SDK app implementation. - Shared-ui `voice-input-textarea` module, which the shared question form renders. The plugin build shims it to the host's copy (new `voiceInputTextarea` runtime slot), like `question-form-host`, so the built-in Ask User Question and pi plugins get the host component. `ThreadQuestionFormHost` provides it. - Registry: new `voice-input-textarea` item whose plugin flavor re-exports the SDK component; `question-form` uses it. - Test harness: `renderSlot` renders a plain controlled textarea. - Docs: new `docs/api_to_audit.md` entry, Plugin Guide surfaces, and plugin-authoring references. Plugin SDK bumped to 0.6.23 above main's 0.6.22. Merge current main to resolve SDK-version and Plugin Guide conflicts and adopt its thread/new-thread route bundle measurements. Preserve the voice-input API symbols and keep guide bullets within the new copy constraints. The final branch uses main's byte limits without an increase. No CLI, daemon wire, or database changes. ## How you verified SDK version follow-up (`37125cb275`): bump both version declarations to 0.6.23 after main reached 0.6.22. SDK version tests, the public-surface version check, and app/desktop lockstep check pass locally. Voice-menu follow-up (`8df04c2f42`): app typecheck/lint, targeted `VoiceInputButton` and `QuestionForm` tests, and bundle budgets pass. In the rebuilt worktree app, right-click and Shift+F10 open voice preferences; opening the menu does not start dictation or hide/inert the app root. Physical microphone capture was not tested in the headless browser. CI repair on `5784b3dc13` after merging main: `pnpm exec turbo run build typecheck lint --filter=@bb/app --filter=@get-bb/plugin-sdk --filter=bb-plugin-plugin-api-docs` passed. `node apps/app/scripts/check-bundle-budget.mjs` passes within main's unchanged limits: boot 1360.7 KiB raw / 340.2 KiB brotli; thread page 1788.0 KiB raw / 516.0 KiB brotli; new-thread page 1066.9 KiB raw / 315.7 KiB brotli. `pnpm exec turbo run test --filter=@bb/app --filter=@get-bb/plugin-sdk --filter=bb-plugin-plugin-api-docs` also passed after merging main. The SDK-version check passes. Before the CI repair (rebased on 95750b8): - `pnpm exec turbo run typecheck lint test` for `@bb/app`, `@get-bb/plugin-sdk`, `@bb/plugin-build`, `@bb/plugin-registry`, `@bb/shared-ui`, `bb-plugin-plugin-api-docs`, `bb-plugin-ask-user-question`, and `bb-plugin-provider-pi`: typecheck passed, lint had 0 errors, and all tests passed (app 576 files, SDK 30, plugin-build 13, registry 1, Plugin Guide 13, Ask User Question 4, pi 28). - Server `plugin-authoring-docs` and `plugin-authoring-doc-examples` tests passed. - `.github/workflows/check-plugin-sdk-version.mjs` passes. - `QuestionForm.test.tsx` covers appending a transcript to the latest edited answer without submitting, ignoring late transcripts after the field closes, and blocking navigation and submission while transcription is pending. The earlier browser checks (recording, transcription, cancellation, injected errors, late-result isolation, screenshots on desktop and narrow touch, real recognition with a synthesized WAV) ran on the first version of this PR, before voice input moved into the host textarea component. They have not been repeated on the current head. Physical microphone and native-device/Safari coverage are not claimed. #4780 and #4774 change the shared voice hook; their scopes remain separate. > AGENT GENERATED --------- 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
Failed voice transcriptions offered only a recording download. The gateway stopped after a model timeout, and short timeouts across the voice service and account fetch prevented a slower model or fallback from finishing. Allowing fallback after a potentially billed failure also exposed an accounting bug: a final model refusal could erase the earlier attempt's billability and settle the request at zero cost.
What changed
Add Retry to the voice failure toast, reusing the original recording and prompt context, while retaining Download recording. Give each transcription model 30 seconds and fall back after errors. Extend the cloud fetch timeout to 65 seconds and the core voice timeout to 70 seconds; keep the default account fetch timeout at 15 seconds. Preserve unknown billable costs across fallback attempts so settlement charges the reserve even when the final model refuses. Update the account README, cloud AI skill, and API audit documentation. Bump the plugin SDK to 0.6.17 so its changed bundled declarations ship to npm. Make three existing UI tests wait for lazy content before asserting, removing failures caused by shuffled test order.
How you verified
Added a gateway regression for timeout followed by HTTP 503. It failed before the billing fix (spentMicros was 0 instead of 20000) and passed after the fix, with the reservation released.
Gateway suite: 29 tests passed through
pnpm exec turbo run test --filter=@bb/ai-gateway -- test/gateway.test.ts.Focused voice-hook, cloud AI, and account suites: 9, 24, and 51 tests passed through Turbo; voice-hook results were cached.
Turbo typechecks passed for the gateway, app, server, and both plugins; the latter four used cached results.
Formatting and
git diff --checkpassed.Rebased onto
origin/main(66a504cd79), preserving the awaited transcript callback added on main. After rebase: voice hook 10, gateway 29, cloud AI 24, and account 51 tests passed; affected app, gateway, server, and plugin typechecks passed.Browser sanity check before rebase: recorded synthetic audio, forced a transcription failure, clicked Retry, and confirmed the successful transcript appeared in the composer without sending.
Post-rebase production worktree smoke:
pnpm start:worktree --dryrunandpnpm start:worktreepassed; server and daemon health passed. In the built app, a synthetic recording returned an empty transcript, displayed Retry and Download recording, and clicking Retry retried transcription and displayed the failure again.CI repair: reproduced both Linux UI failures by running only those tests before component warm-up. The repaired tests pass in that order. A shuffled focused run exposed and verified the same repair in an archived-thread navigation test.
Replayed the failed app shard with CI seed
1791219922038: 1,860 tests passed, 5 skipped. Affected app/domain/SDK lint and typechecks passed. The npm version guard passed for SDK 0.6.17.Rebased onto main commit
4147566cb0during the CI repair.GitHub CI run 37347592862 passed in full after the fix, including Linux, macOS, and Windows jobs.