Repository navigation
Conversation
CI status: the one red check is pre-existing on
|
#9081) PTT silent turns reported recovery_action=none / recovery_result=not_attempted for 169 users on 0.12.0 (1,104 events), so a dead mic never self-healed. Root cause: PTTSilentMicRecoveryPolicy.recordDiscardedTurn treated every turn under minDeadTurnSeconds (0.25s) as evidence the mic was alive and reset consecutiveDeadMicTurns. A turn that captured no frames at all - the key release beating CoreAudio's asynchronous capture start - carries no evidence either way, but it erased the streak, so the 2-turn recovery threshold was never reached when a dead mic interleaved with taps. Absence of evidence was being treated as evidence of health. Fix: audible input (peak > deadMicPeakThreshold) resets the streak, a judgeable silent turn increments it, and a too-short/zero-frame turn is neutral. Verification: - New PTTSilentMicRecoveryPolicyTests.testZeroFrameTurnDoesNotEraseDeadMicStreak fails on the old code (streak 0, recovery never fires) and passes on the fix. - xcrun swift test --filter "PTT|PushToTalk|VoiceTurn|DesktopDiagnostics": 65 tests, 0 failures. Debug build green.
e16390b to
f114d69
Compare
|
Hey @kodjima33 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Bug
Fixes #9081. Desktop health telemetry shows
ptt_audio_capture_silent_turnon macOS 0.12.0 hold mode affecting 169 users / 1,104 events, every one of them reportingrecovery_action=none,recovery_result=not_attempted. PTT has a dead-mic self-heal — it simply never fired for the users who needed it, so a dead microphone stayed dead turn after turn with no recovery attempted.Root cause
PTTSilentMicRecoveryPolicy.recordDiscardedTurn(PushToTalkManager.swift) decides whether consecutive silent turns should trigger a CoreAudio capture rebuild:Every turn shorter than
minDeadTurnSeconds(0.25s) fell into theelsebranch and reset the dead-mic streak. Crucially that includes turns which captured no frames at all:startMicCapturestarts CoreAudio asynchronously (AudioDeviceStartis blocking HAL IPC tocoreaudiod), so a key release that beats capture start finalizes a turn withtotalSec = 0, peak = 0. Such a turn says nothing about mic health, but it erased the evidence — so with a dead mic interleaved with ordinary taps,consecutiveDeadMicTurnsnever reached the threshold of 2 and recovery was never requested. All fourrecordPTTSilentTurncall sites (hub, omni, batch, warm-wait fallback) deriverecovery_action/recovery_resultfrom this one return value, which is why the field data is uniformlynone/not_attempted.The failure class: absence of evidence was treated as evidence of health.
Fix
Make each outcome carry only the evidence it actually has:
peak > deadMicPeakThreshold) proves the mic is alive → reset the streaktotalSec >= minDeadTurnSeconds, near-zero peak) → incrementThree-line behavior change in the policy struct; no call sites, thresholds, or telemetry fields changed.
Verification
PTTSilentMicRecoveryPolicyTests.testZeroFrameTurnDoesNotEraseDeadMicStreakreproduces the field scenario (dead turn → zero-frame turn → dead turn). It fails on the old code (consecutiveDeadMicTurns0 instead of 1; recovery never returnstrue) and passes on the fix. AddedtestAudibleShortTapResetsDeadMicStreakto pin the other direction.xcrun swift test --package-path Desktop --filter "PTT|PushToTalk|VoiceTurn|DesktopDiagnostics"→ 65 tests, 0 failures (incl.PTTAudioCaptureRaceTests,PTTSilentTurnRecoveryWiringTests,PushToTalkStateMachineTests,DesktopDiagnosticsManagerTests).xcrun swift build -c debug --package-path Desktop→ green.make preflight→ green.Hermetic unit coverage of a pure policy struct; not exercised against a physically dead microphone on prod hardware.
Product invariants
Path-matched by
desktop/macos/Desktop/Sources/FloatingControlBar/PushToTalkManager.swift:Follow-up (not in this PR)
The zero-frame turns themselves come from the release beating asynchronous CoreAudio capture start. Closing that race means changing the turn state machine's capture-start/finalize ordering — a wider blast radius than this fix warrants, and it remains tracked by #9081's investigation items.
🤖 automated by the hourly desktop bug watchdog.