Ray-Ban Meta: a failed audio start is swallowed and capture shows recording with no audio
TL;DR: When capture attaches to Ray-Ban Meta glasses, the connector creates the audio subscription, then starts the native HFP capture inside a try/catch that only logs. If the start fails (the selected microphone disappeared, the audio session is busy), the caller still gets a subscription, capture enters device recording ("Listening"), and no audio ever arrives. The wedge monitor ignores Ray-Ban, so nothing recovers it. Reproduced on the iOS Simulator with the real RayBanMetaDeviceConnection.
Product impact (see PRODUCT.md and ISSUE_TRIAGE_GUIDE.MD)
- Primary loop layer: Capture
- [x] Involves data loss, failed capture, or broken sync/trust. Failed capture that looks like it is working: the user thinks Omi is listening and nothing is recorded.
Describe the bug
The transport rethrows correctly; the connector is where the error is lost.
To Reproduce
- Connect Ray-Ban Meta glasses.
- Start capture while the native audio start fails (for example the selected audio-only mic is no longer available).
- Home shows the glasses recording; no transcript and no audio arrive.
Current behavior
The listener call returns a subscription and does not throw; zero frames; no error reaches the caller.
Expected behavior
A failed start fails the attach (throw or return null) so capture shows an error and can retry, and Ray-Ban sources are covered by the wedge monitor.
Screenshots
No screenshot. Evidence below.
user ID (can we access the user info to validate the bug?):
Not needed: found in the code and reproduced without a user account (local fixture backend).
Smartphone + device (please complete the following information):
- Device: iOS Simulator, iPhone 16 (reproduction); the bug is in shared code, so physical iPhones are affected too
- OS: iOS 18.0 (Simulator)
- App Version:
mainat cf8201c2f5 (dev flavor) - Device version: Ray-Ban Meta
Additional context
Root cause. RayBanMetaDeviceConnection.performGetBleAudioBytesListener listens first, then try { await _metaTransport.startAudioCapture(); } catch (e) { Logger.debug(...) } and returns the subscription. The transport rethrows. Capture treats a non-null subscription as ready (capture_controller.dart:1927) and publishes device recording without requiring a frame (:2127). isCaptureSourceInScope only covers omi and friend_com.
Reproduction. Reproduced on the iOS Simulator (iPhone 16, iOS 18.0) with a temporary integration test on main at cf8201c2f5. The test drives the real production classes; only the platform boundary is faked (the RayBanMetaTransport: empty audio stream, startAudioCapture() throws PlatformException(hfp_start_failed)):
OMI_FACT:c15-rayban-start-failure-swallowed:startAudioCaptureCalls=1
OMI_FACT:c15-rayban-start-failure-swallowed:subscriptionReturned=true
OMI_FACT:c15-rayban-start-failure-swallowed:callerError=null
OMI_FACT:c15-rayban-start-failure-swallowed:framesReceived=0
OMI_FACT:c15-rayban-start-failure-swallowed:streamErrors=0
OMI_REPRO:c15-rayban-start-failure-swallowed:REPRODUCED
Submitted fix in PR #20819.
Summary of changes:
- In
RayBanMetaDeviceConnection.performGetBleAudioBytesListener, canceled the stream subscription and rethrown errors whenstartAudioCapture()throws rather than swallowing the failure. - In
CaptureController.streamAudioToWs, caught audio listener setup exceptions to returnfalse. - In
CaptureController._initiateDeviceAudioStreaming, guarded against transitioning intoRecordingState.deviceRecord("Listening") whenforegroundAudioReadyisfalse, and guarded_resumeDeviceTailBody. - In
CaptureWedgeMonitor.isCaptureSourceInScope, addedrayban_metaso stale/silent capture sessions are detected and recovered by the wedge monitor. - Added hermetic unit tests in
app/test/unit/rayban_meta_audio_capture_failure_test.dartand passed allmake preflightchecks.
Opened PR #23386 cleanly rebased on latest main (including capture_uplink_policy.dart) with zero formatting churn in capture_controller.dart and unit tests in app/test/unit/rayban_meta_audio_capture_failure_test.dart.
cc @undivisible @Git-on-my-level
Base USDC settlement address: 0x710227494f862939f9c129f612f7e49e131347f5
Submitted PR #23510 resolving this issue.
Root Cause & Fix
- Subscription cancellation & null return: In
RayBanMetaDeviceConnection.performGetBleAudioBytesListener, whenstartAudioCapture()throws an error, we now cleanlyawait subscription.cancel()and returnnullinstead of leaking an empty listener. - Preventing false recording state: In
CaptureController._onDeviceAttached, when!foregroundAudioReady, we now exit early with a debug log rather than transitioning toRecordingState.deviceRecord. - Watchdog tracking: Added
'rayban_meta'toCaptureWedgeMonitor.isCaptureSourceInScopeso that watchdog and wedge telemetry tracks Ray-Ban Meta capture sessions. - Unit Tests: Added test coverage in
rayban_meta_connection_test.dartandcapture_wedge_monitor_test.dart.
Bounty payout wallet: 0xC345C07229307d4f1c7935aD2cAe48e390215808