Skip to content

fix(mobile): keep dictation controls in sync with host settings - #31349

Merged
nwparker merged 2 commits into
mainfrom
nwparker/mobile-dictation-controls
Oct 21, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/mobile-dictation-controls

Conversation

@nwparker

@nwparker nwparker commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

The phone should follow the computer’s voice settings. Turning dictation off now removes the microphone while leaving photo attachments available. Connecting again or returning to the app refreshes whether the mic uses hold or tap.

What changed

  • Carry the host’s enabled flag to live terminal, buffered terminal and chat controls, and to the capture hook.
  • Refresh voice settings after connecting, reconnecting, route focus and app foreground.
  • Ignore late replies from an older connection, focus or settings read so they cannot restore a disabled mic or the wrong mode.
  • Keep older-host behavior when setup reads fail or the enabled flag is absent.

Fixes #30307. Fixes #30511.

Community contribution

Adapted and reviewed @innocarpe’s #30316 and #30513 together because they update the same settings response. Wooseong Kim is credited as co-author. This adds capture gating and combined stale-enabled/re-enable coverage on top of those contributions.

Verification

  • Reproduced all five original focused regressions against dda855e837d0; all five failed before the change.
  • 24 focused tests pass across six suites, covering disabled controls, attachment action, re-enable, hold/toggle connect/reconnect, foreground, stale replies, refused starts and capture cleanup.
  • Mobile application typecheck and mobile test typecheck ratchet pass.
  • Changed-code quality gate, changed-file lint and formatting pass.
  • Production mobile page bundle builds successfully.

Visual proof

Real iPhone simulator (iOS26.1), source-built Release native shell with the production mobile page bundle over its encrypted E2EE v2 bridge. Both terminal screenshots use a host reporting dictation disabled. Screenshots were visually inspected: controls align correctly, the attachment stays available, and re-enabling restores the mic.

Before: disabled mic still shown After: mic hidden, attachment retained
Before After
Native photo picker still opens Chat with dictation disabled Chat re-enabled on foreground
Photo attachment Disabled chat Re-enabled chat

Native exercise also covered buffered input (attachment and Send remain), real disconnect/reconnect of the same pinned host, and foreground changes between enabled/disabled and hold/toggle. Server logs confirm a fresh settings read after reconnect and app resume. In toggle mode one tap reached native Listening and sent audio chunks; the next tap finished. After a foreground change to hold mode, pressing started and releasing finished.

Toggle after reconnect: stays listening after one tap Hold after foreground: recording while pressed
Toggle recording Hold recording

The host is a deterministic RPC fixture serving the actual production page bundle. Native microphone capture, audio chunks and photo picker were exercised; the fixture supplies the final transcript, so this does not measure recognition quality. Automated tests exercise late RPC replies and focus cleanup deterministically.

Compatibility and review

Independent code review found no correctness blockers and independently passed 19 tests across four focused suites.

Mobile settings only; existing RPCs and reply schema are unchanged. The host can be local, SSH or relay, and client/server versions can differ. No repository/worktree assumptions were added. Attachments and other composer actions keep their existing behavior.

AI disclosure

Prepared with OpenAI Codex.

nwparker and others added 2 commits October 20, 2026 20:17
Refresh enabled state and hold/toggle mode on connection, route focus and foreground. Fence stale replies and preserve attachment actions when dictation is disabled.

Co-authored-by: Wooseong Kim <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1157444c-c6c0-44ff-b7ad-b68451f7b7df
📥 Commits

Reviewing files that changed from the base of the PR and between 411b5c0 and 4e3a2b1.

📒 Files selected for processing: 9
  • mobile/src/session/MobileNativeChatOverlay.tsx
  • mobile/src/session/MobileSessionActiveContent.tsx
  • mobile/src/session/MobileSessionCommandDock.tsx
  • mobile/src/session/MobileTerminalInputActions.tsx
  • mobile/src/session/mobile-dictation-disabled-controls.test.tsx
  • mobile/src/session/mobile-dictation-mode-refresh.test.tsx
  • mobile/src/session/mobile-dictation-refused-start-routing.test.tsx
  • mobile/src/session/use-mobile-session-native-chat-dictation.ts
  • mobile/src/session/use-mobile-session-screen-state.ts

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

📝 Walkthrough

The session state now tracks whether dictation is enabled. The dictation hook refreshes host settings when a session connects and when the app returns to the foreground, and ignores stale replies. Live, buffered, and chat input controls hide microphone actions when dictation is disabled. Photo attachment remains available. Added tests cover settings refresh behavior and input control visibility.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 4e3a2

Dictation controls follow the host setting, and disabling dictation stops an active recording. No issue identified here prevents merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: keeping mobile dictation controls synchronized with host settings.
Description check Passed The description is detailed and covers the user impact, implementation, linked issues, visual proof, testing, compatibility, and AI disclosure. It omits several template headings and checklist items, …
Linked Issues check Passed The changes satisfy #30307 and #30511. useMobileSessionScreenState supplies dictationEnabled, and MobileSessionCommandDock and MobileSessionActiveContent pass it to terminal and chat controls.…
Out of Scope Changes check Passed The changed files are connected to the two linked issues. The prop updates support conditional microphone rendering. The state and hook changes implement settings propagation, capture gating, and refr…
Full details: Description check

Explanation

The description is detailed and covers the user impact, implementation, linked issues, visual proof, testing, compatibility, and AI disclosure. It omits several template headings and checklist items, but the required information is substantially present.

Full details: Linked Issues check

Explanation

The changes satisfy #30307 and #30511. useMobileSessionScreenState supplies dictationEnabled, and MobileSessionCommandDock and MobileSessionActiveContent pass it to terminal and chat controls. MobileTerminalInputActions hides only the microphone when disabled and retains the image attachment action. The dictation hook also gates capture with canSend &amp;&amp; dictationEnabled. refreshDictationMode skips disconnected reads, runs on focus, connection changes, and foreground activation, and applies only the newest settings response. It retains previous settings on read failure and treats a missing enabled field as enabled. The focused tests cover disabled controls, reconnect, foreground, stale replies, failed reads, and legacy responses.

Full details: Out of Scope Changes check

Explanation

The changed files are connected to the two linked issues. The prop updates support conditional microphone rendering. The state and hook changes implement settings propagation, capture gating, and refresh behavior. The added tests verify the required terminal, chat, attachment, capture, reconnect, foreground, and stale-response behavior. No unrelated product behavior is established by the reviewed change summary or inspected files.

✨ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker

Copy link
Copy Markdown
Contributor Author

Adversarial pre-merge review of 4e3a2b15c29e2e71b0b8bb3b3a2924f4e81896e6: no introduced correctness or privacy blocker found.

  • Independently ran 63 existing tests across 11 suites, including the production hosted-page capture and route cleanup paths.
  • Six additional review probes passed: disabling during recording stops capture before host cancellation settles and prevents restart; late finish text is discarded after disable; a late start after unmount never begins recording; old-host/client settings replies cannot re-enable capture; unknown gesture mode is inert; legacy method-not-found preserves known disabled state.
  • Existing native simulator proof remains applicable. Final applicable CI and aggregate gate are green.

A separate pre-existing hook limitation was reproduced only by directly replacing the RPC client while recording with enabled=true throughout. It behaves identically on baseline and this PR. Current native route identity keys and pinned hosted-page clients prevent the direct swap exercised; no normal user route was established. It is retained as a separate hardening concern, not presented as fixed here.

The merged contribution must preserve Co-authored-by: Wooseong Kim <[email protected]> and references to community #30316 and #30513.

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.

fix(mobile): reread the host dictation mode when the session connects fix(mobile): hide composer microphones when dictation is disabled

1 participant