Skip to content

feat(mobile): send chat messages when dictation ends - #32656

Closed
pelted wants to merge 15 commits into
stablyai:mainfrom
pelted:chris/mobile-dictation-auto-send
Closed

pelted wants to merge 15 commits into
stablyai:mainfrom
pelted:chris/mobile-dictation-auto-send

Conversation

@pelted

@pelted pelted commented Oct 23, 2026 •

Copy link
Copy Markdown

Stacked on #32103 (desktop setting), so this diff includes it until it is accepted and merged.

ELI5

On the phone, after you dictate into a chat, Orca can now send the message for you. A small "Sending in 2s · Cancel" row appears above the chat box, and if you do nothing the message goes out. Typing, tapping Cancel, or dictating again keeps it as a draft. It follows the "Send when dictation ends" setting on the desktop, which is off by default.

What Changed

Before: dictated text landed in the mobile chat composer and you still had to tap Send.

After: with "Send when dictation ends" on in the paired desktop's Voice settings, a dictated transcript in the chat composer starts a countdown (the desktop's 1, 2, 3 or 5 seconds) and then sends through the composer's own Send.

Mechanism:

  • The speech setup reply (RuntimeMobileSpeechCatalog.list()) now carries autoSendAfterDictation and autoSendDelayMs. The phone reads both as optional, so a desktop that predates them reads as off.
  • The session screen owns one small countdown store (mobile-dictation-auto-send.ts). The session arms it when dictation starts and starts the countdown when that dictation's chat transcript lands, at most once per dictation.
  • The host setup read (refreshDictationMode, closeDictationSetup and their focus and foreground refresh) moves unchanged from use-mobile-session-native-chat-dictation.ts into use-mobile-dictation-host-setup.ts, where it also reads the two new fields. The session hook was already at its 300-line limit on main.
  • The composer reads the store with useSyncExternalStore, shows the countdown, and supplies its own handleSend as what the countdown fires. If no composer is mounted when it fires, nothing is sent.
  • These cancel it and keep the draft: typing, tapping into the field, Cancel, Send (which sends once), dictating again, switching chats, leaving the screen, and backgrounding the app. A transcript that arrives after the user left the screen, the app or the chat stays a draft.
  • Screen readers hear "Sending message in N seconds. Tap Cancel to keep it as a draft." once: through a polite live region on the served page and Android, and the one-time announcement on native iOS. The ticking seconds are hidden from screen readers. The row and the announcement are translated in all 11 mobile locales.
  • Terminal dictation is unchanged and never auto-sends. Neither does dictation into an inline queued-message edit, where Send saves the edit.

Why

Issue #12157 calls mobile the primary use case: tap the mic, tap again, wait, tap Send. Reading the desktop's setting through the existing setup reply keeps one switch for both, with no new RPC. Sending through the composer's own Send keeps one submit path, so attachments, slash commands and send fencing behave exactly as a tap on Send does.

Linked Issue

Part of #12157 (mobile chat composer). Built on top of #32103 which adds the desktop side of this. I believe Terminal panes require more discussion before enabling auth-send.

Visual Proof

Before:
https://github.com/user-attachments/assets/1072a113-f077-40b4-9945-8280febd85e2

After:
https://github.com/user-attachments/assets/da51794c-80e6-43f9-8222-d403562152c4

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Manual: the countdown sends the dictated message on an iPhone with the App Store app (see the After video), paired with a dev desktop built from this branch, which serves the session screen bundle (pnpm run build:mobile-web, then pnpm dev). Not tested on Android.

Automated:

  • Composer: the countdown sends through Send; tapping into the field (also when it already has focus), Cancel and typing each keep the draft (asserted on the rendered draft); a manual Send during the countdown sends once; switching chats or unmounting sends nothing; the announcement fires once.
  • Session hook (real hook over the real dictation hook and a fake desktop): a transcript starts the countdown with the desktop's delay; dictating again cancels it; an older desktop starts nothing; a transcript held back until after backgrounding, blurring the screen or switching chats stays a draft. These three failed before the fix.
  • Desktop: the setup reply carries the setting, defaults to off and 2 seconds, and falls back to the default for an unknown delay.

Checks run locally on macOS, on top of upstream def1565846:

  • pnpm lint, pnpm typecheck and pnpm run check:code-quality:changed pass.
  • Mobile: typecheck for the app and tests (including the tests typecheck ratchet), lint, format check and rpc:diff pass, and vitest passes for src/session and src/dictation. The full mobile run has one failing file, src/tasks/mobile-agent-launch-architecture.test.ts, which fails the same way on unmodified upstream main.
  • pnpm test: the dictation, native chat, settings and speech catalog 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 upstream main on this machine, and the 3 others passed when rerun alone (one, a file-timestamp test, only on some runs).
  • pnpm build: the desktop build and pnpm run build:mobile-web pass. 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 and review this change.

Review

  • Cross-platform: mobile and the desktop runtime only. The countdown uses no platform branch except the iOS-native announcement; the served page uses a live region.
  • Remote/SSH and mixed versions: the two new reply fields are optional on both sides. An older desktop reads as off on a newer phone, and an older native app ignores them. The session screen bundle is served by the desktop, so an older App Store app paired with a newer desktop gets the countdown too.
  • Agents and integrations: provider-neutral; it sends exactly what the Send button sends.
  • Performance: one timer and a 250 ms display tick exist only while a countdown runs.
  • Security: no new permissions or RPC. A send only fires from the mounted composer of the chat the words were dictated into.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Off by default. Nothing changes until the desktop setting is turned on.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@pelted
pelted force-pushed the chris/mobile-dictation-auto-send branch from 90c2578 to dd3fa19 Compare October 25, 2026 18:53
@pelted
pelted marked this pull request as ready for review October 25, 2026 18:53
@pelted
pelted requested a review from brennanb2025 as a code owner October 25, 2026 18:53
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
Walkthrough

The change adds configurable dictation auto-send for desktop and mobile chat. Voice settings define whether auto-send is enabled and the delay. Desktop dictation tracks transcript delivery and session outcomes before starting a countdown for an eligible editor. Mobile dictation starts a countdown after transcript insertion in native chat. Both implementations support cancellation and avoid sending in specified interruption or ineligible-target cases.

Merge Risk: Moderate · previous review e45b7

With "Send when dictation ends" enabled, a dictated draft can be sent automatically while the user is opening the attachment menu or editing a queued message. Withdraw the pending countdown in both interactions before merging. The setting is off by default, which limits exposure.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: mobile chat messages are sent when dictation ends.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The pull request description is complete and follows the repository template. It explains the user-visible change, implementation, rationale, linked issues, visual proof, testing, AI use, compatibilit…
Full details: Description check

Explanation

The pull request description is complete and follows the repository template. It explains the user-visible change, implementation, rationale, linked issues, visual proof, testing, AI use, compatibility considerations, known test limitations, and checklist status. The issue references use “Part of #12157” and “Built on top of #32103” instead of a “Fixes #” entry, but they identify the relevant issues clearly.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@pelted
pelted force-pushed the chris/mobile-dictation-auto-send branch from dd3fa19 to e2e55ce Compare October 26, 2026 15:15

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 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: 111382ca-bf47-48b2-91ca-03e3eeff16bd
Commits

Reviewing files that changed from the base of the PR and between dd3fa19 and e2e55ce.

Files selected for processing: 7
  • mobile/src/session/MobileNativeChatOverlay.tsx
  • mobile/src/session/MobileNativeChatView.tsx
  • mobile/src/session/native-chat/composer/MobileNativeChatComposer.dictation-auto-send.test.ts
  • mobile/src/session/native-chat/composer/MobileNativeChatComposer.tsx
  • mobile/src/session/native-chat/composer/mobile-native-chat-composer-styles.ts
  • mobile/src/session/use-mobile-session-native-chat-dictation.ts
  • src/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.

Comment on lines +118 to +122
// Typing and every menu pick edit through here; dictation writes the draft from above.
onChangeText: (next) => {
dictationAutoSend?.withdraw()
onChangeText(next)
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Functional Correctness · Quick win

Cancel auto-send when the user opens attachment controls.

If the user opens the structured composer’s attachment menu during the countdown, attachPress only sets attachOpen. The timer can then call handleSend while the user is choosing an attachment, sending the dictated text before the attachment is added. Withdraw auto-send when attachment controls open, and cover that interaction in a test.

@pelted
pelted force-pushed the chris/mobile-dictation-auto-send branch 2 times, most recently from 0c41bc9 to 64561b3 Compare October 28, 2026 14:43

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 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: 6b4e74eb-6c8d-43ef-bb93-ad9dbadce360
Commits

Reviewing files that changed from the base of the PR and between 64561b3 and e45b772.

Files selected for processing: 2
  • mobile/src/session/native-chat/composer/MobileNativeChatComposer.dictation-auto-send.test.ts
  • mobile/src/session/native-chat/composer/MobileNativeChatComposer.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Comment on lines +285 to +290
onFocus={autoSend.withdrawBefore(() => {
setFocused(true)
if (draftScopeKey) {
focusMobileNativeChatTextDestination(draftScopeKey)
}
}}
})}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Functional Correctness · Heavy lift

Cancel the main countdown when inline queued-message editing takes focus.

This callback withdraws only the controller for the focused composer. The queued editor uses a queued-edit: surface, so its controller is null, while the main composer and its countdown remain mounted. If the user opens queued-message editing during a countdown, the timer can still call the main composer’s handleSend and send the chat draft. Withdraw the session controller when the queued editor gains focus, and add a regression test for this interaction. (raw.githubusercontent.com)

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change affects chat dictation on desktop and mobile.

Fix automatic sending after dictation errors before merging.

Findings

  1. P1 Failed dictation sends unfinished words ▶

Summary

Adds optional automatic sending after chat dictation on mobile, alongside the desktop setting and countdown.

  • Desktop chat dictation can send after a cancelable countdown.
  • Mobile chat sends dictated text after a cancelable countdown.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Start chat dictation] --> B[Arm automatic send]
  B --> C{Transcript source}
  C -->|Successful finish| D[Insert words into draft]
  C -->|Failure with saved words| D
  D --> E[Start countdown]
  E --> F[Composer Send]
  E -->|User cancels or leaves| G[Keep draft]
  C -->|Failure| H[Show error without cancelling countdown]
Loading

Reviews (1) · Last reviewed commit: "feat(mobile): send chat messages when di..." · Reviewed by Greptile

Comment on lines +152 to +153
} else if (hostSetup.autoSendSettingRef.current.enabled) {
dictationAutoSend.startIfArmed(hostSetup.autoSendSettingRef.current.delayMs)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Failed dictation sends unfinished words

When dictation fails after receiving some words, failActiveDictation passes the saved partial text to onTranscript before calling onError. This branch starts the send countdown for that text, and onError never withdraws it. A slow connection or dropped audio can therefore send an unfinished message after showing a dictation error.

Only start the countdown after a successful finish, or withdraw it when dictation reports an error.

@pelted
pelted force-pushed the chris/mobile-dictation-auto-send branch from 9fae7f4 to bec3af4 Compare October 30, 2026 16:09
pelted added 14 commits November 4, 2026 12:15
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.
The phone follows the desktop "Send when dictation ends" setting: a dictated
chat draft sends after the desktop's delay unless the user takes over first.

The host dictation setup read moves into useMobileDictationHostSetup, which
also reads the auto-send setting, so the session hook stays under the line
limit.
@pelted
pelted force-pushed the chris/mobile-dictation-auto-send branch from bec3af4 to 9e1a781 Compare November 4, 2026 21:19
@pelted

pelted commented Nov 11, 2026

Copy link
Copy Markdown
Author

Closing this: #32103 was replaced by #41198, and I'll redo the phone side on top of it.

@pelted pelted closed this Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant