Repository navigation
Description
Review findings from #10917 (desktop microphone picker / Ray-Ban Meta support) deferred because they change shared capture-lifecycle behavior that can only be verified on macOS hardware:
-
Preferred mic is not reapplied when it reconnects. If the selected device (e.g. Ray-Ban Meta glasses) disconnects during transcription,
AudioCaptureServicefalls back to the system default and keeps observing only that route. When the device comes back, nothing re-resolves the persisted UID — the session keeps recording from the fallback while Settings still shows the preferred mic selected. Fix direction: have the capture service (orAppState) observekAudioHardwarePropertyDevicesand restart through the existingrestartTranscriptionIfNeeded()path when the saved UID resolves again. -
Live mic switch races the old capture's HAL teardown.
restartTranscriptionIfNeeded()stops the oldAudioCaptureServiceasynchronously and starts the replacement on a fixed delay;stopCapture()documents that HAL teardown can block for seconds, so the new IOProc can open while the old one is still alive — on Bluetooth devices this recreates the A2DP↔HFP profile-flap contention the picker is meant to avoid. Fix direction: await the old service'swaitForPhysicalStop()before constructing the replacement, instead of the timer. This is pre-existing behavior of the shared restart path (every settings-triggered restart has this window), so it needs its own verification pass on hardware. -
Active PTT turn vs. ambient capture arbitration. feat(desktop): microphone picker with Ray-Ban Meta glasses support (port of #9181) #10917 arbitrates the parked warm PTT capture before ambient transcription opens (release + await physical stop), and PTT's routing yields to devices other captures hold — but an ambient start during a live PTT turn (e.g. Listening enabled mid-locked-turn) still opens a second IOProc if both resolve to the same device. This overlap predates feat(desktop): microphone picker with Ray-Ban Meta glasses support (port of #9181) #10917 (no arbitration existed at all); governing it means deciding which owner yields mid-turn — a product behavior decision plus a hardware-verified teardown handshake.
-
Silent-mic watchdog state is unsynchronized across threads. The watchdog counters (
consecutiveSilentWindows, fire bookkeeping, window peaks) are mutated byhandleAudioInputon the HAL IO thread and reset from the main actor — both by main's pre-existingstopCapture()-entry reset and by feat(desktop): microphone picker with Ray-Ban Meta glasses support (port of #9181) #10917's warm-adoption reset. Correct fix is a lock-guarded watchdog state container (e.g.OSAllocatedUnfairLock) on the hot audio path, which needs hardware verification that recovery behavior is unchanged. Worst case of the current race is one missed or spurious silent-mic recovery trigger, which self-corrects on the next watchdog window. -
Route-change reconfiguration leaves the new device unreserved for ~300 ms. When an active default-input capture follows a system route change from device A to device B,
handleConfigurationChange()stops A and waits ~300 ms beforereconfigureAfterChange()resolves and registers B. Through that window the registry still carries the owner's entry for A — sohasActiveCapture()stays true and the Bluetooth-contention fallback still yields — but a PTT turn checkingisDeviceActivelyCaptured(B)sees B free and can open it just before the ambient reconfiguration does. Fix direction: a reserving registry state (owner marked "reconfiguring", or B reserved at route-change time) so routing cannot admit a second owner mid-transition; needs hardware verification with real route flaps.
Evidence: review threads on #10917 (Codex P1/P2 across four rounds). All need physical-device verification (paired Bluetooth mic, disconnect/reconnect cycles, live PTT + ambient overlap, route flaps) before landing.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn review
Activity
fix(desktop): address contention-policy review findings
fix(desktop): hold registry ownership through HAL teardown + route-me…
fix(desktop): non-reusable registry tokens + displaced-park teardown …
fix(desktop): avoid AppState+Transcription line-count ratchet growth (B…
fix(desktop): gate preferred-mic reconnect on live capture (BasedHard…
fix(desktop): drop source-inspection tripwire from preferred-mic tests (
fix(desktop): cover PreferredMicrophoneReconnect in capture-lifecycle…
style(desktop): swift-format AppState+Transcription without line-coun…
fix(desktop): reapply preferred mic when it reconnects during transcr…
fix(desktop): avoid AppState+Transcription line-count ratchet growth (B…
fix(desktop): gate preferred-mic reconnect on live capture (BasedHard…
fix(desktop): drop source-inspection tripwire from preferred-mic tests (
fix(desktop): cover PreferredMicrophoneReconnect in capture-lifecycle…
style(desktop): swift-format AppState+Transcription without line-coun…
fix(desktop): reapply preferred mic when it reconnects during transcr…