Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): keep dictation active across navigation #14923

ClosedBil0000(GitHub profile, opens in a new tab)wants to merge 8 commits intomain fromrefs/pull/14923/headopened View on GitHub

Mobile dictation belonged to each prompt screen. Leaving that screen stopped the recording and could leave native work holding the shared recording session.

Move the recorder and controller above navigation so the app has one recording. Keep the existing controls in the starting prompt, and show a floating recording bar with finish and cancel controls when that prompt is off screen. Other prompts cannot start a second recording. Stopping inserts the transcript at the starting caret or replaces its selected text in the original draft, including thread drafts, queued-message edits, new tasks, and scheduled-task prompts.

The starting draft is read and updated through retained state rather than the currently visible screen. Scheduled-task drafts now remain in app state across screen removal, and a new editor session cannot receive an older task's transcript. Explicit discard cancels that draft's dictation. The active session observes retained draft text changes so restoring old text does not allow an old transcript to overwrite a changed prompt. Native cleanup still finishes before a canceled recording can be restarted.

Fixes #13743. This follows Julius's request for a single global recording that stays visible during navigation and returns its transcript to the starting prompt.

Verification:

  • 102 focused tests passed across voice sessions, the shared controller, transcription, metering, presentation, and scheduled-task drafts. They cover the iOS/Android import graph, starting caret and selected-text retention, target retention, single recording ownership during preparation/recording/transcription, canceled native work, queued-edit discard cancellation without stopping another prompt, and changed, missing, or changed-then-restored drafts.
  • Mobile TypeScript check and formatting check passed. Targeted lint completed with no errors and React warnings.
  • Native UI and recording-bar placement could not be checked: this host has no iOS simulator or Android SDK. No screenshots or video are attached. Existing background interruption behavior and the five-minute recording limit remain in place.

Model: GPT-6.1-Sol. Harness: T3 Code Codex.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

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

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This PR moves dictation into an app-wide native recording session, adds floating controls across navigation, and retains transcript targets across thread and scheduled-task routes. The resulting changes to audio lifecycle, navigation behavior, shared state, and transcript handling have a broad runtime blast radius requiring human review.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 1167620b-8d21-42f0-9a04-6c1ddd14a91a
      📥 Commits

      Reviewing files that changed from the base of the PR and between bed03ca986ccfb001da47c17af5b44d063021465 and 93aef26cb2ba376c8ba41b10bfc31b39845f548e.

      📒 Files selected for processing (13)
      • apps/mobile/src/App.tsx
      • apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx
      • apps/mobile/src/features/settings/scheduled-task-editor-state.test.ts
      • apps/mobile/src/features/settings/scheduled-task-editor-state.ts
      • apps/mobile/src/features/settings/scheduled-task-editor.tsx
      • apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
      • apps/mobile/src/features/threads/ThreadComposer.tsx
      • apps/mobile/src/features/threads/ThreadDetailScreen.tsx
      • apps/mobile/src/features/voice-input/GlobalVoiceInputControl.tsx
      • apps/mobile/src/features/voice-input/VoiceInputProvider.tsx
      • apps/mobile/src/features/voice-input/useVoiceInputController.ts
      • apps/mobile/src/features/voice-input/voiceInputSession.test.ts
      • apps/mobile/src/features/voice-input/voiceInputSession.ts

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


      📝 Walkthrough

      Walkthrough

      The mobile app now uses a shared voice-input session for composer and scheduled-task drafts. New starts wait for abandoned sessions to release. Cleanup handles recorder URI access errors without interrupting resource release.

      Changes

      Shared voice input

      Layer / File(s)Summary
      Wait for abandoned controller sessions
      packages/client-runtime/src/voice-input/controller.ts, packages/client-runtime/src/voice-input/controller.test.ts
      Sessions track abandonment and release. Starts wait for abandoned sessions, while active recordings still block another start. Cleanup handles recorder URI getter errors. Tests cover queued starts, canceled waiters, and transcription restart.
      Provide shared mobile voice input
      apps/mobile/src/features/voice-input/*, apps/mobile/src/App.tsx
      A shared provider owns recording, session state, audio setup, lifecycle handling, and metering. The controller hook uses a captured draft target. A global control displays dictation actions when the owner is not focused. Tests cover target retention, draft changes, and cancellation.
      Connect voice input to composer drafts
      apps/mobile/src/features/threads/NewTaskDraftScreen.tsx, apps/mobile/src/features/threads/ThreadComposer.tsx, apps/mobile/src/features/threads/ThreadDetailScreen.tsx
      Composer voice input reads and subscribes to draft-store snapshots. ThreadComposer writes dictated text through the draft store. Queued-edit cancellation cancels voice input for the draft key.
      Bind voice input to scheduled-task editor sessions
      apps/mobile/src/features/settings/scheduled-task-editor-state.ts, apps/mobile/src/features/settings/scheduled-task-editor-state.test.ts, apps/mobile/src/features/settings/scheduled-task-editor.tsx, apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx
      The editor uses shared session state with session-specific voice-owner keys. Voice input reads and updates only the matching editor. Discard cancels busy voice input, clears the session, and dispatches pending navigation.

      Priority: ➖ Normal

      Estimated code review effort: 4 (Complex) | ~45 minutes

      Change: Bug fix · Severity of issue fixed: Low

      Sequence Diagram(s)

      sequenceDiagram
        participant Composer as Composer
        participant Hook as useVoiceInputController
        participant Session as VoiceInputSession
        participant Target as VoiceInputTarget
        Composer->>Hook: Start with owner and draft callbacks
        Hook->>Session: Create and start target
        Session->>Target: Read draft and subscribe to changes
        Session->>Target: Commit transcript to captured draft

      Suggested reviewers: juliusmarminge

      Merge Risk: ⚪ Minimal · up to 93aef

      The identified subscription concern does not block merging, and the checked navigation paths preserve the intended draft ownership. Merge after normal checks.

      Security Architecture Review

      Security architecture risk: 🔵 Low · up to 93aef

      The shared recording retains its original draft target, rejects stale results, and waits for canceled work before restarting. No concrete new attack path was established, but behavior during account changes and device interruptions remains incompletely verified.

      Retained concerns No architecture-level concerns identified.

      Security review details

      Security Blast Radius

      • inferred — The directly affected scope is an application instance's microphone session, temporary recording files, and original draft target. Sharing the controller broadens its navigation lifetime, while busy-start rejection and retained owner identity constrain simultaneous recording and transcript redirection.

      Trust Boundaries and Controls

      • observed — A recording start requires an available transcriber and granted microphone permission before native recording preparation. Transcription output reaches the captured draft callback only after operation-token and snapshot validation; missing, changed, or differently owned drafts reject the commit.
      • observed — Queued-edit discard cancels only the matching owner. Scheduled-task discard cancels busy dictation before replacing the editor session. Backgrounding invalidates preparation or discards an active recording, and provider unmount disposes the controller.

      Resilience and Maintainability Implications

      • observed — The iOS wrapper checks cancellation before and after native preparation, file reading, and transcription. It waits for native calls to settle rather than treating an abort signal as immediate native completion, supporting the controller's cleanup-before-restart ownership invariant.

      Hardening Proposals

      • proposed — Consider explicitly canceling retained dictation on account transitions, or establishing that account cleanup invalidates every retained target before another account becomes active. This is a lifecycle-hardening proposal, not a verified cross-account disclosure finding.
      🚥 Pre-merge checks | ✅ 2 | ❌ 3

      ❌ Failed checks (3 warnings)

      Check nameStatusExplanationResolution
      Linked Issues check⚠️ Warning[#13743] The PR prevents a competing-start error, but it does not meet the issue’s requirement to start a new recording right away. VoiceInputController.start() waits for an abandoned session’s `rel…Allow a new recording to reach the recording phase without waiting for an abandoned native transcription to settle. Keep native operations serialized and prevent stale results from committing. Add tests where an abandoned transcription neve…
      Docstring Coverage⚠️ WarningDocstring coverage is 4.55% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 15 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
      Description check⚠️ WarningThe description explains the problem, implementation, and verification in detail. It does not provide the required maintainer approval evidence for the scope, and it has no screenshots for the UI chan…Add a link to the triaged issue or discussion and the maintainer’s explicit approval comment, or explain why this focused fix qualifies for an exemption. Add clear before-and-after screenshots for the UI changes, plus a short recording if n…
      ✅ Passed checks (2 passed)
      Check nameStatusExplanation
      Out of Scope Changes check✅ PassedThe changes remain within shared mobile voice input. The app-level provider, floating controls, and draft retention support single-session ownership and preserve the original target across navigation.…
      Title check✅ PassedThe title clearly and concisely describes the main change: keeping mobile dictation active across navigation.
      Full details: Linked Issues check

      Explanation

      [#13743] The PR prevents a competing-start error, but it does not meet the issue’s requirement to start a new recording right away. VoiceInputController.start() waits for an abandoned session’s released promise. releaseSession() runs during resource cleanup, after the old transcription settles. controller.test.ts confirms that the next recording waits for transcription and audio cleanup. A native transcription that does not settle therefore still blocks the new recording.

      Resolution

      Allow a new recording to reach the recording phase without waiting for an abandoned native transcription to settle. Keep native operations serialized and prevent stale results from committing. Add tests where an abandoned transcription never resolves and a second start reaches recording, including cancellation during preparation.

      Full details: Description check

      Explanation

      The description explains the problem, implementation, and verification in detail. It does not provide the required maintainer approval evidence for the scope, and it has no screenshots for the UI changes.

      Resolution

      Add a link to the triaged issue or discussion and the maintainer’s explicit approval comment, or explain why this focused fix qualifies for an exemption. Add clear before-and-after screenshots for the UI changes, plus a short recording if needed to show interactions or timing.

      • Fix all pre-merge checks with AI
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Autopilot is currently an internal CodeRabbit preview.


      Comment `@coderabbitai help` to get the list of available commands.
    4. Bil0000(GitHub profile, opens in a new tab) changed the title

    5. Updated for Julius's feedback in ac78b45202. The mobile app now owns one recorder above navigation. Its controls stay available in a floating bar after leaving the starting prompt, and finishing adds the text to that original draft. Other prompts cannot start a second recording.

      Covered thread drafts, queued edits, new tasks, and scheduled-task prompts. All 92 focused tests and the mobile type check pass. Native UI verification is still blocked by the missing iOS simulator and Android SDK on this host.

    6. juliusmarminge closed this

Sign in to join this conversation.