Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): voice input keeps your edits, your first words, and your language #25808

Closedt3dotgg(GitHub profile, opens in a new tab)wants to merge 5 commits intomain fromt3/mobile-voice-inputopened View on GitHub

iPhone voice input lost what you said. Hand edits to a transcript were dropped on send. The first words were cut off if you spoke right after tapping the mic. Korean (and every non-English) speech was transcribed as English. Separately, dragging a microphone in Settings > Microphone snapped back.

Fixes

  • Edits after dictation now reach the draft (#15129). The editor is hidden with display: none while dictating, and that recreates the iOS editor view and resets its edit counter. The JS side kept its old counter and ignored every later edit as stale, so send used the raw transcript. The editor now remounts with the view, which #19281 already does for the hidden composer.
  • Recording starts while Apple's speech model prepares (#17888). Before, the controller waited for the model to prepare (which can mean a download) before it started the mic. Now the mic starts first, and the transcript waits for the model. If the model fails to prepare, the recording is discarded with an error. Every cleanup path cancels the preparation, so a retry never sees "Another voice recording is already active."
  • Transcription uses your iPhone's languages (#12743). The app ships only in English, so the Intl locale was always English. Now it tries your preferred iOS languages in order, then the app locale. Word spacing works for every language that uses spaces, not only English. From #13312 by @nichtlegacy.
  • Microphone order keeps a dragged row where you drop it (#25626). Gesture callbacks are worklets that each copy their closure, so the translation set in onUpdate never reached onFinalize. It now reads the final event. The same handle drives Settings > Environment > Routes, so route reordering is fixed too. From #22435 by @RVZO6.

Fixes #15129 Fixes #25626 Should fix #17888 and #12743. Both need a real iPhone to confirm, see below.

Supersedes #13312 and #22435.

Proof

  • New controller tests hang on main and pass now: recording starts while the model prepares, the recording is discarded when preparation fails, and preparation is cancelled when recorder start or stop fails. The language tests (preferred language first, fallback on unsupported, Korean and Hindi spacing) fail on main and pass now. vp run check:changed passes.
  • iOS 26.5 simulator running this branch's JS:
mainthis PR
Mic order: drag Built-in to the topsnaps back to 3 of 4stays at 1 of 4
After the voice UI hides and shows the editor, type "fix it"text shows, Send stays disabledSend is enabled

The order also stays after you leave and reopen the screen.

Not checked, and not fixed

  • Needs a real iPhone. The simulator has no recording input and no Apple speech model. So these are not checked on a device: real first-word timing, real Korean output, and a full dictate-then-edit-then-send pass.
  • #15903 ("No speech was detected" on recordings over a few seconds) is not fixed. I ran a macOS 26.5 harness with the same native transcribe code. It transcribed a 10.6 s AAC 44.1 kHz stereo file in full, so the bug is not in the transcribe step. Finding the cause needs a device.
  • #16462 (collapsed composer clips a multi-line transcript) is not touched. It is composer layout, which another thread owns. #15236 targets it.

Trade-offs

  • If your first iOS language is Korean but you dictate in English, you now get Korean. #22380 adds a language picker for that case.
  • Fallback moves to the next language only when Apple reports a language as unsupported. If you are offline and your first language's model is not downloaded, voice input fails. It does not try the next language.
  • On first use, "Transcribing" now also includes the model download time.

Follow-ups

  • #15903 needs a device repro.
  • releaseResources could mark the session abandoned before the audio session shuts down. That would close a short retry window that also exists on main.
  • A language picker (#22380).

Council review

Rounds: 2

DelegateRound 1Round 2
Claude Opus 5.58/108.5/10
Codex GPT-6.1 Sol8/109/10

Round 1 found the preparation leak on failed recorder start and stop. Both are fixed and tested. Codex suggested cutting the drag handle fix. I kept it, because #25626 is part of this request.

Created with Claude Opus 5.5 in Claude Code, running in T3 Code.

🤖 Generated with Claude Code

    1. Approvability

      Verdict: Needs Human Approval

      Macroscope's review found this PR requires human approval — The PR changes the default iOS voice-input language and reworks recording/model-preparation concurrency and cleanup, alongside editor lifecycle and microphone reordering fixes. These are focused and tested, but the changed default language behavior and existing asynchronous runtime workflow warrant human review.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    2. Review in Change Stack →

      No actionable comments were generated in the recent review.

      Recent review info
      Run configuration
      Commits

      Reviewing files that changed from the base of the PR and between 96fc7b955196637605cbf3b415152ce4dd0e2294 and 89df82693fcfa01a6eb9969f5556327f197f3077.

      Files selected for processing: 7
      • apps/mobile/src/features/settings/components/SettingsDragHandle.tsx
      • apps/mobile/src/features/threads/ThreadComposer.tsx
      • apps/mobile/src/native/voiceTranscription.ios.test.ts
      • apps/mobile/src/native/voiceTranscription.ios.ts
      • docs/user/composer.md
      • packages/client-runtime/src/voice-input/controller.test.ts
      • packages/client-runtime/src/voice-input/controller.ts

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

      Walkthrough

      The changes update iOS transcription language selection, voice-input recording and transcript handling, composer editor visibility during compact dictation, and settings drag translation handling.

      Changes: Voice input

      Layer / File(s)Summary
      Preferred locale selection
      apps/mobile/src/native/voiceTranscription.ios.ts, apps/mobile/src/native/voiceTranscription.ios.test.ts, docs/user/composer.md
      The iOS transcriber tries preferred iPhone languages in order, then the resolved app locale. Tests and documentation cover the selection and fallback behavior.
      Locale-aware transcript spacing
      packages/client-runtime/src/voice-input/controller.ts, packages/client-runtime/src/voice-input/controller.test.ts
      Transcript spacing now uses Unicode-aware boundary checks, with automatic spacing excluded for configured languages. Tests cover Korean, Hindi, and Japanese.
      Asynchronous recording and transcription
      packages/client-runtime/src/voice-input/controller.ts, packages/client-runtime/src/voice-input/controller.test.ts
      Recording can start while transcription preparation is pending. Finishing awaits preparation, and cleanup cancels and settles pending preparation. Tests cover preparation and recorder failures.

      Composer editor visibility

      Layer / File(s)Summary
      Hide editor during compact dictation
      apps/mobile/src/features/threads/ThreadComposer.tsx
      The editor is hidden when compact dictation is shown, as well as when the composer is hidden by its props.

      Settings drag handle

      Layer / File(s)Summary
      Use final gesture translation
      apps/mobile/src/features/settings/components/SettingsDragHandle.tsx
      The end callback receives the final gesture event's translation. The existing cancellation flag remains unchanged.
      Priority: Normal

      Estimated code review effort: 3 (Moderate) | ~25 minutes

      Change: Bug fix · Severity of issue fixed: Medium

      Sequence Diagram(s)

      sequenceDiagram
        participant User
        participant VoiceInputController
        participant Recorder
        participant Transcriber
        User->>VoiceInputController: Start voice input
        VoiceInputController->>Transcriber: Prepare transcription
        VoiceInputController->>Recorder: Start recording
        User->>VoiceInputController: Finish recording
        VoiceInputController->>Recorder: Stop recording
        VoiceInputController->>Transcriber: Await preparation and transcribe audio

      Suggested labels: bugfix, 📱 Native Change

      Suggested reviewers: juliusmarminge, claudesau, macroscopeapp

      Merge Risk: Minimal · up to 89df8

      The changes appear mergeable after normal checks. Real-device voice-input behavior remains worth validating when a device is available.

      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Title checkPassedThe title names the three user-visible outcomes of the changeset: edits persist, first words are captured, and the spoken language is respected. It also names the mobile scope and uses a conventional …
      Description checkPassedThe description follows the template well. It has a problem statement that lists the failures and their expected behavior, and a change section that explains each fix and its cause. It names the linke…
      Linked Issues checkPassedThe PR satisfies the coding requirements for the three directly linked issues. For #15129, ThreadComposer hides ComposerEditor during compact dictation, which remounts the iOS editor and resets it…
      Out of Scope Changes checkPassedThe changes stay within the current PR scope. The language-selection and spacing changes support the stated voice-input fixes and include tests and user documentation. The shared drag-handle change al…
      Full details: Title check

      Explanation

      The title names the three user-visible outcomes of the changeset: edits persist, first words are captured, and the spoken language is respected. It also names the mobile scope and uses a conventional commit prefix. The title covers the voice input fixes, but not the microphone drag-order fix, which the PR also contains. The title is not vague and is not off-topic.

      Full details: Description check

      Explanation

      The description follows the template well. It has a problem statement that lists the failures and their expected behavior, and a change section that explains each fix and its cause. It names the linked issues, gives verification evidence with simulator screenshots and test results, and states what was not verified on a device. The template's Scope and approval section is not clearly filled. The description links issues #15129, #25626, #17888 and #12743 and cites the superseded PRs #13312 and #22435, but it does not link a maintainer approval comment or explain why the fixes qualify without one. The template also asks for the model and harness that did the work, and the description names Claude Opus 5.5 in Claude Code, so that item is met.

      Full details: Linked Issues check

      Explanation

      The PR satisfies the coding requirements for the three directly linked issues. For #15129, ThreadComposer hides ComposerEditor during compact dictation, which remounts the iOS editor and resets its revision history before later edits are committed. For #25626, SettingsDragHandle passes the final gesture event translation to onEnd, so the drop position reaches the existing reorder and persistence logic. For #17888, VoiceInputController starts transcription preparation without waiting for it, starts recording after audio setup, discards the recording when preparation fails, and aborts preparation during cleanup. Added controller, native transcription, and language-spacing tests cover these paths.

      Full details: Out of Scope Changes check

      Explanation

      The changes stay within the current PR scope. The language-selection and spacing changes support the stated voice-input fixes and include tests and user documentation. The shared drag-handle change also supports route reordering because the same handle is used there. No unrelated change is demonstrated.

      Finishing Touches
      📝 Generate docstrings
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Comment `@coderabbitai help` to get the list of available commands.
    3. Additional affected-user report for German voice input (2026-10-29):

      I use the microphone directly in the T3 Code iPhone composer, not the iOS keyboard dictation microphone. When I dictate in German, the resulting text can contain unrelated English words and badly distorted German, making the message difficult to understand and requiring manual correction.

      Please include German dictation in the real-iPhone verification for the language-selection fix. It would also help to show the active recognition language and offer an explicit language choice such as German, as discussed in #22380.

      The exact installed mobile app build, iOS version, device model, and runtime recognition locale have not been collected. This is a report of the current user experience, not verification of this PR's patched build or a confirmed diagnosis of the locale on my device.

      Posted with AI assistance at my request.

    4. rami-maalouf(GitHub profile, opens in a new tab)commented

      This PR also fixes a second symptom of the same bug. I did not find an issue for it.

      Steps

      1. Type some text in the thread composer on the phone.
      2. Tap the mic to start voice input.
      3. Tap the X to cancel.

      Result: the composer shows empty. The text from step 1 looks erased. Confirm does not have this problem.

      Why: display: none recreates the iOS editor view, so the new view is empty. On cancel the draft text does not change, so JS still marks it isNativeEcho. The native editor ignores an echo that does not match its own text (T3ComposerEditorView.swift, setControlledDocumentJson), so the new view stays empty. On confirm the transcript changes the text, so it is not an echo and the view updates.

      The hidden={props.hidden || showsCompactDictation} change in this PR remounts the JS editor with an empty history. Its first payload is then not an echo, so this case is fixed too. Android has the same echo check, and the fix covers it as well.

      Here's a video of the bug

      https://github.com/user-attachments/assets/e4c90b8e-8722-44ce-a6c6-4eb6e80c5cc3

    5. Verified on a physical iPhone (pt-BR)

      iPhone 17, iOS 27 (24A446), iPhone language Português (Brasil). Release build (Personal Team) of this branch merged onto current main (8657eecb2). I resolved the three conflicts with no other changes. OTA updates were disabled, so the build ran this code.

      • ✅ Composer mic, Brazilian Portuguese: correct Portuguese text with accents and punctuation. The App Store build turns the same speech into English-sounding words.
      • ✅ Speaking right after tapping the mic: the first word ("um, dois, três…") is kept.
      • ✅ Dictate, edit the transcript by hand, send: the edit is in the sent message.
      • ✅ Type a draft, record, cancel: the typed draft stays.

      This covers the "Needs a real iPhone" item, apart from Korean. The branch still conflicts with main in three places. Each is small:

      • SettingsDragHandle.tsx: a comment only.
      • ThreadComposer.tsx: the one-line hidden change, which now goes on the editor at its new location.
      • docs/user/composer.md: keep both paragraphs.
    6. Thank you so much for working on this, and for T3 Code in general. We use it every day and really appreciate that it is free and open source.

      Just adding one more voice from German-speaking users: on our iPhones, voice input currently transcribes German speech with the English model, so the result is unfortunately not usable for us right now. Following the iPhone's preferred languages, as this PR does, and ideally also being able to pick the dictation language (#29689), would make a big difference for us.

      No pressure at all, we know maintainer time is limited. We just wanted to let you know this would be very welcome. Thanks again!

    7. Another +1 from a German-speaking user, written with gratitude rather than impatience: T3 Code is a fantastic tool, and we are thankful to be able to use it for free.

      At the moment, dictating in German on the iPhone mostly produces English-sounding words, so we have stopped using the microphone. Having voice input respect the device language (this PR), plus a way to choose the language explicitly, would make it genuinely useful for us.

      Whenever it fits your plans. Thank you for all the work on this!

    8. I’m taking this over into a new mobile dictation stack. I’ll carry forward the editor and first-word fixes, combine the overlapping language work with the original contributor’s change, and leave out the microphone reorder that already shipped. I’ll link the replacement layers here before closing this PR. Thanks for the concrete repros and device checks.

    9. juliusmarminge assignedjuliusmarminge

    10. Thank you @t3dotgg for tying the lost first word to the model wait, and @jokaperes for checking immediate speech, editing and cancellation on an iPhone. I compared all seven changed files with current main and the replacement stack.

      • #31799 restores word spacing and #31800 restores iPhone language selection, crediting @nichtlegacy’s #13312.
      • #31801 opens the mic while Apple prepares, scoped to on-device iPhone dictation. A cancelled native request can’t hold the next recording or insert stale speech. Web, Android and environment recording keep their setup and consent checks.
      • The composer remount workaround is no longer needed: #30139 restores the controlled draft and revision in the native editor, and #26452 flushes edits on send. The microphone and route reorder fix from @RVZO6’s work already shipped in #26096.

      Closing this as superseded, not merged. All 63 focused tests pass on the rebuilt stack; a cold start on a physical iPhone is still the final check for real opening-word timing.

    11. juliusmarminge closed this

Sign in to join this conversation.