omi icon indicating copy to clipboard operation
omi copied to clipboard

Ray-Ban Meta: a failed audio start is swallowed and capture shows recording with no audio

Open Itaxh1 opened this issue 1 month ago • 3 comments

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

  1. Connect Ray-Ban Meta glasses.
  2. Start capture while the native audio start fails (for example the selected audio-only mic is no longer available).
  3. 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: main at 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

Itaxh1 avatar Oct 06 '26 06:10 Itaxh1

Submitted fix in PR #20819.

Summary of changes:

  • In RayBanMetaDeviceConnection.performGetBleAudioBytesListener, canceled the stream subscription and rethrown errors when startAudioCapture() throws rather than swallowing the failure.
  • In CaptureController.streamAudioToWs, caught audio listener setup exceptions to return false.
  • In CaptureController._initiateDeviceAudioStreaming, guarded against transitioning into RecordingState.deviceRecord ("Listening") when foregroundAudioReady is false, and guarded _resumeDeviceTailBody.
  • In CaptureWedgeMonitor.isCaptureSourceInScope, added rayban_meta so 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.dart and passed all make preflight checks.

Aj2280 avatar Oct 06 '26 10:10 Aj2280

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

ocakciomursel-pixel avatar Oct 23 '26 09:10 ocakciomursel-pixel

Submitted PR #23510 resolving this issue.

Root Cause & Fix

  1. Subscription cancellation & null return: In RayBanMetaDeviceConnection.performGetBleAudioBytesListener, when startAudioCapture() throws an error, we now cleanly await subscription.cancel() and return null instead of leaking an empty listener.
  2. Preventing false recording state: In CaptureController._onDeviceAttached, when !foregroundAudioReady, we now exit early with a debug log rather than transitioning to RecordingState.deviceRecord.
  3. Watchdog tracking: Added 'rayban_meta' to CaptureWedgeMonitor.isCaptureSourceInScope so that watchdog and wedge telemetry tracks Ray-Ban Meta capture sessions.
  4. Unit Tests: Added test coverage in rayban_meta_connection_test.dart and capture_wedge_monitor_test.dart.

Bounty payout wallet: 0xC345C07229307d4f1c7935aD2cAe48e390215808

Dimank92 avatar Oct 24 '26 13:10 Dimank92