Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(mobile): add offline iPhone voice input #8614

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 8 commits intomain fromrefs/pull/8614/headmerged by juliusmarminge View on GitHub

The mobile composer could not use Apple's newer on-device transcription model.

This adds local dictation for supported iPhones on iOS 26 or later. The microphone is available in existing threads and new task drafts, including queued task editing. T3 Code prepares Apple's speech assets for the device language and transcribes up to five minutes of audio on the phone.

The transcript is inserted at the selection where recording started. T3 Code keeps the keyboard open and lets the user review the text before sending it. Canceling keeps the draft unchanged. Temporary audio files are removed when the operation ends.

Tests:

  • All 42 focused tests passed after the Expo SDK 57 rebase.
  • Mobile typecheck and targeted lint passed after the Expo SDK 57 rebase.
  • The pre-rebase Expo SDK 56 version passed an iOS release build and a physical iPhone test.

This change needs a new native mobile build.

UI screenshots are pending permission to capture them.

Built with GPT-5.6 Sol in the Codex harness through T3 Code.


Note

Medium Risk Touches microphone permissions, audio session lifecycle, and draft mutation timing with new native dependencies; incorrect cancellation or late transcript handling could corrupt composer text or leave sessions locked.

Overview Adds on-device dictation for supported iPhones (iOS 26+) in the new task and thread composers. Users tap the mic, see recording status and a live waveform, then confirm to transcribe locally and insert text at the caret where recording started—send stays blocked until transcription finishes or is canceled.

A new @t3tools/client-runtime/voice-input VoiceInputController owns the full lifecycle: single app-wide session, permission checks, up to five minutes of capture, cooperative cancellation, temp file cleanup, and draft owner/revision guards so late transcripts cannot overwrite a changed draft. Mobile wires expo-audio recording and metering through useVoiceInputController, with @react-native-ai/apple on iOS for SpeechTranscriber preparation and transcription.

Composer UX swaps the toolbar for dictation controls (cancel, status, confirm) with Reanimated layout transitions; collapsed composers can show a compact dictation strip. The native T3ComposerEditor gains a readOnly mode that blocks edits, paste, and drops while keeping focus and the keyboard. useComposerCommandMenu now keys selection off ownerKey so draft/thread switches reset caret position.

expo-audio and @react-native-ai/apple are added with patches (recording failure reporting, locale resolution, transcription cleanup). app.config.ts registers microphone permission for expo-audio. User and maintainer docs describe behavior and future remote-transcription boundaries. Requires a new native mobile build.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 50fc0ed46ed4afb1da073821473f385dfd939924. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add offline iPhone voice dictation to mobile composer

  • Adds VoiceInputController in controller.ts to orchestrate the full dictation lifecycle: permission checks, audio session setup, recording, on-device transcription via Apple's Speech framework, transcript commit, and cancellation semantics.
  • Integrates dictation UI into ThreadComposer.tsx and NewTaskDraftScreen.tsx with an animated dictation toolbar, live waveform metering, elapsed-time status, and confirm/cancel controls. Submission, attachments, and pickers are blocked while dictation is busy.
  • Adds a readOnly mode to the native iOS composer editor (T3ComposerEditorView.swift) so the text view blocks edits, paste, and drops while preserving focus and selection during dictation.
  • Patches @react-native-ai/apple@0.12.0 and expo-audio@57.0.4 to fix locale resolution, temp-file cleanup, and recording-failure error reporting.
  • Risk: resolveTranscriptCommit in controller.ts contains stray + tokens in the leftNeedsBoundary/rightNeedsBoundary computation that break TypeScript syntax and will prevent the module from compiling.
Macroscope summarized 50fc0ed.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: d020e7f5-6801-48a2-9440-06dce8facce2

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Warning

      Your free Security trial is over. An organization admin can activate Security or dismiss this notice.


      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. github-actions[bot](GitHub profile, opens in a new tab) added labels📱 Native Change

    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/384d7fb4a481fdef198745eb23a7f8c26b0bf23c/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx#L997

      Opening the branch picker while dictation is busy silently cancels the active recording. The branch control remains enabled, so it navigates away from NewTaskDraftScreen, whose focus-effect cleanup calls controller.dispose() and discards the recording; disable the control or guard its handler when voiceInput.isBusy is true.

      🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
      In file @apps/mobile/src/features/threads/NewTaskDraftScreen.tsx around line 997:
      
      Opening the branch picker while dictation is busy silently cancels the active recording. The branch control remains enabled, so it navigates away from `NewTaskDraftScreen`, whose focus-effect cleanup calls `controller.dispose()` and discards the recording; disable the control or guard its handler when `voiceInput.isBusy` is true.
      @@ -308,13 +278,16 @@
      308278 ) ?? null
      309279 );
      310280 }, [props.serverConfig, props.selectedThread.modelSelection.instanceId]);
      281+ const composerOwnerKey = scopedThreadKey(props.environmentId, props.selectedThread.id);
      311282
      312283 const composerMenu = useComposerCommandMenu({
      313284 draftMessage: props.draftMessage,
      285+ ownerKey: composerOwnerKey,
      314286 environmentId: props.environmentId,
      315287 projectCwd: props.projectCwd,
      316288 selectedProviderStatus,
      317289 hasThread: true,
      318290 onChangeDraftMessage: props.onChangeDraftMessage,
      319291 onUpdateInteractionMode: props.onUpdateInteractionMode,
      320292 });
      293+ const voiceInput = useVoiceInputController({
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High threads/ThreadComposer.tsx:293

      When a pending user-input request hides ThreadComposer, an active useVoiceInputController session continues recording or transcribing while its controls are unmounted from view; the transcript can then be inserted into the hidden draft after recording reaches the five-minute limit. Cancel the voice session when the composer becomes unavailable, and pass that availability from ThreadDetailScreen.

      🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
      In file @apps/mobile/src/features/threads/ThreadComposer.tsx around line 293:
      
      When a pending user-input request hides `ThreadComposer`, an active `useVoiceInputController` session continues recording or transcribing while its controls are unmounted from view; the transcript can then be inserted into the hidden draft after recording reaches the five-minute limit. Cancel the voice session when the composer becomes unavailable, and pass that availability from `ThreadDetailScreen`.
    5. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.3 KiB13.3 KiB+11 B (+0.1%)15.1 KiB✅
      CodexThread snapshot wire6.9 KiB6.9 KiB−7 B (−0.1%)7.3 KiB✅
      CodexLive turn WebSocket wire6.4 KiB6.5 KiB+18 B (+0.3%)7.8 KiB✅
      CodexLive turn WebSocket decoded55.6 KiB55.6 KiB0 B (0.0%)66.4 KiB✅
      CodexLive turn messages11110 (0.0%)21✅
      ClaudeTotal thread wire13.3 KiB13.3 KiB+32 B (+0.2%)15.1 KiB✅
      ClaudeThread snapshot wire6.9 KiB6.9 KiB+3 B (+0.0%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.4 KiB6.4 KiB+29 B (+0.4%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded56.4 KiB56.4 KiB+44 B (+0.1%)66.4 KiB✅
      ClaudeLive turn messages1011+1 (+10.0%)21✅

      Baseline: e09b88b · PR result: 50fc0ed · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 109.4 KiB
      • Claude decoded thread snapshot: 110.1 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    6. @@ -0,0 +153,21 @@
      153+ const replacement = transcript.trim();
      154+ if (replacement.length === 0) {
      155+ return { kind: "empty" };
      156+ }
      157+
      158+ const isEmptySelection = captured.selection.start === captured.selection.end;
      159+ const normalizedLocale = locale.replaceAll("_", "-").toLowerCase();
      160+ const usesEnglishSpacing = normalizedLocale === "en" || normalizedLocale.startsWith("en-");
      161+ let insertion = replacement;
      162+ if (isEmptySelection && usesEnglishSpacing) {
      163+ const left = captured.text[captured.selection.start - 1];
      164+ const right = captured.text[captured.selection.start];
      165+ const leftNeedsBoundary =
      166+ left !== undefined &&
      167+ /[A-Za-z0-9.!?,:;)\]}'"]/.test(left) &&
      168+ (right === undefined || /\s/.test(right));
      169+ const rightNeedsBoundary =
      170+ right !== undefined &&
      171+ /[A-Za-z0-9([{'"]/.test(right) &&
      172+ (left === undefined || /\s/.test(left));
      173+ insertion = `${leftNeedsBoundary ? " " : ""}${replacement}${rightNeedsBoundary ? " " : ""}`;

      Emoji breaks English transcript spacing

      Low Severity

      English boundary spacing reads captured.text[index], which is a single UTF-16 code unit. A caret beside an emoji sees a surrogate that fails the letter/punctuation check, so the transcript is inserted without the intended leading or trailing space.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 384d7fb4a481fdef198745eb23a7f8c26b0bf23c. Configure [here](https://www.cursor.com/dashboard/bugbot).
    7. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This PR introduces a substantial user-facing iPhone voice-input workflow spanning native audio capture, local transcription, draft mutation, and composer lifecycle changes, along with new app-level audio defaults. Unresolved lifecycle and emoji-spacing concerns indicate that the behavior needs human review before merging.

      Not approved because:

      • 2 blocking correctness issues found at or above your repo's Minimum Blocking Severity
      Adjust the Minimum Blocking Severity for this repo — including turning it Off — in [Settings](https://app.macroscope.com/pingdotgg/settings#Repos). You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    8. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      There are 2 total unresolved issues (including 1 from previous review).

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ad0c05f83446dc300eb1aea809255821d5360b5e. Configure [here](https://www.cursor.com/dashboard/bugbot).
    9. juliusmarminge merged this352710d

    10. juliusmarminge closed this

Sign in to join this conversation.