You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mobile): keep dictated words through calls, busy taps and failed inserts, and say why dictation failed - #35216
Dictating on the phone could lose what you said with no message: a phone call or Siri cut it off, a second tap on the mic while it was transcribing threw the result away, and a terminal that couldn't take the text just dropped it. Errors sometimes showed internal codes like dictation_already_active. Now an interruption keeps what you said, a tap while transcribing waits, text a target refuses goes to the clipboard with a toast saying so, and the codes read as sentences.
What Changed
Interruptions finish instead of cancelling (Phone dictation drops what you said when a call or Siri interrupts it #35207). Native began/blocked interruptions, plus the page capture's own losses (recording:false or a refused read), used to call cancel(). That is abandonDictation(null), the silent path reserved for the user's own cancel, so the audio already sent to the computer was never finished. In use-mobile-dictation.ts the interruption handler now finishes a recording dictation the same way stop does, and keeps the transcript. If nothing was transcribed, or the interruption lands while starting, the user sees "Voice dictation stopped because the microphone was interrupted. Try again." stop and the interruption share one finishDictation; only the empty-transcript message differs. An interruption while processing or idle is ignored.
A tap while processing waits (Tapping the mic while phone dictation is processing throws the transcript away #35208).handleDictationToggle used to cancel while processing. Cancelling bumps the generation, so the finish reply that came back was ignored. Now the tap does nothing until the finish settles, the same as a tap while starting. Long-press on the terminal mic still cancels on purpose. The terminal mic's accessibility label while processing changes from "Cancel voice dictation" to "Transcribing voice dictation".
Refused transcripts are kept (Phone dictation into a live terminal is lost when the insert fails #35209). When a terminal live insert fails (no handle, a failed flush, a switched tab, not connected, or a refused send), or the chat/queued-edit destination refuses the text, the transcript is copied to the clipboard and a toast says "Couldn't insert dictation, so it was copied to the clipboard". It used to just return.
Plain error messages (Phone dictation errors show raw codes like dictation_already_active #35210).dictationFailureMessage in mobile-dictation-setup.ts maps the host's dictation codes next to the existing speechless-server mapping. dictation_already_active becomes "Dictation is already in use on the computer or another phone." The three session-gone codes (dictation_owner_mismatch, dictation_stream_not_started, dictation_stream_closing) become "Dictation lost its connection to the computer. Try again." dictation_requires_mobile_client asks the user to re-pair the phone. Unknown messages pass through unchanged.
Why
Each fix is in the place that makes the decision. The interruption rule goes in useMobileDictation, because it owns the status, the dictation id and the finish/cancel calls. The capture seam only reports that the mic dropped. The clipboard fallback goes in the session hook where every dictation route ends. sendLiveTerminalInput also carries typed keystrokes, which must not land on the clipboard. The codes are wire identity that older phones match exactly (the setup-sheet codes, for one), so the host keeps sending codes and the phone translates them for display. Neither desktop nor mobile had a mapper to reuse. Desktop shows the same raw dictation_already_active when a phone holds the model; that's left for a follow-up, and the map should move to src/shared then rather than being copied.
One dictation at a time across the computer and phones is intended, since there's one speech model, so only the message changes.
No capture. The only visible changes are toast text and a transcript landing where it used to vanish. A real phone call or Siri interruption can't be triggered in the simulator, and the processing tap needs a paired computer with a speech model. Each case is proven in mobile-dictation-session-outcomes.test.tsx, which mounts the real session and dictation hooks over the native capture binding with a fake host. Every new case failed on main and passes here.
Testing
New mobile/src/session/mobile-dictation-session-outcomes.test.tsx covers: an interruption while recording sends finish (not cancel) and inserts the transcript; an empty interrupted transcript shows the interrupted message; a tap while processing keeps the transcript; a refused live insert copies to the clipboard with the toast; dictation_already_active toasts the sentence. It also absorbs the old mobile-dictation-refused-start-routing.test.tsx cases, so the two files share one harness. Every new case was run against main's production files and failed.
Ran every test file that imports or mocks a changed module (27 files), the dictation setup tests, and the mobile RPC recording goldens (mobile/src/test-support/rpc-recording, 1695 tests): all pass.
check:code-quality:changed and check:react-doctor:changed pass. CI runs typecheck and the full suite.
Not run on a device.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Codex and a Claude reviewer each reviewed one round. Codex found nothing. Claude raised one P2: in chat, the mic doesn't show a busy state while the transcript is processing, so a tap during a slow finish looks dead. That is left as a follow-up because it needs new composer UI in files #32656 also edits. Its two P3s (a delivery-ambiguous send reported as failed, and a double toast for an over-256 KiB transcript) were left as is.
CodeRabbit's Major (a rejecting flush or send skipped the fallback) is fixed in 8fc28d2, with a throwing-send test case. Its Minor (an unknown message named like an object prototype key) and Trivial (no second fallback when the clipboard refuses) were left as is.
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
Phone-only change, with no wire or host change, so mixed phone and computer versions behave as before apart from the new copy. Native capture (iOS/Android) and the OTA page capture share the same interruption handler. Terminal live and buffered input and the native chat/queued-edit destinations all go through the same fallback. Nothing here depends on the platform or on SSH vs local, and folder workspaces are unaffected.
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)
… failed inserts
A call, Siri or mic dropout now finishes the dictation instead of
discarding it, a tap while transcribing no longer cancels, a transcript
its target refuses is copied to the clipboard with a toast, and host
dictation error codes show as plain sentences.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
Walkthrough
Mobile dictation now finishes recording when the microphone is interrupted and reports an interruption message if no transcript is available. Dictation failures use mapped user-facing messages. If transcript delivery fails, the session attempts to copy the transcript and reports the result. Taps during processing no longer cancel dictation. Tests cover these behaviors and related start-refusal outcomes.
Priority: Normal
Severity of issue fixed: Medium
Merge Risk: Low · up to 8fc28
Unusual error messages may not display correctly. Clipboard refusal can still lose undelivered dictation, although recovery is improved overall.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly summarizes the main mobile dictation changes: retaining dictated text through interruptions and failed inserts, handling busy taps, and improving failure messages.
Linked Issues check
The PR meets the coding requirements for [#35207], [#35208], [#35209], and [#35210]. The interruption path now finishes recording and keeps the transcript, including microphone-drop cases. An empty in…
Out of Scope Changes check
The production changes remain within phone dictation handling. The shared finish path, processing accessibility label, failure-message mapping, clipboard fallback, route handling, and related test-har…
Description check
The description is complete and aligned with the required template. It explains the user impact, implementation, rationale, linked issues, visual-proof decision, testing, review notes, scope, and chec…
Full details: Linked Issues check
Explanation
The PR meets the coding requirements for [#35207], [#35208], [#35209], and [#35210]. The interruption path now finishes recording and keeps the transcript, including microphone-drop cases. An empty interrupted transcript uses the interruption message. A processing tap no longer cancels the active dictation. Failed live-terminal delivery and refused destination insertion copy the transcript and show a toast. dictationFailureMessage maps all five listed host codes to plain-language messages. The added session outcome tests cover these behaviors.
Full details: Out of Scope Changes check
Explanation
The production changes remain within phone dictation handling. The shared finish path, processing accessibility label, failure-message mapping, clipboard fallback, route handling, and related test-harness changes support [#35207] through [#35210]. The chat and queued-edit fallback extends the same failed-insert recovery behavior. No unrelated product area is shown in the supplied change summary.
Full details: Description check
Explanation
The description is complete and aligned with the required template. It explains the user impact, implementation, rationale, linked issues, visual-proof decision, testing, review notes, scope, and checklist. The linked issue references and visual-proof explanation satisfy the required information, despite not using full URLs or the exact N/A wording.
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 11 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches: 💡 1
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
When Clipboard.setStringAsync returns false or rejects, keepUndeliveredDictation only shows "Couldn't insert dictation". The transcript then has no recoverable destination. The toast correctly avoids claiming that the text was copied and signals that insertion failed.
No supplied contract requires a second destination when the clipboard itself refuses the write. Treat this as optional hardening, not a major issue.
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: 2ebe6859-94d3-4eba-b407-28681b1578ee
Commits
Reviewing files that changed from the base of the PR and between 3416bda and 5489a1f.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Preserve unknown messages that match object prototype keys.
If the host sends an unknown message such as constructor or toString, this lookup returns an inherited function instead of the message. showToast then receives a non-string value. Use an own-property check or a Map so unknown messages pass through unchanged. (raw.githubusercontent.com)
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
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.
ELI5
Dictating on the phone could lose what you said with no message: a phone call or Siri cut it off, a second tap on the mic while it was transcribing threw the result away, and a terminal that couldn't take the text just dropped it. Errors sometimes showed internal codes like
dictation_already_active. Now an interruption keeps what you said, a tap while transcribing waits, text a target refuses goes to the clipboard with a toast saying so, and the codes read as sentences.What Changed
began/blockedinterruptions, plus the page capture's own losses (recording:falseor a refused read), used to callcancel(). That isabandonDictation(null), the silent path reserved for the user's own cancel, so the audio already sent to the computer was never finished. Inuse-mobile-dictation.tsthe interruption handler now finishes a recording dictation the same way stop does, and keeps the transcript. If nothing was transcribed, or the interruption lands while starting, the user sees "Voice dictation stopped because the microphone was interrupted. Try again."stopand the interruption share onefinishDictation; only the empty-transcript message differs. An interruption while processing or idle is ignored.handleDictationToggleused to cancel while processing. Cancelling bumps the generation, so the finish reply that came back was ignored. Now the tap does nothing until the finish settles, the same as a tap while starting. Long-press on the terminal mic still cancels on purpose. The terminal mic's accessibility label while processing changes from "Cancel voice dictation" to "Transcribing voice dictation".dictationFailureMessageinmobile-dictation-setup.tsmaps the host's dictation codes next to the existing speechless-server mapping.dictation_already_activebecomes "Dictation is already in use on the computer or another phone." The three session-gone codes (dictation_owner_mismatch,dictation_stream_not_started,dictation_stream_closing) become "Dictation lost its connection to the computer. Try again."dictation_requires_mobile_clientasks the user to re-pair the phone. Unknown messages pass through unchanged.Why
Each fix is in the place that makes the decision. The interruption rule goes in
useMobileDictation, because it owns the status, the dictation id and the finish/cancel calls. The capture seam only reports that the mic dropped. The clipboard fallback goes in the session hook where every dictation route ends.sendLiveTerminalInputalso carries typed keystrokes, which must not land on the clipboard. The codes are wire identity that older phones match exactly (the setup-sheet codes, for one), so the host keeps sending codes and the phone translates them for display. Neither desktop nor mobile had a mapper to reuse. Desktop shows the same rawdictation_already_activewhen a phone holds the model; that's left for a follow-up, and the map should move tosrc/sharedthen rather than being copied.One dictation at a time across the computer and phones is intended, since there's one speech model, so only the message changes.
Linked Issue
Fixes #35207
Fixes #35208
Fixes #35209
Fixes #35210
Visual Proof
No capture. The only visible changes are toast text and a transcript landing where it used to vanish. A real phone call or Siri interruption can't be triggered in the simulator, and the processing tap needs a paired computer with a speech model. Each case is proven in
mobile-dictation-session-outcomes.test.tsx, which mounts the real session and dictation hooks over the native capture binding with a fake host. Every new case failed on main and passes here.Testing
New
mobile/src/session/mobile-dictation-session-outcomes.test.tsxcovers: an interruption while recording sends finish (not cancel) and inserts the transcript; an empty interrupted transcript shows the interrupted message; a tap while processing keeps the transcript; a refused live insert copies to the clipboard with the toast;dictation_already_activetoasts the sentence. It also absorbs the oldmobile-dictation-refused-start-routing.test.tsxcases, so the two files share one harness. Every new case was run against main's production files and failed.Ran every test file that imports or mocks a changed module (27 files), the dictation setup tests, and the mobile RPC recording goldens (
mobile/src/test-support/rpc-recording, 1695 tests): all pass.check:code-quality:changedandcheck:react-doctor:changedpass. CI runs typecheck and the full suite.Not run on a device.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Codex and a Claude reviewer each reviewed one round. Codex found nothing. Claude raised one P2: in chat, the mic doesn't show a busy state while the transcript is processing, so a tap during a slow finish looks dead. That is left as a follow-up because it needs new composer UI in files #32656 also edits. Its two P3s (a delivery-ambiguous send reported as failed, and a double toast for an over-256 KiB transcript) were left as is.
CodeRabbit's Major (a rejecting flush or send skipped the fallback) is fixed in 8fc28d2, with a throwing-send test case. Its Minor (an unknown message named like an object prototype key) and Trivial (no second fallback when the clipboard refuses) were left as is.
Agent skill upstream boundary
Notes
Phone-only change, with no wire or host change, so mixed phone and computer versions behave as before apart from the new copy. Native capture (iOS/Android) and the OTA page capture share the same interruption handler. Terminal live and buffered input and the native chat/queued-edit destinations all go through the same fallback. Nothing here depends on the platform or on SSH vs local, and folder workspaces are unaffected.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)