Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough
Merge Risk:
|
be698bb to
fb0ddc5
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Cancel the pending auto-send synchronously when dictation… · use-dictation-auto-send.ts:74-80
src/renderer/src/components/dictation/use-dictation-auto-send.ts:74-80
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winCancel the pending auto-send synchronously when dictation starts.
DICTATION_CONTROL_EVENTcan callstartDictation()while the controller is idle. The current cancellation runs later in thedictationState === 'starting'effect. The existing timer can expire before that effect runs, dispatchdictation:submit, and make the native composer send its current draft.Dispatch
DICTATION_CANCEL_AUTO_SEND_EVENTat the start ofstartDictation(), after validation and before changing the dictation state. All start paths converge there.Suggested fix
import { useHoldDictationGesture } from './use-hold-dictation-gesture' import { DICTATION_CONTROL_EVENT, type DictationControlAction } from './dictation-control-events' import { publishDictationMeter } from './dictation-meter-store' +import { DICTATION_CANCEL_AUTO_SEND_EVENT } from './dictation-auto-send' import { useDictationAutoSend } from './use-dictation-auto-send' ... if (!settings?.voice?.enabled) { toast('Voice dictation is disabled. Enable it in Settings > Voice.') return } + document.dispatchEvent(new Event(DICTATION_CANCEL_AUTO_SEND_EVENT)) const runId = dictationRunRef.current + 1
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
427a3c16-401b-437a-ba4f-707cb2e3316e
📥 Commits
Reviewing files that changed from the base of the PR and between be698bb58108a0c1dac991421758ddef50955b62 and fb0ddc5fc062b9662b9da1ee55026557a35dec3b.
📒 Files selected for processing: 2
src/renderer/src/components/native-chat/NativeChatComposerField.tsxsrc/renderer/src/i18n/locales/en.json
🚧 Files skipped from review as they are similar to previous changes: 1
- src/renderer/src/i18n/locales/en.json
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Cancel pending auto-send before persisting voice settings. · use-dictation-auto-send.ts:112-116
src/renderer/src/components/dictation/use-dictation-auto-send.ts:112-116
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winCancel pending auto-send before persisting voice settings.
VoicePane.updateVoiceSettingsstarts the asynchronous settings write without canceling the active countdown. The persistence helper awaitswindow.api.settings.set(...)before publishing the new settings, so the hook's cancellation effect can run only after that write completes. The countdown can expire first, dispatchdictation:submit, and send the draft.Dispatch
DICTATION_CANCEL_AUTO_SEND_EVENTbeforeupdateSettingswhenenabledorautoSendAfterDictationbecomesfalse.Suggested fix
+import { DICTATION_CANCEL_AUTO_SEND_EVENT } from '../dictation/dictation-auto-send' const updateVoiceSettings = useCallback( (updates: Partial<VoiceSettings>): void => { + if (updates.enabled === false || updates.autoSendAfterDictation === false) { + document.dispatchEvent(new Event(DICTATION_CANCEL_AUTO_SEND_EVENT)) + } updateSettings({ voice: { ...voiceSettingsRef.current, ...updates } }) }, [updateSettings] )
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
5758795c-a894-4903-9b64-8576403781d0
📥 Commits
Reviewing files that changed from the base of the PR and between fb0ddc5fc062b9662b9da1ee55026557a35dec3b and 9deb6c652cbf163d90b6a36ccbf98363bcb0b30b.
📒 Files selected for processing: 7
src/renderer/src/components/dictation/DictationController.tsxsrc/renderer/src/components/dictation/dictation-auto-send.test.tssrc/renderer/src/components/dictation/dictation-auto-send.tssrc/renderer/src/components/dictation/use-dictation-auto-send.test.tsxsrc/renderer/src/components/dictation/use-dictation-auto-send.tssrc/renderer/src/components/native-chat/use-native-chat-dictation-submit.test.tssrc/renderer/src/components/native-chat/use-native-chat-dictation-submit.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
33c182b to
65009e8
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Minor · Settle the watcher on startup and speech-error exits. · DictationController.tsx:260-267
src/renderer/src/components/dictation/DictationController.tsx:260-267
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winSettle the watcher on startup and speech-error exits.
stopDictationdiscards the reporter returned bywatchAutoSend. If startup then enterscatch, oronErrorhandles a speech error, neither path reports an outcome before clearing the target and resetting the session. The delivery promise therefore stays pending, so auto-send never reaches a settled no-send result and the element’s takeover, blur, and visibility listeners can remain installed.Route both error paths through one helper that resolves the pending reporter with
{ finalTranscriptReceived: false, sessionErrored: true }before clearing the target.

Minor · Cancel the watcher on pointer activity outside the composer. · dictation-auto-send.ts:109-113
src/renderer/src/components/dictation/dictation-auto-send.ts:109-113
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winCancel the watcher on pointer activity outside the composer.
USER_TAKEOVER_EVENTSincludesfocusout, but the watcher registers those events only on the composer element. A click on a non-focusable area outside the composer can leave focus unchanged, so nofocusoutoccurs. The countdown then reaches its timer and dispatchesdictation:submit, which routes the message to the composer instead of honoring the stated click-away cancellation behavior.Suggested fix
const handleUserEvent = (event: Event): void => { if (event.type === 'input' && !countingDown) { return } @@ } settle() } + const handleOutsidePointerDown = (event: Event): void => { + if (event.target instanceof Node && element.contains(event.target)) { + return + } + settle() + } const startCountdown = (): void => { @@ window.removeEventListener('blur', handleAppLeave) document.removeEventListener('visibilitychange', handleAppLeave) + document.removeEventListener('pointerdown', handleOutsidePointerDown, true) options.onSettled() @@ window.addEventListener('blur', handleAppLeave) document.addEventListener('visibilitychange', handleAppLeave) + document.addEventListener('pointerdown', handleOutsidePointerDown, true)

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
11d01417-bea7-4791-95d7-164e11f791e1
Files selected for processing: 3-
src/renderer/src/components/native-chat/NativeChatComposerField.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/shared/constants.ts
Files skipped from review as they are similar to previous changes: 1-
- src/renderer/src/i18n/locales/en.json
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
4bfa0d0 to
600e4c2
Compare
[Medium impact] The change affects sending in the desktop native chat composer. Fix suggestion clicks before merging so editing a dictated message reliably stops automatic sending. Findings
SummaryAdds opt-in automatic sending after desktop chat dictation ends.
|
| let settled = false | ||
| let countingDown = false | ||
| let timer: number | undefined | ||
| const listenedEvents = [...USER_TAKEOVER_EVENTS, 'input'] as const |
There was a problem hiding this comment.
Clicking a mention or skill suggestion during the countdown changes the draft without canceling the send. PickerOptionButton prevents focus from leaving the editor, and completion changes the draft through code rather than a DOM input event. None of the watched events fires, so the edited message still sends at the original deadline, even while the user is reviewing it.
Cancel the pending send when the user picks a suggestion, or watch draft changes while excluding dictation’s own inserts.
600e4c2 to
0227721
Compare
Add an opt-in Voice setting, "Send when dictation ends", with a 1, 2, 3 or 5 second delay. When dictation into the native chat composer stops, the dictation pill counts down and then sends through the composer's normal send path, as if Enter were pressed. Typing in the composer, moving focus away, pressing Cancel in the pill, or starting dictation again cancels the send and keeps the draft. Terminal panes and other inputs never auto-send, and a session with no speech or an error does not start a countdown. Part of stablyai#12157 (desktop composer only).
The dictation submit hook wrote its latest send into a ref during render. useEffectEvent gives the listener the current send without a render-time ref write.
Two ways auto-send could still send after the user stepped in: - Switching to another app can keep the editor as the active element, so no focusout fired and the countdown sent anyway. The countdown now also stops on window blur and a hidden page, and checks that Orca has focus before it starts and before it sends. - Takeover was only watched after the recognizer's stopped event, so typing while the final transcript was still on its way went unseen. The watch now starts when stopping begins, and the session outcome decides afterward whether there is anything to send. The submit test now keeps its refs stable across renders, so it fails if the hook reads a stale send.
Stopping while the mic was still starting took a separate path that only began watching for takeover once startup finished, so typing or leaving Orca in that interval was forgotten. The watch now starts wherever Stop is first accepted, once per dictation, and the finish step reports the outcome to that same watch.
…ide act insertText now returns its delivery promise, which act would otherwise treat as an unawaited async callback.
0227721 to
94af229
Compare
|
Thanks for this, @pelted. Since you opened it, #40226 landed: pressing Enter or Send while you're still dictating now waits for the words to land and then sends once. Sending automatically after a countdown is still a good idea. We'd want to build it on top of that new send queue, though, and this branch no longer fits the new dictation pill, so I'm closing it for now. Thank you for the work and the idea. |
ELI5
When you dictate a message into the chat box, Orca can now send it for you. After you stop talking, a small countdown shows "Sending in 2s" with a Cancel button. If you do nothing, the message sends. If you type, click away, press Cancel or start talking again, it stays as a draft. The setting is off by default.
What Changed
Before: dictation put the transcript in the chat composer, and you still had to press Enter to send it.
After: with Settings > Voice > "Send when dictation ends" turned on, stopping dictation into the native chat composer starts a short countdown (1, 2, 3 or 5 seconds, default 2) in the dictation pill. When it ends, the composer sends through its normal
send, the same path Enter uses, so goal mode, Orca/commands and image attachment holds behave as they do today.Mechanism:
insertTextnow resolvestrueonly when all of the dictated text landed in the field. In a contenteditable editor withoutexecCommand, the fallback inserts only at a caret inside that editor and reportsfalseotherwise. The countdown starts only after every insertion for the session was delivered and the composer still has focus. This keeps a skipped insertion from sending an older draft.armDictationAutoSendlistens on the composer editor from the moment dictation stops. A key press, paste, drop, IME composition or focus leaving the editor cancels it, including while the text is still landing. Edits cancel only once the countdown runs, since dictation's own insertion firesinput.useDictationAutoSendowns the one pending send and also cancels it when dictation starts again, when the setting or voice is turned off, and on the pill's Cancel button.data-dictation-auto-sendmarker. Adictation:submitevent reaches only the composer that owns that editor.Why
Issue #12157 asks for an opt-in way to send when dictation finishes, to remove the extra Enter after every dictated message. The delay with an obvious way out keeps a misheard transcript from going out by accident, which was the main concern raised in the issue thread. Sending through the composer's own
sendkeeps one submit path instead of adding a second one that could drift.This PR covers the desktop native chat composer only. Terminal panes and mobile are left for follow-ups: terminals because an automatic Enter can run a shell command, and mobile because it has its own composer and dictation flow.
Linked Issue
Part of #12157 (desktop composer). The issue also asks for terminal panes and mobile, which this PR does not cover. #32105 (merged) lets mobile start dictation from agent chat tabs, and #32656 adds the mobile side of this setting on top of this PR.
Visual Proof
Before: the Voice settings pane has no auto-send row, and the dictation pill disappears when dictation stops.
After:
Pill update when dictation stops:

Testing
Tested on macOS in a dev build with real dictation: the message sends after the delay; typing, clicking away, Cancel and starting dictation again keep the draft; Enter during the countdown sends once; dictating into a terminal never sends. Not tested on Linux or Windows; the change has no platform-specific code. Not tested over SSH; the send uses the composer's existing send path.
New tests cover the countdown (delivery gating; a key press, paste, edit, focus leaving, window blur or the page being hidden, while the text lands and while counting down; Cancel; a removed editor), contenteditable insertion through the real
insertText(a caret in the editor sends, no caret or a caret outside it keeps the draft), the eligibility rules (setting off, no speech, errored session, terminal, non-composer field), and submit routing to the right composer when two are mounted. Starting dictation again and turning the setting off during a countdown have no automated test; the first was checked by hand.Checks run locally on macOS, rebased on
def1565846:pnpm lint,pnpm typecheckandpnpm run check:code-quality:changedpass.pnpm test: the dictation, native chat and settings suites pass. On the previous base (a6fdeda541), the full run failed in main-process, git, daemon and cross-version wire tests that need real processes or built artifacts. Those 68 files failed the same way on unmodified upstreammainon this machine, and the 3 others passed when rerun alone (one, a file-timestamp test, only on some runs).pnpm build: the desktop build passes. The native macOS computer-use helper step fails on this machine because its code-signing identity matches two certificates in the keychain; this PR touches no native code.AI Disclosure
An AI coding agent helped write tests and review this change.
Review
Switch,SelectandButtonprimitives and existing tokens. Checked in light and dark mode. The countdown is announced once to screen readers instead of every second.Agent skill upstream boundary
Notes
No mobile or remote protocol changes. The setting is off by default, so existing behavior is unchanged until a user turns it on.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)