Repository navigation
feat(desktop): let users choose PTT microphone - #10393
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b36be49af
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
8b36be4 to
e4926a2
Compare
Address Codex review feedback: 1. Thread #PRRT_kwDOLkKqys6TKH6L — Remove fake 'covers' entry for PushToTalkManager+InputDeviceRouting.swift from ptt-lifecycle.yaml. The ptt_start automation flow sets automationExercisesRealtimePath=false, which returns before microphone routing is ever invoked, so the cover entry was misleading. 2. Thread #PRRT_kwDOLkKqys6TKH6S — Route the startOmniTranscription fallback through preferredPTTInputOverrideDeviceID(). When hub admission is rejected, the Omni STT fallback called bare startMicCapture(), bypassing both the user-selected mic override and the Automatic Bluetooth-built-in fallback. This is a real gap in the PR's feature. Failure-Class: none
f38029b to
c0a79ec
Compare
Monitor run — review feedback addressed + CI fixesBoth Codex review threads were already addressed in prior commits on this branch (
Both threads resolved as addressed. Additional CI fixes pushed:
|
Monitor run — Hygiene/failure-class-protocol CI fixThe prior run's code fixes (both Codex threads) were already pushed and resolved. This run fixed the remaining All CI checks now pass (including Desktop Swift Test Suites). |
|
@cursor resolve merge conflict |
|
Merge conflict resolved and pushed to Conflict: Resolution:
All other files merged cleanly, including:
Merge commit: |
Resolve line-count ratchet conflict in desktop-swift-floatingcontrolbar.json: keep RealtimeHubController.swift entry from main and set PushToTalkManager.swift baseline to the merged file count (2584). Co-authored-by: David Zhang <[email protected]>
…e setting
Nik's prod log: 31 silent-mic detections and 14 "Microphone Isn't Capturing Audio"
alerts in one sitting, on a loop roughly every 60-90s.
13:53:52 Started session (device: AirPods Max)
13:54:00 Bluetooth mic returning silence for 2s — falling back to built-in mic
13:54:00 Using override device ID 86 <- built-in
13:54:12 Input device returning silence for 2s — rebuilding CoreAudio capture
13:54:15 Bluetooth mic returning silence for 2s — falling back to built-in mic
`handleSilentMicFallback` pins capture to the built-in mic, then
`rebuildCoreAudioCaptureStack` builds a plain `AudioCaptureService()` with no override,
which re-resolves the *system default* — still the silent AirPods Max. The heal and its
own recovery fight until the 3-attempt cap trips the modal, then it repeats. A heal a
rebuild can undo is not a heal.
- `silentMicHealedDeviceID` holds the healed route for the session; the rebuild honours
it. Cleared at session start and stop so it cannot outlive its reason.
- `SilentMicRoutePolicy` states the contract as a pure function, with tests: a healed
device outranks the system default.
Separately, push-to-talk carried its own microphone picker in Shortcuts settings
(#10393), so a user could choose a mic in one place and be recorded by another. There is
one physical microphone; there is now one setting. The duplicate card is removed and PTT
reads the transcription setting, with a one-time migration so an existing PTT-only choice
is carried over rather than dropped.
Verified on the running named bundle omi-mic: Shortcuts shows no microphone card,
Transcription shows the single picker. 25 focused tests pass.
The alert loop itself is UNVERIFIED end-to-end — reproducing it needs a Bluetooth mic
returning zero samples during a live session. The mechanism above is from the prod log.
Failure-Class: none
…e setting
Nik's prod log: 31 silent-mic detections and 14 "Microphone Isn't Capturing Audio"
alerts in one sitting, on a loop roughly every 60-90s.
13:53:52 Started session (device: AirPods Max)
13:54:00 Bluetooth mic returning silence for 2s — falling back to built-in mic
13:54:00 Using override device ID 86 <- built-in
13:54:12 Input device returning silence for 2s — rebuilding CoreAudio capture
13:54:15 Bluetooth mic returning silence for 2s — falling back to built-in mic
`handleSilentMicFallback` pins capture to the built-in mic, then
`rebuildCoreAudioCaptureStack` builds a plain `AudioCaptureService()` with no override,
which re-resolves the *system default* — still the silent AirPods Max. The heal and its
own recovery fight until the 3-attempt cap trips the modal, then it repeats. A heal a
rebuild can undo is not a heal.
- `silentMicHealedDeviceID` holds the healed route for the session; the rebuild honours
it. Cleared at session start and stop so it cannot outlive its reason.
- `SilentMicRoutePolicy` states the contract as a pure function, with tests: a healed
device outranks the system default.
Separately, push-to-talk carried its own microphone picker in Shortcuts settings
(#10393), so a user could choose a mic in one place and be recorded by another. There is
one physical microphone; there is now one setting. The duplicate card is removed and PTT
reads the transcription setting, with a one-time migration so an existing PTT-only choice
is carried over rather than dropped.
Verified on the running named bundle omi-mic: Shortcuts shows no microphone card,
Transcription shows the single picker. 25 focused tests pass.
The alert loop itself is UNVERIFIED end-to-end — reproducing it needs a Bluetooth mic
returning zero samples during a live session. The mechanism above is from the prod log.
Failure-Class: none
…e setting (#11421) ## Silent-mic alert loop Nik's prod log shows **31 silent-mic detections and 14 alerts** in one sitting, roughly one modal every 60–90s: ``` 13:53:52 Started session (device: AirPods Max) 13:54:00 Bluetooth mic returning silence for 2s — falling back to built-in mic 13:54:00 Using override device ID 86 <- built-in 13:54:12 Input device returning silence for 2s — rebuilding CoreAudio capture 13:54:15 Bluetooth mic returning silence for 2s — falling back to built-in mic ``` `handleSilentMicFallback` pins capture to the built-in mic; `rebuildCoreAudioCaptureStack` then builds a plain `AudioCaptureService()` with no override, re-resolving the **system default** — still the silent AirPods Max. The heal and its own recovery fight until the 3-attempt cap trips the modal, then it repeats. AirPods Max returning zero samples is normal macOS behaviour (output-only mode). The bug is that the recovery undoes the fix. **Fix:** `silentMicHealedDeviceID` holds the healed route for the session and the rebuild honours it; cleared at session start/stop. `SilentMicRoutePolicy` states the contract as a pure, tested function. ## One microphone setting Push-to-talk carried its own picker in Shortcuts (#10393) storing `shortcut_pttInputDeviceUID`, separate from the transcription picker's `preferredMicrophoneDeviceUID` — a user could pick a mic in one place and be recorded by another. The duplicate card is removed; PTT reads the transcription setting, with a one-time migration so an existing PTT-only choice carries over. ## Verification Exercised on the running `omi-mic` bundle: - **Shortcuts** — no microphone card (screenshot) - **Transcription** — single Microphone picker - 25 focused tests pass; swift-format clean **UNVERIFIED:** the alert loop end-to-end. Reproducing it needs a Bluetooth mic returning zero samples during a live session; the mechanism above is read from the prod log rather than re-triggered. Failure-Class: none ## Product invariants affected - **INV-CHAT-1** — unchanged. This diff touches microphone *input routing* and the settings surface for it; it does not alter transcript ownership, session identity, or how a transcript is shared across surfaces. The silent-mic heal only changes which CoreAudio device a rebuilt capture reads from, and the PTT change consolidates two settings keys into the existing one.
## Summary - Add an Automatic/default PTT microphone preference and an explicit microphone override in Settings. - Persist explicit microphone choices by their stable Core Audio UID, falling back safely to Automatic when a chosen device is unavailable. - Preserve the existing Bluetooth-safe built-in microphone behavior for Automatic routing. ## Product invariants - INV-CHAT-1 - INV-VOICE-1 ## Verification - `xcrun swift test --package-path Desktop --filter ShortcutSettingsTests` - `xcrun swift build -c debug --package-path Desktop` - `python3 scripts/check_desktop_test_quality.py` ## Failure class (fixes) Failure-Class: none <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/10393?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->


Summary
Product invariants
Verification
xcrun swift test --package-path Desktop --filter ShortcutSettingsTestsxcrun swift build -c debug --package-path Desktoppython3 scripts/check_desktop_test_quality.pyFailure class (fixes)
Failure-Class: none