Skip to content

feat(desktop): let users choose PTT microphone - #10393

Merged
Git-on-my-level merged 5 commits into
mainfrom
codex/ptt-microphone-preference
Jul 23, 2026
Merged

Git-on-my-level merged 5 commits into
mainfrom
codex/ptt-microphone-preference

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 23, 2026 •

Copy link
Copy Markdown
Member

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

Review in cubic

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

@Git-on-my-level
Git-on-my-level force-pushed the codex/ptt-microphone-preference branch from 8b36be4 to e4926a2 Compare July 23, 2026 06:36
Git-on-my-level and others added 4 commits July 23, 2026 16:31
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
@Git-on-my-level
Git-on-my-level force-pushed the codex/ptt-microphone-preference branch from f38029b to c0a79ec Compare July 23, 2026 09:32
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Monitor run — review feedback addressed + CI fixes

Both Codex review threads were already addressed in prior commits on this branch (f38029ba):

  • P2 — Remove fake PTT routing coverage: PushToTalkManager+InputDeviceRouting.swift was removed from ptt-lifecycle.yaml (it wasn't actually exercised by the flow).
  • P2 — Route Omni fallback through selected mic: startMicCapture() in the Omni STT fallback now calls preferredPTTInputOverrideDeviceID().

Both threads resolved as addressed.

Additional CI fixes pushed:

  • Added PushToTalkManager+InputDeviceRouting.swift back to ptt-lifecycle.yaml covers — now accurate because the Omni fallback routing fix (commit f38029ba) means the PTT lifecycle flow genuinely exercises this helper.
  • Added Failure-Class: none trailer to the fix(desktop): commit (required by failure-class-protocol).

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Monitor run — Hygiene/failure-class-protocol CI fix

The prior run's code fixes (both Codex threads) were already pushed and resolved. This run fixed the remaining Hygiene CI failure: the Failure-Class: none declaration was in the commit trailer but needed to be in the PR body for the failure-class-protocol check to validate it. Added the ## Failure class (fixes) section to the PR body.

All CI checks now pass (including Desktop Swift Test Suites).

@Git-on-my-level

Copy link
Copy Markdown
Member Author

@cursor resolve merge conflict

@cursor

cursor Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

Merge conflict resolved and pushed to codex/ptt-microphone-preference.

Conflict: .github/scripts/product_file_line_count_ratchet_baseline/desktop-swift-floatingcontrolbar.json

Resolution:

  • Kept RealtimeHubController.swift (1507 lines) from main
  • Set PushToTalkManager.swift to the merged line count: 2584 (was 2439 on the branch, 2593 on main)

All other files merged cleanly, including:

  • PushToTalkManager.swift — PTT mic routing + main’s PTT lifecycle diagnostics
  • ptt-lifecycle.yaml — both PushToTalkManager+InputDeviceRouting.swift and main’s RealtimeHub covers

Merge commit: 0d0a7e9825

Open in Web Open in Cursor 

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]>
@Git-on-my-level
Git-on-my-level merged commit d797a7d into main Jul 23, 2026
26 of 27 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/ptt-microphone-preference branch July 23, 2026 18:29
kodjima33 added a commit that referenced this pull request Aug 13, 2026
…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
kodjima33 added a commit that referenced this pull request Aug 13, 2026
…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
kodjima33 added a commit that referenced this pull request Aug 13, 2026
…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.
undivisible pushed a commit to undivisible/omi that referenced this pull request Sep 29, 2026
## 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. -->
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.

2 participants