Skip to content

feat(app): connect Omi and OmiGlass at the same time for multi-modal conversations - #13706

Open
apoorvdarshan wants to merge 15 commits into
BasedHardware:mainfrom
apoorvdarshan:cursor/multi-device-omi-omiglass-a361
Open

apoorvdarshan wants to merge 15 commits into
BasedHardware:mainfrom
apoorvdarshan:cursor/multi-device-omi-omiglass-a361

Conversation

@apoorvdarshan

@apoorvdarshan apoorvdarshan commented Sep 13, 2026 •

Copy link
Copy Markdown
Collaborator

Connect an Omi pendant and OmiGlass simultaneously so the pendant provides audio and the glasses provide photos to the same conversation. Fixes #2954.

  • Connections and connect/disconnect/forget locking are per device. Saved pairing slots remain separate from derived audio/photo roles; pendant disconnect promotes the glasses to audio.
  • Device settings and the battery indicator expose the companion; forgetting the primary promotes the remaining saved companion.
  • Integrated pinned upstream 789de5136cd124991e9956f9ff72891b3ad4416d with a regular merge. Preserved current device-health telemetry, sync-only capture admission and uplink cancellation; queued role reconciliation retains its account-generation token. Localizations regenerated from merged ARBs.
  • Review clarification: backend resolve_photo_conversation_source already relabels conversations with photos as openglass. secondDevice is used by both companion settings headers. Existing name-based camera detection is centralized, not expanded.

Validation

  • Pinned Flutter 3.44.5: 95 focused connection, pairing, role, settings, account-generation and wedge tests passed with --concurrency=2.
  • flutter test --concurrency=2 test/providers/device_provider_multi_device_test.dart test/services/capture/tiered_capture_test.dart test/services/capture/resume_sync_fence_test.dart — 33 passed (overlaps the initial run).
  • bash app/scripts/analyze_ratchet.sh — passed.
  • (cd app && python3 scripts/l10n.py check) — 49 locales / 3837 keys, generated freshness passed.
  • All resource-heavy commands serialized through the shared lock; no phone/simulator installs or hardware writes.

Remaining validation and maintainer decisions

Real Omi + OmiGlass BLE behavior is unverified: confirm both stay connected, pendant transcript and glasses photos share one conversation, pendant loss/restoration transfers the audio role, camera start/stop follows role changes, and the stored source becomes openglass. iOS/Android radio timing, the pairing/replace UX and audio-only mute semantics still need maintainer hardware sign-off. Host tests are not hardware evidence; mobile installation is coordinated separately.

Product invariants affected

INV-CAP-1 — preserve the upstream audio-retention policy while selecting the audio device.

Failure-Class: none

Line-count exceptions

Merge formatter exception

The ordinary merge pre-commit hook ran. Unrelated imported-main formatter changes were then restored byte-for-byte to pinned 789de5136, and a user-authorized, one-command commit-hook override was used only for that restore-only amend. Git identity, conflict-marker checks and pinned formatting checks for authored paths passed manually. The full preflight and pre-push gates remain enabled.

UI evidence

Host-rendered snapshots of the actual Flutter widgets using isolated test fixtures, bundled fonts and iOS theme. These are not phone/simulator captures or hardware sign-off.

Actual ConnectedDevice widget offers pairing a second device; isolated host fixture with simulated pendant state. Rendered in headless Flutter tests using iOS theme and bundled fonts, not on a phone or simulator.

Actual ConnectedDevice widget shows the paired OmiGlass companion and simulated 64% battery; isolated host fixture. Rendered in headless Flutter tests using iOS theme and bundled fonts, not on a phone or simulator.

Instruction-size follow-up: shortened only wording around inherited guidance and existing contract links after creating unique timestamp backups. The lean-guide and documentation-reference checks pass; all instructions and contract destinations remain intact.

The bounded pre-push gate, including the shared PR preflight, passed with all selected gates enabled and no bypass variables; branch pushed without force. Full CI/platform suites and physical hardware checks remain separate evidence.

Line-Count-Exception: app/lib/providers/device_provider.dart | 1663 -> 1916 | multi-device role reconciliation (per-device connections, audio/photo roles, companion battery) runs inside DeviceProvider's existing connect/disconnect lifecycle and launch arming, so it can't be split out without restructuring main's methods

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 122 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread app/lib/services/devices.dart Resolved
Comment thread app/lib/providers/device_provider.dart Resolved
Comment thread app/lib/l10n/app_localizations_ja.dart Resolved
@Git-on-my-level

Copy link
Copy Markdown
Member

Reviewed the multi-device implementation across the core paths. This hangs together well: the per-device connection model in app/lib/services/devices.dart (_connections map keyed by device id, per-device _connectionMutexes so an out-of-range pendant can't stall the glasses, injectable DeviceConnectionFactoryFn), the pure role assignment in app/lib/services/devices/device_pairing_roles.dart, and the serialized _reconcileRoles() in app/lib/providers/device_provider.dart are coherent, and the new tests pin the right invariants — a second connect never drops the first, forget disposes only that device's transport, pendant drop promotes the glasses to audio. Routing both unpair UIs (pages/home/device.dart, pages/settings/device_settings.dart) through the single DeviceProvider.forgetDevice owner, with forgetSavedBtDevice promoting the remaining companion, is a clear cleanup over the duplicated teardown those pages had.

Notes from reading the diff — none of these block on their own:

  1. DeviceProvider.scanAndConnectToDevice (app/lib/providers/device_provider.dart, ~L568) populates _connectedDevices and calls setConnectedDevice(audioDevice) directly instead of registerConnectedDevice/_reconcileRoles, so on a cold start where both saved devices are already natively connected this path never sets companionDevice nor calls CaptureController.updatePhotoDevice — photos would wait for a role change. In practice native re-notifies Dart on ensureConnection, which routes through the reconciling path, so it may never manifest; routing this path through reconciliation too would remove the dependence on that re-notify behavior.

  2. OnboardingProvider.handleTap (app/lib/providers/onboarding_provider.dart, ~L232) forgets the current primary — and a companion that no longer pairs with the replacement — before ensureConnection(candidate, force: true) has succeeded, so a failed replacement can leave the user with no live connection. The old single-device flow had a similar dispose-then-connect shape, so this isn't a regression, but connecting the candidate first and dropping the old device only on success would be safer.

  3. DeviceService.forgetDevice/disconnectDevice don't take the per-device mutex that ensureConnection holds, so a forget racing a forced connect can dispose a transport mid-connect(). Also pre-existing in shape, but the parallel Future.wait connects in initiateConnection widen the window.

  4. Minor: the new secondDevice l10n key is unused — _buildSecondDeviceSection in app/lib/pages/home/device.dart titles the card with companion.name and only references pairSecondDevice/pairSecondDeviceDescription/forgetSecondDevice. Either use it as the section header or drop it from the 49 ARBs and the generated localization files.

Agent-guidance note for maintainers: this PR adds .github/agent-docs/multi-device-capture.md and links it from app/AGENTS.md (which also drops the one-line Android/iOS permission-count summary). I checked the new contract against the diff — per-device connections and mutexes, the btDevice/companionBtDevice slots with forgetSavedBtDevice promotion, the by-id getDeviceInfo(null) lookup, the audio/photo role table, and photos riding the existing /v4/listen session as image_chunk frames all match the code as written. From merge onward, AI coding agents working in this repo will treat that file as the source of truth for multi-device capture, so it's worth a maintainer skim: any drift between the contract and shipped behavior will propagate into future automated patches. One deliberate-looking nuance to glance at: the by-id getDeviceInfo(null) in app/lib/backend/schema/bt_device/bt_device.dart no longer copies type from the saved copy (the previous code did), so an offline glasses-as-audio device reports its runtime type rather than the persisted one.

The PR is honest that no hardware verification was done — real BLE reconnect timing, the OmiGlass camera start/stop writes over a live link, and the pendant-drop audio handover are exactly the parts the in-memory-transport tests can't cover. Shipping simultaneous Omi + OmiGlass pairing at all, with the pendant-audio/glasses-photo role split, is a product-direction decision on top of the request in #2954 — leaving this for human maintainer review and sign-off with on-device validation rather than anything automated.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added needs-maintainer-review Needs a human maintainer to sign off before merge flutter flutter work labels Sep 13, 2026
@cursor
cursor Bot force-pushed the cursor/multi-device-omi-omiglass-a361 branch from d294404 to 582f299 Compare September 13, 2026 22:11
@apoorvdarshan

Copy link
Copy Markdown
Collaborator Author

Rebased onto upstream main (conflicts resolved); branch force-pushed with lease. All 10 multi-device / cubic-fix commits retained.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mobile feature (app/, Flutter) — new capability (simultaneous Omi + OmiGlass connection), not a bug fix, so per policy this is approve-only (confidence gate doesn't apply to features). Not desktop, so Summer Challenge tracks (Windows/speed/design are desktop-specific) don't match either. CI green (Android Compile Smoke, Dart Analyze & Tests pass), no abuse signals.

@Git-on-my-level

Copy link
Copy Markdown
Member

Follow-up on the rebase to f704f6a3 — re-checked the diff against the four notes from the earlier automated review, and all four are resolved on this head:

  1. DeviceProvider.scanAndConnectToDevice (app/lib/providers/device_provider.dart) now routes every ensureConnection result through registerConnectedDevice → _reconcileRoles, so a cold start with both saved devices connected sets companionDevice and hands the camera to CaptureController.updatePhotoDevice instead of depending on native re-notify.
  2. OnboardingProvider.handleTap (app/lib/providers/onboarding_provider.dart) now connects the replacement candidate before forgetting the outgoing primary (and a companion that no longer pairs with it); the failure path also guards setIsConnected(false) behind connectedDevice == null, so a failed second-device pairing no longer reports the live primary as disconnected.
  3. DeviceService.forgetDevice and disconnectDevice (app/lib/services/devices.dart) now hold the same per-device mutex as ensureConnection, closing the dispose-mid-connect race the parallel reconnects had widened.
  4. The secondDevice l10n key is now the section title in _buildSecondDeviceSection (app/lib/pages/home/device.dart) — no longer unused across the 49 locales.

New reads on this head also look right: the _photoStreamGeneration guard in capture_controller.dart drops stale image_chunk callbacks per chunk, _stopDevicePhotoStreaming stops whichever camera was actually started, and the two-device battery pill sits behind a FittedBox(scaleDown) so it can't overflow. Generated Files is green, consistent with the 4-key × 49-locale regen.

Two things for the record, neither newly blocking:

  • The new .github/agent-docs/multi-device-capture.md (linked from app/AGENTS.md) will become the reference AI coding agents load for multi-device capture. I verified its claims against the code as written — per-device connections/mutexes, slot promotion in forgetSavedBtDevice, the audio/photo role table, photos riding the existing /v4/listen session with no backend change — and they match. Worth a quick maintainer skim since it's contributor-authored; drift there would propagate into future automated patches.
  • The PR still evidences no on-hardware run: real BLE reconnect timing, OmiGlass camera start/stop over a live link, and the pendant-drop audio handover remain the parts the in-memory-transport tests can't cover.

With the maintainer approval on this exact head, I've removed needs-maintainer-review — the product-direction decision it was asking for has been made; on-device validation before release is the remaining step.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level removed the needs-maintainer-review Needs a human maintainer to sign off before merge label Sep 14, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-evaluated under current policy (backlog drain).

@cursor
cursor Bot force-pushed the cursor/multi-device-omi-omiglass-a361 branch from f704f6a to 2f997cc Compare September 16, 2026 00:31
@apoorvdarshan

Copy link
Copy Markdown
Collaborator Author

Rebased onto latest main and resolved merge conflicts (notably l10n ARB/generated files — kept upstream keys plus this PR’s second-device strings). Force-pushed updated branch.

@apoorvdarshan

Copy link
Copy Markdown
Collaborator Author

CI / l10n note (executor): app_da.arb on this branch was accidentally emptied in 778d74be during an MCP connectivity test. Emergency partial restores followed; tip 7b40b718 still has only a ~2.5KB stub (not the full Danish ARB).

Needed next (CloudAgent / parent): restore full app_lib/l10n/app_da.arb (~185KB, 3110 keys) from the good blob at 2f997cc112:app/lib/l10n/app_da.arb plus local extras (memoryAllowUse/memoryDontUse/multi-device keys), then push the rest of the normalized ARBs + flutter gen-l10n outputs that are prepared in the box worktree /workspace/omi-13706 (local commit a14ec6a + dirty). Shell has no gh token here so large-file MCP pushes are the bottleneck.

Skip resolving optional review threads; #13702 backend reindex P2 remains intentionally deferred.

@apoorvdarshan

Copy link
Copy Markdown
Collaborator Author

CI fix: Danish l10n restore + ARB dedupe

Pushed to cursor/multi-device-omi-omiglass-a361 at ad1a6d5493.

What broke

  • app/lib/l10n/app_da.arb had been reduced to a ~2.5KB stub (~56 lines), which broke flutter gen-l10n, analyze, and tests.
  • All locale ARBs (except da) still had a duplicate top-level processingTakingLonger key from the multi-device rebase tail — this fails test/unit/plans_sheet_l10n_test.dart ("no ARB defines the same key twice") and ARB formatting checks.

Fix

  1. Restored full app_da.arb from the uploaded good copy (~3110 keys, ~186KB).
  2. Removed the trailing duplicate processingTakingLonger entry in 48 locale templates (kept the first block + multi-device keys).
  3. Ran flutter gen-l10n and committed refreshed app_localizations*.dart.

Verification (local)

  • ARB JSON + 4-space indent check on all app/lib/l10n/app_*.arb
  • flutter test test/unit/plans_sheet_l10n_test.dart
  • flutter test test/providers/onboarding_provider_multi_device_test.dart
  • bash scripts/analyze_ratchet.sh

CI should trend green on Formatting (ARB), Generated Files, and Dart Analyze & Tests. No fork main sync.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mobile feature (simultaneous Omi + OmiGlass connections for multi-modal capture), not a bug fix — approve-only per policy; per-device connection model looks sound, fixes #2954 UX gap.

@cursor
cursor Bot force-pushed the cursor/multi-device-omi-omiglass-a361 branch from ad1a6d5 to 58ed42c Compare September 16, 2026 22:21
@apoorvdarshan

Copy link
Copy Markdown
Collaborator Author

Rebased cursor/multi-device-omi-omiglass-a361 onto latest BasedHardware/omi main (through bf7f4f69a8). Resolved conflicts in device_provider.dart and devices.dart by keeping multi-device pairing/connection behavior and integrating upstream stale-bond recovery + mutex-serialized forget/disconnect. Force-pushed with lease; new tip: 58ed42cc7a.

@apoorvdarshan

Copy link
Copy Markdown
Collaborator Author

Pushed 9eb08d8d0e on cursor/multi-device-omi-omiglass-a361 to unblock Dart Analyze & Tests after the rebase.

stale_bond_recovery_test.dart still used the retired DeviceService(connectionBuilder:) argument. It now uses connectionFactory, matching the multi-device constructor. Test intent is unchanged: ensureConnection stays blocked while stale-bond recovery is required, and forgetDevice clears that flag.

Flutter is not installed on the Cloud VM, so I did not re-run flutter test / analyze locally. CI on this commit is the verify.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mobile feature (approve-only per policy — non-desktop features don't merge). Well-tested multi-device support, no auth/secrets touched.

@Git-on-my-level

Copy link
Copy Markdown
Member

Follow-up on the changes since the last automated pass (then at f704f6a3) — the rebase onto current main, the app_da.arb restore chain, and the test-harness fix in 9eb08d8d. Standing with @kodjima33's approval on this exact head; everything below is for the record, nothing blocking.

Verified on 9eb08d8d:

  • The four concerns from the earlier automated review remain resolved at head, re-checked in the current code rather than assumed: scanAndConnectToDevice (app/lib/providers/device_provider.dart L600-605) routes every successful ensureConnection through registerConnectedDevice → _reconcileRoles; DeviceService.forgetDevice/disconnectDevice (app/lib/services/devices.dart L343-362) hold the same per-device mutex as ensureConnection; OnboardingProvider.handleTap connects the candidate before forgetting the outgoing primary and guards setIsConnected(false) behind connectedDevice == null; the secondDevice key is the section title in _buildSecondDeviceSection (app/lib/pages/home/device.dart L220).
  • app_da.arb is fully restored to Danish after the accidental empty push — processingTakingLonger is back and deduped, the four multi-device keys are present (L3284-3287). One residue: the restore also brought in memoryAllowUse/memoryDontUse (L3288-3294) with English placeholder text ("Allow use" / "Don't use") — those exist in the template but were missing from the Danish file, so Danish users will see English for those two buttons until translated. Harmless here; a one-line follow-up in the next l10n touch would close it.
  • The head commit itself (9eb08d8d, "use connectionFactory in stale-bond recovery test") is a clean rename follow-through on the DeviceConnectionBuilder → DeviceConnectionFactoryFn API change; app/test/services/devices/stale_bond_recovery_test.dart passes connectionFactory: (_) => null.
  • Post-rebase spot-checks still hold: zero native .swift/.kt changes in this PR; the multi-device agent contract (.github/agent-docs/multi-device-capture.md) still matches the code — including resolve_photo_conversation_source existing on the backend so "no backend change" remains true; the _photoStreamGeneration stale-chunk guard is intact in capture_controller.dart; Generated Files/Dart Analyze & Tests/Android Compile Smoke are green on this head, consistent with the 4-key × 49-locale regen.
  • The rebase also dropped the stale "Android: 26 permissions" line from app/AGENTS.md (the manifest declares ~30) — good docs hygiene, no action needed.

Still true from the earlier pass and unchanged by the rebase: no on-hardware validation is evidenced — live BLE reconnect timing, OmiGlass camera start/stop over a real link, and the pendant-drop audio handover remain outside what the in-memory-transport tests cover. That's the one thing worth a physical-device smoke test before release.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added the positive-signal Automation verified a genuine fix/quality contribution label Sep 17, 2026
@apoorvdarshan

Copy link
Copy Markdown
Collaborator Author

Rebased cursor/multi-device-omi-omiglass-a361 onto latest BasedHardware/omi main (93e9e8806a). Kept multi-device DeviceService/DeviceProvider/companion pairing and tests; folded in main’s timer-after-dispose, stopDiscoverers, CaptureLifetime photo streaming, and stale-bond recovery (connectionFactory). Force-pushed with lease; new tip: e75a689b9e.

@cursor
cursor Bot force-pushed the cursor/multi-device-omi-omiglass-a361 branch from 9eb08d8 to e75a689 Compare September 19, 2026 01:02
@apoorvdarshan

Copy link
Copy Markdown
Collaborator Author

Hygiene failed after the rebase on product-file-line-count-ratchet: app/lib/services/capture/capture_controller.dart grew 2861 → 2926. Added the exact Line-Count-Exception line to the PR body and pushed empty commit 5f90c76337 so Hygiene re-runs (body-only edits only run metadata-preflight). No code change; multi-device DeviceService/Provider pairing and stale-bond recovery are unchanged.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feat(app): connect Omi+OmiGlass simultaneously — mobile feature, approve-only per policy (not a bug fix). CI green, no abuse signals.

@cursor
cursor Bot force-pushed the cursor/multi-device-omi-omiglass-a361 branch from 5f90c76 to 7ce0214 Compare September 19, 2026 23:25

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mobile feature (multi-device Omi+OmiGlass), approve-only per policy; extensively tested.

@cursor
cursor Bot force-pushed the cursor/multi-device-omi-omiglass-a361 branch from 7ce0214 to 7c81a39 Compare September 21, 2026 03:22
@apoorvdarshan

Copy link
Copy Markdown
Collaborator Author

Rebased cursor/multi-device-omi-omiglass-a361 onto latest BasedHardware/omi main (99a25634ba). Kept multi-device DeviceService/DeviceProvider/companion pairing and tests; folded in main’s Android sync keep-alive permission matrix (5 FGS types / 27 permissions). Force-pushed with lease; new tip: 7c81a396cb.

Rebase the existing multi-device feature; merge localization additions without dropping current main keys. All 54 focused provider/pairing/connection/widget tests passed. Failure-Class: none.
The localization contract passes after regeneration and pinned Dart formatting. Failure-Class: none.
@apoorvdarshan
apoorvdarshan force-pushed the cursor/multi-device-omi-omiglass-a361 branch from 74ec21f to 5a10f76 Compare October 4, 2026 08:16
@Git-on-my-level

Copy link
Copy Markdown
Member

Reviewed the multi-device rework on the current head — this is a well-engineered take on #2954. Some notes from the code review:

What looks right

  • DeviceService (app/lib/services/devices.dart) now keeps one connection per device id with per-device mutexes, so an out-of-range pendant hitting its 60 s connect timeout no longer blocks the glasses. ensureConnection only replaces the asking device's connection, and the injectable connection factory keeps it testable.
  • DevicePairingRoles (app/lib/services/devices/device_pairing_roles.dart) is pure and small — audio prefers the non-camera device, photos go to the camera, canPairAsCompanion requires exactly one camera + an omi pendant. Easy to reason about.
  • DeviceProvider._reconcileRoles runs serialized (chained future, errors logged) so a pendant and glasses connecting simultaneously apply one after the other. Per-device debouncers fix a subtle pre-existing issue where two devices connecting within the 100 ms window cancelled each other's handling. forgetDevice as the single unpair owner (prefs → connection → native unmanageDevice → reconcile) is a good consolidation of the two unpair UIs.
  • CaptureController tracks _photoStreamDeviceId (so the right camera is stopped after a role change) and bumps a generation counter so stale in-flight photo chunks can't write to a superseded /v4/listen session. Nice state discipline.
  • preferences.dart: companionBtDevice slot, pairedDeviceIds auto-connect set, and companion promotion on forget all trace correctly through their branches. BtDevice.getDeviceInfo(null) resolving by the asking device's id instead of assuming the primary slot is the correct fix for a glasses-only session inheriting pendant metadata.

Non-blocking observations

  • The three backend test files in the diff are formatting-only churn — no behavioral change.
  • Heads-up on DevicePairingRoles.isCameraDevice's name heuristic ('glass' substring for DeviceType.omi names): it could misclassify an unusually-named pendant, though it mirrors the pre-existing connection-factory heuristic and is now centralized in one home.
  • This PR adds a new agent-doc contract (.github/agent-docs/multi-device-capture.md, linked from app/AGENTS.md). I spot-checked its claims against the diff and they match the implementation; it will guide AI coding agents touching device/capture code toward the multi-connection model. Worth a maintainer skim since it's behavioral guidance for agents.

Before merge

  • The mobile CI lanes (Dart Analyze & Tests, Build, Android Compile Smoke) are skipped on this head, so the full-suite pass is contributor-reported rather than CI-verified. The lanes that did run all pass.
  • The real BLE path hasn't been exercised on hardware — thanks for being explicit about that in the description. The four on-device checks you listed (both stay connected; pendant transcript + glasses photos in one conversation; pendant drop hands audio to the glasses; backend labels the conversation openglass) should be confirmed on a device before this ships.

The engineering quality here is high and the feature is a long-requested one. The multi-device role semantics (pendant drop promotes glasses to audio, mute affects audio only) and the pairing/replace UX are product-level decisions, so I'm leaving the final call for human maintainer sign-off alongside the on-device validation.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added the needs-maintainer-review Needs a human maintainer to sign off before merge label Oct 4, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (multi-device Omi+OmiGlass capture) in mobile bucket — approve-only per policy (not a bug fix); also DIRTY so not mergeable regardless.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (simultaneous Omi+OmiGlass connection), not a bug fix — approve-only per confidence gate; also DIRTY (needs manual rebase, left untouched).

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (multi-device BLE connection); approve-only per policy, large but scoped to app/ l10n+dart, no abuse signal.

Integrates upstream 789de51 without rewriting PR history. Verification evidence: repair-evidence/20261011-13706-*.log (local coordinator handoff); PR body records commands and remaining hardware limitations.

Failure-Class: none
Capture the actual Flutter widgets using their existing isolated test fixtures, the iOS theme and bundled fonts. This documents the rendered UI only; radio behavior, on-device interactions and firmware timing remain pending central hardware validation.
Preserve inherited instructions and both speech and multi-device contract links with concise wording.

Failure-Class: none
apoorvdarshan added a commit to apoorvdarshan/omi that referenced this pull request Oct 11, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feat(app): connect Omi+OmiGlass simultaneously -- feature, approve-only

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feat(app): connect Omi+OmiGlass simultaneously -- feature, approve-only

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-affirming prior approval after new commits (rebase/localization maintenance only, no material change). Still a feature (multi-device Omi+OmiGlass pairing) and still DIRTY, so approve-only, no merge.

@apoorvdarshan apoorvdarshan added the ci:full Maintainer-granted: run full CI on this fork PR label Oct 13, 2026
apoorvdarshan and others added 5 commits October 13, 2026 23:26
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep DeviceService.disconnectDevice disposing the dropped transport (main's
orphan-transport fix) inside the per-device mutex, and route readoption
through the per-device debouncers.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L6nc4Dq4LXiSGCnJBvD7ix
main's readoption path re-runs the connect side effects after
setIsConnected(false); with the audio/photo role model that path goes
through registerConnectedDevice, which skipped _onDeviceConnected while
_activeAudioDeviceId still named the device. Clear it together with the
admitted link so the next reconcile runs the full connect path again.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L6nc4Dq4LXiSGCnJBvD7ix
Holding the mutex while disposing the transport deterministically hangs
main's "disconnecting after a timed-out connect" fakeAsync test (the
dispose continuation never runs and the test times out); the lock-free
shape main uses passes it. The drop still takes effect immediately and
disposes the transport, and forgetDevice/ensureConnection keep their
per-device serialization.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L6nc4Dq4LXiSGCnJBvD7ix

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (simultaneous Omi + OmiGlass multi-device connection) — approve only per area rule; maintainer hardware sign-off still needed per PR body.

apoorvdarshan and others added 2 commits October 18, 2026 18:48
Main added the saved-pendant automatic reconnect (SavedPendantReconnect,
manual-disconnect suppression, stale-bond recovery, launch arming). The
merge keeps it for the primary Bluetooth device and keeps the branch's
multi-device model:
- DeviceService uses main's connectionBuilder/reconnect constructor; the
  connect path arms savedReconnectEnabled only for the primary and keeps
  the transport alive on timeouts and retryable failures.
- disconnectDevice and forgetDevice are lock-free (forget waited out a
  60 s launch connect on the per-device mutex); a connect that fails after
  its connection was removed rethrows without disposing twice.
- initiateConnection arms the saved reconnect for the primary and keeps the
  one-shot launch connect for a companion the user has not disconnected.
- Companion-slot preferences move to a PairedDeviceSlots extension and
  photo streaming to a capture part, keeping preferences.dart and
  capture_controller.dart at main's size.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L6nc4Dq4LXiSGCnJBvD7ix
- Forget Device lets DeviceProvider.forgetDevice own the saved slots, so a
  paired companion is promoted and the device name follows it; forgetting
  the only device emits deviceChanges so the saved reconnect retires it.
- Wedge recovery reconnects any saved device, not only the primary.
- Forget and user disconnect bump a per-device release generation that a
  queued or in-flight connect checks before clearing the manual-disconnect
  flag or building a new connection.
- NativeBleTransport does not manage a device released during its readiness
  check, and unmanages if disposed while manageDevice was in flight.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L6nc4Dq4LXiSGCnJBvD7ix

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (simultaneous Omi + OmiGlass connection), not a bug fix -- approve only, do not merge. Large diff, needs-maintainer-review label present.

@Git-on-my-level

Copy link
Copy Markdown
Member

Verdict: strong, cohesive implementation — no blocking issues found; leaving the merge decision with the maintainers.

Verified in the diff:

  • app/lib/services/devices.dart — the global connect mutex becomes per-device mutexes plus _releaseGenerations fencing, so a lock-free forget/disconnect can no longer be overtaken by an in-flight connect; the generation re-check in _connectToDevice after dispose and the matching _releaseGeneration/_disposed guard in native_ble_transport.dart close the race properly.
  • app/lib/backend/preferences_paired_devices.dart — clean two-slot model (btDevice + companionBtDevice); forgetSavedBtDevice promotes the companion when the primary is forgotten, and clears the primary via saveString('btDevice','') rather than remove() so the deviceChanges signal still retires the saved-reconnect target.
  • app/lib/services/devices/device_pairing_roles.dart — pure, unit-testable role selection; also de-duplicates the 'glass' name heuristic previously copy-pasted in device_connection.dart and firmware_update_build_policy.dart.
  • app/lib/backend/schema/bt_device/bt_device.dart — getDeviceInfo(null) now matches the saved copy by the asking device's id instead of assuming the primary slot. One subtle behavior change to be aware of: an unsaved device now gets this back rather than an empty record; tests cover it.
  • app/lib/services/capture/capture_photo_streaming.dart — photo stream is generation-guarded, tied to the recording session's lifecycle, and rides the existing /v4/listen socket.
  • app/lib/providers/device_provider.dart — per-device debouncers, parallel launch connects (an out-of-range pendant no longer delays the glasses), serialized role reconciliation.
  • Tests — ~1,100 new lines: device_provider_multi_device_test.dart, device_service_multi_connection_test.dart (including race coverage via _SlowDisposeTransport), device_pairing_roles_test.dart, and widget tests proving forget promotes the companion. Good coverage of the new invariants.
  • l10n — 4 new strings propagated across all locales plus generated localizations; mechanical, with en descriptions included.

Agent-guidance note: this PR adds .github/agent-docs/multi-device-capture.md and links it from app/AGENTS.md, which becomes standing context for coding/review agents touching device-connection code in this repo. I checked each of the doc's architectural claims against the diff (per-device mutex, two-slot prefs, primary-only SavedPendantReconnect, id-matched getDeviceInfo, companion promotion on forget, no native changes) — all accurate.

Performance/cost: a pendant+glasses session holds two BLE links and photos are base64-chunked over the existing listen socket — same channel as single-device OpenGlass, so no new spend surface; battery cost is inherent to running two devices.
Security/privacy: no new permissions, secrets, or data surfaces; prefs store small device records only.

USER IMPACT: you can keep an Omi pendant and OmiGlass connected at the same time — glasses photos land in the same conversation as the pendant's audio, both batteries show in the header, and forgetting one device cleanly leaves the other.

One remaining ask: I couldn't run the Flutter suite in my environment (no toolchain) and the visible CI on this head shows only the AI reviewer, so a green app-test run in CI on this head would close the last verification gap.

This head already carries a human approval; final merge timing stays with the maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

apoorvdarshan and others added 3 commits November 2, 2026 10:26
- BtDevice.getDeviceInfo without a link returns BtDevice.empty() again when
  nothing is remembered, as on main. Returning the connected device there
  persisted it as the paired device and filled the page with device rows,
  which pushed the device_page perf gate over its layout/paint caps.
- The second-device section is its own widget that selects only the
  companion state it shows, so DeviceProvider ticks no longer rebuild it.
- Forget-from-settings tests mock configureSavedReconnect: main's
  DeviceService.forgetDevice now awaits it first, and an unanswered platform
  call parked the forget inside the widget test's fake clock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The Device page's "Pair second device" row now requires a remembered
  (paired) primary device instead of any live link. A never-paired link has
  nothing to add a companion to, and the row was the remaining extra
  layout work over main in the device_page perf gate, whose fixture
  connects an Omi without pairing it.
- The multi-device role tests save the pendant and glasses before
  connecting them, as the pairing flow does. Without a saved record a
  connect without a live link reports BtDevice.empty() (main's behaviour,
  restored in the previous commit), which those tests relied on not
  happening. No assertion changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level

Copy link
Copy Markdown
Member

Verdict: this is a well-engineered, cohesive feature — the multi-device architecture is right and the test coverage is unusually good. One non-blocking correctness gap below; leaving the merge call to a human maintainer since it is a user-facing product feature and the current head has not yet been re-approved by a human.

What I verified:

  • app/lib/services/devices.dart — per-device mutexes (_connectionMutexes) plus _releaseGenerations so an out-of-range pendant's 60s connect timeout no longer blocks the glasses, and a queued connect stands down after forget/user-disconnect. ensureConnection(id) now only ever touches that one device's connection. Sound concurrency design.
  • app/lib/services/devices/device_pairing_roles.dart — pure role assignment (pendant=audio, glasses=photos, glasses take audio when alone); also the single home of the "openglass type or glass-named omi" heuristic, now delegated to by DeviceConnectionFactory and firmware_update_build_policy.dart instead of three copies. Well tested.
  • app/lib/backend/preferences_paired_devices.dart — btDevice + companionBtDevice slots, companion promoted when the primary is forgotten; the empty-primary write (not remove) deliberately keeps deviceChanges firing to retire the saved-reconnect target. Correct.
  • app/lib/providers/device_provider.dart — _reconcileRoles serialized via a future chain, audio device driven through the existing single-device paths so battery/firmware/WAL semantics are unchanged; forgetDevice(id) is now the single unpair owner used by both device_settings.dart and the second-device card.
  • app/lib/services/capture/capture_photo_streaming.dart + capture_controller.dart — companion photos ride the audio session's /v4/listen socket with a generation guard so in-flight chunks cannot land in a superseded session; _photoStreamDeviceId ensures the right camera is stopped after a role change.
  • UI: _SecondDeviceGroup in device_settings.dart and the companion segment in battery_info_widget.dart are select-scoped so the page does not rebuild wholesale; l10n keys added in en plus all locales (Generated Files check green).

One gap (non-blocking): OnboardingProvider._pairCompanion (app/lib/providers/onboarding_provider.dart) persists companionBtDevice and reports DEVICE_CONNECTED after ensureConnection returns non-null, but never checks connection.status == connected — the primary pairing path a few lines above throws StateError on exactly that condition. A companion whose device-specific init partially failed can be saved and shown as connected. Suggest mirroring the primary path's status check.

Performance: launch/auto-connect attempts now run in parallel per saved device (bounded at two); no new polling loops — the picker's while-paired discovery scan stops on page dispose. Cost: no new endpoints or API spend; photos reuse the existing listen socket. Security/privacy: BLE-only, no native (Swift/Kotlin) changes, no new data recipients — photo capture scope is unchanged from single-device OmiGlass, just coexistent. Blast radius: single-device users are affected via the refactored forget/pairing paths and scanDevices picker reset; the updated widget tests (device_page_forget, connected_device_second_device, semantics_baseline) cover the main regressions.

Agent guidance note: this PR adds .github/agent-docs/multi-device-capture.md and links it from app/AGENTS.md, which will direct future AI coding/review agents on this repo. I checked its claims against the code (mutex design, slot semantics, roles table, photo-stream lifecycle) and they are accurate; maintainers should review it as part of signing off the feature since it becomes standing agent documentation.

USER IMPACT: once paired, an Omi pendant and OmiGlass stay connected at the same time — the pendant records audio while the glasses contribute photos to the same conversation; the device page and home battery pill show both devices.

Still wanted before merge: the companion status check above, and real-hardware confirmation of a pendant+glasses session (the evidence screenshots are headless-test renders, not device captures). Changelog fragment is present. Leaving for human maintainer review — product sign-off for shipping simultaneous Omi + OmiGlass capture, and the current head needs a fresh human approval.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:full Maintainer-granted: run full CI on this fork PR flutter flutter work needs-maintainer-review Needs a human maintainer to sign off before merge positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

connect both omi and omiglass at once to the omi app for multi-modal conversations

4 participants