Skip to content

fix(mobile): hide composer microphones when dictation is disabled - #30316

Closed
innocarpe wants to merge 2 commits into
stablyai:mainfrom
innocarpe:ios-dictation-control-20261018
Closed

innocarpe wants to merge 2 commits into
stablyai:mainfrom
innocarpe:ios-dictation-control-20261018

Conversation

@innocarpe

@innocarpe innocarpe commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Turning voice dictation off in Settings leaves microphone actions visible in the terminal and chat composer. A disabled feature should not keep inviting the user to start it.

What Changed

Carry the host's enabled flag through session state and conditionally show microphone actions in live, buffered and chat input. Keep photo attachment available and retain the existing controls when dictation is enabled.

Why

Use the existing voice setup response rather than introducing another preference or changing capture permissions.

Linked Issue

Fixes #30307

Visual Proof

Actual input-actions component with dictation enabled versus disabled. The attachment action remains visible.

Enabled Disabled
dictation dictation-off

Isolated browser rendering; no native microphone capture is claimed.

Testing

Application typecheck and disabled-control/capture regressions verify that the mic disappears, attachment stays actionable and re-enabling restores dictation.

Changed-file formatting and lint passed. The full mobile suite and a release build were not completed locally; the focused checks above are the local evidence. Physical-device behavior remains unverified. The existing host protocol is retained; remote-host interaction has not been exercised on a physical device.

AI Disclosure

Prepared with OpenAI Codex.

Review

One independently reviewable user behavior.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material is copied.

Checklist

  • Small and focused
  • Explained behavior, mechanism and approach
  • Automated regression or rendering evidence described above
  • Self-reviewed for correctness, security and performance
  • Cross-platform, remote-host and compatibility impact considered
  • Full application build; CI will cover this

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

The session now tracks dictation availability from the voice setup response. It passes that state to terminal and chat composer controls. When dictation is disabled, the terminal composer omits its microphone action, and the chat overlay receives no microphone handler. Photo attachment remains available.

Priority: ⬇️ Low

Severity of issue fixed: Low

Merge Risk: 🔵 Low · up to ae3a9

A disabled host may briefly expose microphone controls, and a failed refresh may leave them hidden after dictation is enabled. These are bounded UI availability issues; the change is mergeable with awareness.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Issue #30307 requires the host dictation flag to reach live, buffered, and chat inputs. The diff adds dictationEnabled to session state, updates it from fetchDictationSetup, passes it through both…
Out of Scope Changes check Passed The changed files directly support issue #30307. They update session state, dictation setup handling, terminal and chat composer rendering, and focused regression coverage. No unrelated cleanup, prefe…
Title check Passed The title clearly and concisely describes the main change: hiding composer microphone controls when dictation is disabled.
Description check Passed The description covers the user impact, implementation, rationale, linked issue, visual proof, testing evidence, limitations, and checklist. The Notes section is omitted, but the relevant compatibilit…
Full details: Linked Issues check

Explanation

Issue #30307 requires the host dictation flag to reach live, buffered, and chat inputs. The diff adds dictationEnabled to session state, updates it from fetchDictationSetup, passes it through both command-dock paths, and conditionally passes the chat microphone handler. MobileTerminalInputActions hides only the microphone when disabled and retains photo attachment. Its default enabled behavior preserves existing controls. The added regression test verifies attachment action, microphone removal, and restoration after re-enabling.

Full details: Out of Scope Changes check

Explanation

The changed files directly support issue #30307. They update session state, dictation setup handling, terminal and chat composer rendering, and focused regression coverage. No unrelated cleanup, preference, permission, protocol, or distribution changes are present in the reviewed diff.

Full details: Description check

Explanation

The description covers the user impact, implementation, rationale, linked issue, visual proof, testing evidence, limitations, and checklist. The Notes section is omitted, but the relevant compatibility and testing considerations are addressed elsewhere.

  • Fix all pre-merge checks with AI
  • 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments: 1
mobile/src/session/mobile-dictation-disabled-controls.test.tsx: 1

1-42: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add caller-level regression tests for disabled dictation.

The new test covers only MobileTerminalInputActions. It does not exercise the live or buffered MobileSessionCommandDock paths, or the chat caller. Existing tests would still pass if either caller stopped hiding its microphone.

Add tests that disable dictation at each caller boundary and assert that the live, buffered, and chat microphone controls are absent.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: af88c500-f5fc-4d42-a31a-09def0bd6ea0
📥 Commits

Reviewing files that changed from the base of the PR and between 2d1ec53 and ae3a973ecdd05270f370337819534597dd78f9af.

📒 Files selected for processing: 7
  • 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/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; 3 remain after this review.

@@ -211,6 +212,7 @@ export function useMobileSessionNativeChatDictation(
try {
const setup = await fetchDictationSetup(client)
setDictationMode(setup.dictationMode)
setDictationEnabled(setup.enabled !== false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

set -o pipefail
printf '%s\n' '--- changed file and nearby definitions ---'
nl -ba mobile/src/session/use-mobile-session-native-chat-dictation.ts | sed -n '1,280p'
printf '%s\n' '--- references and likely lifecycle symbols ---'
rg -n -F --glob '*.{ts,tsx,md}' -e 'refreshDictationMode' -e 'fetchDictationSetup' -e 'dictationEnabled' -e 'hostId' -e 'session' mobile/src mobile 2>/dev/null | sed -n '1,260p'
printf '%s\n' '--- changed hunks against supplied base ---'
git diff --unified=50 10505696a2c3c9882bbccdadce9a9a6cdcb2d53e ae3a973ecdd05270f370337819534597dd78f9af -- mobile/src/session/use-mobile-session-native-chat-dictation.ts
printf '%s\n' '--- focused tests/docs filenames ---'
rg --files mobile | rg -i '(dictat|session|chat).*(test|spec)|(^|/)(test|tests|docs?)(/|$)' | sed -n '1,240p'

Repository: stablyai/orca

Length of output: 41261


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- exact dictation state ownership ---'
rg -n -F --glob '*.{ts,tsx}' -e 'setDictationEnabled' -e 'dictationEnabled' mobile/src | sed -n '1,220p'
printf '%s\n' '--- hook composition and host/session lifecycle ---'
rg -n -F --glob '*.{ts,tsx}' -e 'useMobileSessionNativeChatDictation(' -e 'useMobileSessionFeedbackCapabilities(' -e 'MobileSessionFeedbackCapabilitiesModel' mobile/src/session mobile/src/app mobile/app 2>/dev/null | sed -n '1,260p'
printf '%s\n' '--- setup implementation and consumers ---'
nl -ba mobile/src/dictation/mobile-dictation-setup.ts | sed -n '1,240p'
rg -n -F --glob '*.{ts,tsx,md}' -e 'fetchDictationSetup' -e 'dictationMode' -e 'Voice dictation' mobile/src mobile/docs docs 2>/dev/null | sed -n '1,260p'
printf '%s\n' '--- focused test ---'
nl -ba mobile/src/session/mobile-dictation-disabled-controls.test.tsx | sed -n '1,320p'

Repository: stablyai/orca

Length of output: 20778


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- screen state owner ---'
nl -ba mobile/src/session/use-mobile-session-screen-state.ts | sed -n '1,290p'
printf '%s\n' '--- session controller composition ---'
nl -ba mobile/src/session/use-mobile-session-controller.ts | sed -n '1,180p'
printf '%s\n' '--- route/session component lifecycle references ---'
rg -n -F --glob '*.{ts,tsx}' -e 'useMobileSessionController' -e 'useMobileSessionScreenState' -e 'MobileSessionActiveContent' -e 'worktreeId]' -e 'hostId]' mobile/src app 2>/dev/null | sed -n '1,280p'

Repository: stablyai/orca

Length of output: 41517


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- session route screen ---'
nl -ba mobile/src/session/MobileSessionRouteScreen.tsx | sed -n '1,180p'
printf '%s\n' '--- app session route ---'
nl -ba 'mobile/app/h/[hostId]/session/[worktreeId].tsx' | sed -n '1,180p'
printf '%s\n' '--- session foundation ---'
nl -ba mobile/src/session/use-mobile-session-foundation.ts | sed -n '1,260p'
printf '%s\n' '--- host client binding ---'
nl -ba mobile/src/transport/host-client-hooks.ts | sed -n '1,130p'

Repository: stablyai/orca

Length of output: 15851


Reset dictation visibility when setup refresh fails.

When a refresh follows a change in Voice settings and fetchDictationSetup fails, the catch block keeps the previous dictationEnabled value. If the previous response disabled dictation, the reachable composer can keep its microphone hidden after dictation is enabled on the host. Reset the value to the default enabled state in this fallback.

🐛 Suggested fix
    } catch {
      // Non-fatal: fall back to the default toggle behavior.
+     setDictationEnabled(true)
    }

Comment on lines +126 to +127
// False only once the host says Settings ▸ Voice dictation is off; the mic button is then hidden.
const [dictationEnabled, setDictationEnabled] = useState(true)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,100p' mobile/src/session/MobileNativeChatOverlay.tsx
sed -n '215,245p' mobile/src/session/MobileSessionActiveContent.tsx
sed -n '330,375p' mobile/src/session/MobileNativeChatComposer.tsx
sed -n '200,230p' mobile/src/session/use-mobile-session-native-chat-dictation.ts
rg -n 'MobileWebShellScreen|MobileSessionActiveContent|MobileSessionCommandDock|useFocusEffect' mobile/src/session mobile/app/h

Repository: stablyai/orca

Length of output: 15193


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- MobileNativeChatOverlay ---'
nl -ba mobile/src/session/MobileNativeChatOverlay.tsx | sed -n '90,230p'
printf '%s\n' '--- MobileNativeChatComposer mic and props ---'
rg -n -F -- 'onMicPress' mobile/src/session/MobileNativeChatComposer.tsx mobile/src/session/use-mobile-native-chat-composer-tray.ts
nl -ba mobile/src/session/MobileNativeChatComposer.tsx | sed -n '1,95p;320,395p'
printf '%s\n' '--- terminal actions and active content ---'
nl -ba mobile/src/session/MobileTerminalInputActions.tsx | sed -n '1,145p'
nl -ba mobile/src/session/MobileSessionActiveContent.tsx | sed -n '1,80p;150,260p'
printf '%s\n' '--- screen state, mounting, and dictation callbacks ---'
nl -ba mobile/src/session/use-mobile-session-screen-state.ts | sed -n '90,155p'
rg -n -F -e 'useMobileSessionScreenState' -e 'MobileSessionContentRow' -e 'handleDictationToggle' -e 'handleDictationPressIn' -e 'handleDictationPressOut' mobile/src/session
nl -ba mobile/src/session/use-mobile-session-native-chat-dictation.ts | sed -n '1,110p;150,235p'

Repository: stablyai/orca

Length of output: 43244


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- MobileSessionCommandDock ---'
nl -ba mobile/src/session/MobileSessionCommandDock.tsx | sed -n '1,90p;255,315p;330,380p'
printf '%s\n' '--- MobileSessionContentRow and surface ---'
nl -ba mobile/src/session/MobileSessionContentRow.tsx | sed -n '1,90p'
nl -ba mobile/src/session/MobileSessionSurface.tsx | sed -n '1,70p'
printf '%s\n' '--- controller composition and session screen ---'
nl -ba mobile/src/session/use-mobile-session-controller.ts | sed -n '1,75p'
nl -ba mobile/src/mobile-web-shell/MobileWebShellScreen.tsx | sed -n '1,120p'

Repository: stablyai/orca

Length of output: 24259


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- MobileSessionSurface callers ---'
rg -n -F -- 'MobileSessionSurface' mobile/src mobile/app
printf '%s\n' '--- session content loading guards ---'
rg -n -F -e 'MobileSessionSurface' -e 'showLoadingState' -e 'connState' mobile/src/session/MobileSession*.tsx mobile/src/mobile-web-shell mobile/app/h/' || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 1136


🏁 Script executed:

nl -ba mobile/src/session/MobileSessionRouteScreen.tsx | sed -n '1,80p'

Repository: stablyai/orca

Length of output: 830


Keep microphone controls hidden until dictation setup resolves.

dictationEnabled starts as true, while refreshDictationMode updates it only after fetchDictationSetup resolves. The session mounts MobileSessionSurface immediately. Therefore, a host with dictation disabled can briefly render an actionable terminal or chat microphone before the response sets the state to false.

Initialize the state as disabled and restore the default-enabled fallback when setup fails.

Suggested fix
-  // False only once the host says Settings ▸ Voice dictation is off; the mic button is then hidden.
-  const [dictationEnabled, setDictationEnabled] = useState(true)
+  // Keep microphone controls hidden until the host reports dictation capability.
+  const [dictationEnabled, setDictationEnabled] = useState(false)
     } catch {
       // Non-fatal: fall back to the default toggle behavior.
+      setDictationEnabled(true)
     }

@innocarpe
innocarpe force-pushed the ios-dictation-control-20261018 branch from ae3a973 to 9b717de Compare October 18, 2026 10:41
nwparker added a commit that referenced this pull request Oct 21, 2026
Honor enabled voice settings across terminal/chat controls and capture. Refresh hold/toggle state on connection, focus and foreground while fencing stale replies.

Adversarial review: 63 existing tests plus six disable/late-finish/unmount/settings ownership probes pass; final required CI and aggregate gate pass. Existing native screenshots and microphone lifecycle exercise are attached to the PR.

Fixes #30307. Fixes #30511.
Adapted from community #30316 and #30513 by @innocarpe.

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

Copy link
Copy Markdown
Contributor

Closing as superseded by merged #31349 (12e0b37293c24273aa8f0a15b258f4cb5c5f0af0), which carries this disabled-mic contribution together with #30513's reconnect/foreground refresh. Wooseong Kim is credited as co-author in the actual merged commit.

The merged implementation preserves photo attachments and gates capture as well as visible controls. Native before/after screenshots and recording/reconnect exercise are attached to #31349. Before merging, independent adversarial review passed 63 existing tests plus six disable/late-finish/unmount/settings-race probes; CI and aggregate gate passed. Thank you @innocarpe.

@nwparker nwparker closed this Oct 21, 2026
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): hide composer microphones when dictation is disabled

2 participants