Repository navigation
Conversation
|
Thanks @axAilotl — this is a well-structured reliability pass. The serialized GATT scheduler (session-bound tokens, stale-callback rejection, read-while-notifying admission), notification-state coalescing, native notification routing, and the idempotent DFU connection handoff all address real races in the iOS BLE stack. The test coverage (scheduler/router/project-graph suites + the Dart DFU handoff and device-provider tests) and the new A few points worth a human maintainer's eyes before this leaves draft:
Marking for human maintainer review given the core reliability surfaces (BLE session/reconnect lifecycle, DFU ownership transfer) and the draft state. Not formally approving. Posted by the Omi PR maintainer monitor (GLM-5.2). by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
8c1321a to
fc6d75c
Compare
Failure-Class: new
Failure-Class: none
Route Omi audio batches and Limitless flash data through native handlers while leaving storage and control notifications on Dart. Add deterministic router coverage and DEBUG-only aggregate BLE throughput diagnostics. Physical iPhone testing validated sustained backlog drain, Bluetooth off/on recovery, app relaunch recovery, and automatic reconnection after CV1 OTA. Failure-Class: none
Validate MCUboot images before disconnecting, serialize the updater-to-app handoff, and force-reconnect the exact suspended device after every success, failure, cancellation, or disposal path. Legacy DFU now validates local input before relinquishing BLE ownership. Validated on an iPhone 13 Pro Max with a full CV1 MCUboot reflash: the app reclaimed the pendant automatically and resumed the exact durable sequence with no re-pair or hot restart. Failure-Class: none
Treat restored CoreBluetooth peripherals as reconnect-eligible and reissue the first unexpected-disconnect connection request synchronously so iOS can own it before suspending the app. Keep bounded backoff for actual connection failures. Test: bash app/ios/test/run_ble_gatt_scheduler_tests.sh Physical-Test: iPhone 12 Pro Max + CV1; foreground recovery resumed Listening and live marker Pearl 641, and a 26.7s offline range drained as contiguous ring WALs before device storage advanced to zero. Failure-Class: none
fc6d75c to
3f9dc74
Compare
Retry transient post-DFU reconnect failures with capped backoff, coalesce terminal callbacks, and release the lease only after ownership is reclaimed or the device is forgotten. Failure-Class: none Co-authored-by: multica-agent <[email protected]>
Build 110 composite physical evidence (2026-08-04)The session-bound iOS GATT changes in this PR were included in the exact composite dev IPA exercised on a physical iPhone/CV1.
Timing caveat: “+5 s” was marker-end to screenshot, not cold-launch-to-first-text latency, and is not being claimed as a cold-start SLO. The composite integration is preserved on fork branch |
|
Reviewed the iOS BLE serialization and DFU reconnect rework (glm-5.2 automated review). The design is coherent and well-tested; leaving detailed observations for the maintainer. Strengths
Observations for maintainer attention
Verification status: All CI checks green (Desktop Swift Build & Tests, Dart Analyze & Tests, Desktop Swift Static & Test Contracts, Formatting, Hygiene). Could not build/test locally — the worktree fetch failed (non-fast-forward on the PR head ref). Static review only. This needs maintainer sign-off on the reconnect policy and notification routing changes before merge. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
…11547) ## What changed and why Home was starting `flutter_foreground_task` from location permission alone, which held `AVAudioSession` (green mic) all day even when nothing was capturing. Pair that with a 200ms BLE reconnect on every background `connection_timeout` and a 3s `readRSSI` "keep-alive". This stops those keep-alives, backs off background BLE timeouts, and holds audio/FGS only while capture actually has frames. Leave issue 11307 open. Firmware AAD/store-when-unsubscribed is a separate device-side defect and is unchanged here. `voip` stays in Info.plist (CallKit). ## Related issues - Related: #11307 — iOS background BLE `connection_timeout` leaves live transcription unavailable - Relates to #5491 — idle/background battery drain from BLE scan + keep-alives - Relates to #6570 — GATT connected but app not consuming audio - Relates to #6610 (closed) — iOS background BLE reconnect stall; remaining gap is #11307 - Overlaps draft PR #10573 — serialize iOS BLE recovery / drop RSSI keepalive (this PR takes the idea plus backoff; not a wholesale merge) ## Product invariants affected none ## How it was verified ``` cd app && flutter test test/unit test/providers ``` 1024 tests passed (including `capture_keepalive_policy_test`, `capture_foreground_keepalive_sync_test`, `ble_reconnect_policy_test`, and Bee CCCD silence retry in `native_ble_transport_resync_test`). Targeted `dart analyze` on the policy/transport/controller files: no issues. Worktree `analyze_ratchet.sh` could not run (missing `lib/env/dev_env.g.dart` / `lib/firebase_options_dev.dart`). Not exercised on a physical iPhone in this PR. On-device evidence for the bug (TestFlight 1.0.543, iPhone 15 Pro Max, Omi CV1 3.0.21): 51% battery / 16h background, `backgroundServiceAction=API_START`, 19/20 last disconnects `connection_timeout` in `background`, green mic held while idle. ## Tests - `app/test/unit/capture_keepalive_policy_test.dart` — FGS must not start from location permission; Bee/Fieldy/Plaud audio UUIDs; phone-mic/system-audio hold for the whole session; wearable hold is frame-driven and re-acquires after silence; STT keep-alive requires audio in the last 15s - `app/test/unit/capture_foreground_keepalive_sync_test.dart` — stop during in-flight start still tears down FGS; Bluetooth audio-session deactivate is retried on failure and skipped for phone-mic - `app/test/unit/ble_reconnect_policy_test.dart` — first reconnect is immediate; `.inactive` counts as background; overdue delayed reconnects fire after a CoreBluetooth wake; background timeout/fail backs off 200ms → 2s → 10s → 30s → 60s; battery persist first / ≥5% / 15 min / cross 20% - `app/test/unit/native_ble_transport_resync_test.dart` — after reconnect, one CCCD resubscribe if no audio in 4s, including Bee audio UUIDs ## Failure class (fixes) Failure-Class: none ## Test plan - [ ] Cold launch with location While Using the App and no capture: no green mic, no "Transcription service is running in the background" notification - [ ] Start wearable capture: FGS + audio session come up; stop capture: both go away (CallKit call in progress should not deactivate the session) - [ ] Background BLE timeout storm: reconnects back off (200ms → 2s → 10s → 30s → 60s), not a 200ms loop; foreground reconnect stays immediate - [ ] Diagnostics RSSI graph still updates only while that screen is open - [ ] Phone-mic recording still starts/stops FGS; in-app playback after capture still works - [ ] Android Dart FGS now starts from capture, not Home location permission (native Android FGS unchanged)
|
Closing this experimental CV1/storage-first branch. The only firmware reliability change being carried forward is #11578; this PR is not part of that release candidate. |
|
Hey @axAilotl 👋 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! |
Summary
Root cause
The old iOS path could overlap discovery, subscription, writes, and reconnect work. High-rate notifications crossed avoidable Dart/UserDefaults routing, and DFU relinquished BLE ownership without a guaranteed exact-device reclaim.
Three reconnect gaps were present:
didConnect;The reconnect policy registers a system-owned pending
connectsynchronously after an ordinary unexpected link drop. Actual failed connection attempts still use bounded exponential backoff. The Dart DFU handoff now keeps one coalesced reclaim operation alive with capped backoff untilensureConnectionreturns ownership; explicitly forgetting the device deliberately abandons the lease.Physical validation
Validated on an iPhone 12 Pro Max running iOS 26.5 and one CV1:
961737..962057..962058Jade 572(background) andPearl 641(final candidate) appeared in transcriptioniOS 26 hard-toggle boundary
A Settings Bluetooth power toggle is not equivalent to an ordinary RF/link drop. One background cycle reconnected in 2 seconds, but a repeat with Omi already suspended remained disconnected for 34 seconds until Omi was foregrounded. Foregrounding then recovered immediately, drained the durable backlog, and resumed live audio.
Apple documents that iOS 26 restoration after user Bluetooth toggles is conditional and that Settings power toggles may not relaunch an app. This PR therefore improves the app-controlled reconnect paths without claiming that it can override that OS policy. The firmware/app durability boundary preserves the missing interval for later backfill.
Validation
flutter test --no-pub test/providers/device_provider_test.dart— 18 passed, including null/throw-then-success, concurrent terminal callback coalescing, capped-backoff continuation, and explicit forget cancellationbash app/ios/test/run_ble_gatt_scheduler_tests.sh— passedmake preflight/ pre-push manifest — 64 selected checks passedPRE_PUSH_SKIP_FLUTTER_GENERATED=1: the shared Flutter installation reported SDK version0.0.0-unknown; full Flutter analyzer/tests and platform compiles remain CI-authoritativeFailure-Class: none