Repository navigation
Conversation
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds a substantial microphone dictation workflow with external transcription and cleanup calls, persisted provider settings, and macOS permission/entitlement changes. It also introduces product defaults and has unresolved substantive findings around recorder lifecycle and settings behavior, so the blast radius warrants human review. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42d65eb025
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| void (async () => { | ||
| try { | ||
| const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); |
There was a problem hiding this comment.
Configure macOS microphone access before calling getUserMedia
In the packaged macOS desktop client, this capture request has no corresponding NSMicrophoneUsageDescription in the macOS build configuration (scripts/build-desktop-artifact.ts:2622-2642) and the signed entitlement document also omits com.apple.security.device.audio-input (scripts/build-desktop-artifact.ts:1286-1317). Consequently, the main desktop surface cannot obtain microphone access reliably even though it exposes the dictation control; add the usage description and signed audio-input entitlement as part of this feature.
AGENTS.md reference: AGENTS.md:L70-L70
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed: macOS desktop packaging now declares NSMicrophoneUsageDescription and the audio-input entitlement. (agent on behalf of Yclpaiva)
| dictationEnabled && | ||
| pendingPrimaryAction === null && | ||
| !(pendingUserInputs.length === 0 && showPlanFollowUpPrompt) |
There was a problem hiding this comment.
Keep the stop control available through pending states
If another client starts work on the same thread while this client is recording and the provider then requests user input, pendingPrimaryAction becomes non-null and this condition removes the microphone button; the shortcut handler also refuses activePendingProgress, approvals, and other pending states. The MediaRecorder therefore continues capturing with no available stop action until the remote state clears, potentially retaining an unbounded recording in memory. Keep the stop/cancel affordance available whenever dictation.phase is not idle, regardless of composer state.
AGENTS.md reference: AGENTS.md:L73-L74
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed: same as above — stop stays available through pending states via the mounted control and shortcut path. (agent on behalf of Yclpaiva)
| useEffect(() => { | ||
| onTranscriptRef.current = onTranscript; | ||
| onErrorRef.current = onError; | ||
| }, [onTranscript, onError]); |
There was a problem hiding this comment.
Bind an in-flight transcript to its original composer
When the user changes threads or environments while recording or transcribing, ChatComposer remains mounted and this effect replaces onTranscriptRef with the callback for the newly active composer. Completion then inserts speech recorded for the old thread into the new thread's draft. Capture the original composer target for each recording or cancel dictation when that target changes instead of retargeting the callback mid-flight.
AGENTS.md reference: AGENTS.md:L74-L74
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed: recordings are bound to their composer target key — switching threads mid-flight cancels the session instead of inserting into the new draft. (agent on behalf of Yclpaiva)
There was a problem hiding this comment.
Fixed: recordings are bound to their composer target key — switching threads mid-flight cancels the session. (agent on behalf of Yclpaiva)
| const cleaned = typeof content === "string" ? content.trim() : ""; | ||
| if (cleaned.length === 0) { | ||
| throw new Error("Cleanup returned empty output. Using the raw transcript."); | ||
| } | ||
| return cleaned; |
There was a problem hiding this comment.
Handle the cleanup prompt's EMPTY sentinel
With cleanup enabled by default, the supplied system prompt explicitly tells the model to return EMPTY for filler-only recordings, but this code accepts that sentinel as ordinary nonempty text. A user who records only hesitation or silence therefore gets the literal word EMPTY inserted into the composer. Recognize the sentinel and treat it as no transcript rather than returning it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed: the cleanup EMPTY sentinel is now treated as no transcript (falls back to raw, never inserts the literal word). (agent on behalf of Yclpaiva)
There was a problem hiding this comment.
Fixed: the cleanup EMPTY sentinel is now treated as no transcript (falls back to raw, never inserts the literal word). (agent on behalf of Yclpaiva)
| discardedRef.current = true; | ||
| setDraft(null); | ||
| event.currentTarget.blur(); |
There was a problem hiding this comment.
Clear both textarea draft states when Escape discards
handleChange writes the edit into both this component's draft and useCommitOnBlur's internal draft, but the Escape path clears only the former and deliberately skips bag.onBlur(). After blur, value={draft ?? bag.value} immediately reveals the supposedly discarded text again, and that stale internal draft can survive upstream value changes. Use a single draft owner or explicitly reset the hook's draft when discarding.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed: single draft owner — Escape clears the only draft, nothing stale survives. (agent on behalf of Yclpaiva)
There was a problem hiding this comment.
Fixed: single draft owner — Escape clears the only draft, nothing stale survives. (agent on behalf of Yclpaiva)
| const markup = renderToStaticMarkup( | ||
| <ComposerDictationButton phase="requesting" disabled={false} onToggle={() => {}} />, | ||
| ); | ||
| expect(markup).toContain("disabled"); | ||
| expect(markup).toContain('aria-label="Waiting for microphone..."'); |
There was a problem hiding this comment.
Exercise dictation behavior instead of static markup
This test renders the component to static HTML solely to assert disabled and aria-label attributes, so it cannot validate that clicking actually toggles recording or that the stop action remains usable across phase changes. Replace it with a behavioral test that exercises the observable interaction; the repository explicitly disallows static-markup prop and attribute assertions.
AGENTS.md reference: AGENTS.md:L106-L108
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed: replaced the static-markup test with a behavioral react-test-renderer test covering click-to-toggle, recording stop label, and requesting disabled state. (agent on behalf of Yclpaiva)
There was a problem hiding this comment.
Fixed: replaced the static-markup test with a behavioral react-test-renderer test covering click-to-toggle, recording stop label, and requesting disabled state. (agent on behalf of Yclpaiva)
| recorder.addEventListener("dataavailable", (event: BlobEvent) => { | ||
| if (event.data.size > 0) chunksRef.current.push(event.data); | ||
| }); | ||
| recorder.addEventListener("stop", () => { | ||
| const mimeType = recorder.mimeType || pickRecordingMimeType() || "audio/webm"; | ||
| const audio = new Blob(chunksRef.current, { type: mimeType }); |
There was a problem hiding this comment.
🟡 Medium hooks/useComposerDictation.ts:369
An old recorder's queued stop event can consume the new session's chunksRef and call teardownCapture(), terminating the new microphone stream and losing its recording after an immediate restart or target change. Because MediaRecorder.stop() dispatches asynchronously, guard both recorder event handlers against recorderRef.current !== recorder before touching shared state.
recorder.addEventListener("dataavailable", (event: BlobEvent) => {
- if (event.data.size > 0) chunksRef.current.push(event.data);
+ if (recorderRef.current !== recorder) return;
+ if (event.data.size > 0) chunksRef.current.push(event.data);
});
recorder.addEventListener("stop", () => {
+ if (recorderRef.current !== recorder) return;
const mimeType = recorder.mimeType || pickRecordingMimeType() || "audio/webm";
const audio = new Blob(chunksRef.current, { type: mimeType });🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/hooks/useComposerDictation.ts around lines 369-374:
An old recorder's queued `stop` event can consume the new session's `chunksRef` and call `teardownCapture()`, terminating the new microphone stream and losing its recording after an immediate restart or target change. Because `MediaRecorder.stop()` dispatches asynchronously, guard both recorder event handlers against `recorderRef.current !== recorder` before touching shared state.
| export function DraftTextarea({ value, onCommit, ...rest }: DraftTextareaProps) { | ||
| const [draft, setDraft] = useState<string | null>(null); | ||
| const discardedRef = useRef(false); | ||
| const focusedRef = useRef(false); |
There was a problem hiding this comment.
🟡 Medium ui/draft-textarea.tsx:25
Pressing Ctrl/Cmd+Enter persists the edited value twice, because commit(draft ?? value) runs from the shortcut and then runs again from the synchronous onBlur handler. This causes each edited settings value to trigger onCommit twice; set a blur-suppression flag for the shortcut and clear it in handleBlur.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/components/ui/draft-textarea.tsx around line 25:
Pressing Ctrl/Cmd+Enter persists the edited value twice, because `commit(draft ?? value)` runs from the shortcut and then runs again from the synchronous `onBlur` handler. This causes each edited settings value to trigger `onCommit` twice; set a blur-suppression flag for the shortcut and clear it in `handleBlur`.
| // An in-flight session is always stoppable, even if the setting | ||
| // flipped or a pending question landed mid-recording; the guards | ||
| // below only gate *starting* a new one. | ||
| if (dictationPhaseRef.current !== "idle") { |
There was a problem hiding this comment.
🟡 Medium chat/ChatComposer.tsx:4169
Pressing the dictation shortcut while phase is "requesting" does not cancel the pending permission request, so granting permission afterward starts an unwanted recording. This branch calls dictationToggleRef.current(), but useComposerDictation.toggle() only stops when its captured phase is "recording"; make the pending request cancellation-aware so a second shortcut prevents recording from starting.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/components/chat/ChatComposer.tsx around line 4169:
Pressing the dictation shortcut while `phase` is `"requesting"` does not cancel the pending permission request, so granting permission afterward starts an unwanted recording. This branch calls `dictationToggleRef.current()`, but `useComposerDictation.toggle()` only stops when its captured phase is `"recording"`; make the pending request cancellation-aware so a second shortcut prevents recording from starting.
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
|
Note This comment is posted by Julius' dot This introduces browser recording, external transcription and cleanup calls, a new settings section, and microphone permissions. Those implement a new dictation workflow, but the PR and discussion contain no maintainer approval of its direction and scope, as required by prior approval. Please agree on that workflow in an Ideas discussion, link the approval, then request reconsideration. |
What Changed
Dictation (Beta): microphone button next to the composer send button. Records via
MediaRecorder, transcribes through an OpenAI-compatible/audio/transcriptionsendpoint (default Groq +whisper-large-v3-turbo), optionally polishes with a chat-model cleanup pass (freeflow-inspired pipeline), and inserts the result as an editable composer draft. New global keybinding commandcomposer.dictate(defaultmod+shift+D, remappable in Settings → Keybindings).New Settings → Dictation (Beta) tab: enable toggle, API key (client-only, never hits the T3 server), base URL, transcription model, language, plus a Cleanup section (toggle, model, custom vocabulary, editable system prompt with reset).
Why
Voice input for the composer without a monthly subscription or server-side secrets — audio and API key stay between the browser and the user's own transcription provider, following the freeflow model (used as reference, reimplemented from scratch for the web).
UI Changes
Dictation (Beta) settings tab
Mic button next to send
Composer: DictatekeybindingChecklist
Note
Add dictation beta to chat composer with mic button, settings, and shortcut
ComposerDictationButtontoComposerFooterPrimaryActionsand wiresuseComposerDictationinChatComposerto record, transcribe, and append text; a default modifier-Shift-D shortcut toggles dictation outside terminal focusDictationSettingsPanelwith provider key, base URL, model, language, and optional transcript cleanup configuration; credentials stay browser-local via client settingsuseComposerDictationhook handling mic permissions,MediaRecorderlifecycle, abort/cancel, direct browser upload to an OpenAI-compatible transcription endpoint, and optional cleanup pass with raw-transcript fallbackClientSettingsSchemafields andDraftTextareafor multiline settings editing; registers settings search entries and macOS microphone entitlements for desktop buildsaudio-inputentitlement andNSMicrophoneUsageDescriptionMacroscope summarized 40f012a.