Repository navigation
feat(app): add Omi button action toggle - #11193
Conversation
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_13d8dee6-b0a6-4dde-9418-8ca8ed828621) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6572d64fe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Uint8List.fromList(snapshot.sublist(0, 4).reversed.toList()).buffer, | ||
| ).getUint32(0); | ||
| Logger.debug("device button $buttonState"); | ||
| if (_recordingDevice?.type == DeviceType.omi && !SharedPreferencesUtil().omiButtonActionsEnabled) return; |
There was a problem hiding this comment.
Let onboarding receive disabled button events
When an Omi owner turns this switch off and later opens Settings → Device Tutorial, this return executes before deviceOnboardingProvider.onButtonEvent. The tutorial's single-press and double-press steps depend on that callback, so they can never complete; bypass the preference gate while onboarding is active and cover this interaction with a handler-level test rather than only preference persistence.
AGENTS.md reference: AGENTS.md:L28-L28
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
All reported issues were addressed across 103 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for this @undivisible — clean, well-scoped app feature, and the default-on preference is the right call for preserving current behavior. The l10n coverage across all locales and the hermetic unit test are appreciated.
One blocking issue before this lands:
Onboarding stranding when the toggle is off. In capture_controller.dart the new guard at line 768 (if (... !omiButtonActionsEnabled) return;) runs before the interactive-device-onboarding intercept (lines 771–779). That means a user who has turned Omi Button Actions off cannot advance the single/double-press onboarding steps, because deviceOnboardingProvider.onButtonEvent never fires. Onboarding button handling isn't really an "action" this toggle should disable. The fix is small: move the gate to just after the onboarding block so onboarding events still flow regardless of the preference.
A couple of smaller follow-ups (non-blocking):
- The
DeviceType.omi && !omiButtonActionsEnabledcheck is duplicated verbatim at lines 710 and 768; a small private getter (e.g.bool get _omiButtonActionsDisabled => ...) would keep future gate changes in one place. - The new Switch uses
activeTrackColor: Color(0xFF8E8E93)(the iOS off-state grey), so it reads as disabled while ON and is inconsistent with the sibling auto-sync toggle (0xFF8B5CF6). Matching the existing accent would make the enabled state clearer. - When the toggle is off, the Double Tap configuration row below it stays visible and tappable even though it's now a no-op — consider hiding/disabling dependent rows, or adding a subtitle.
Notes: CI shows two cancelled PR Metadata Preflight runs alongside a passing one; please make sure checks are green before merge. I've added feature-fit-review since this is a new user-facing settings surface that warrants a human product/maintainer look, and needs-maintainer-review for the onboarding fix. No security/privacy/dependency concerns from my read.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
kodjima33
left a comment
There was a problem hiding this comment.
Omi button action toggle reads clean and is fully localized — feature, so leaving the merge call to Nik.
|
Thanks @undivisible — clean, well-scoped implementation. Notes for the human sign-off: Implementation
Minor edge case (non-blocking)
Coverage / CI
Leaving the product/feature-fit sign-off to a human maintainer. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
d6572d6 to
0fa4b8c
Compare
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_7adf90d1-39e6-451a-9ee4-d1bca91713fe) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0fa4b8c4fd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| bool get _omiButtonActionsDisabled => | ||
| _recordingDevice?.type == DeviceType.omi && !SharedPreferencesUtil().omiButtonActionsEnabled; |
There was a problem hiding this comment.
Normalize device identity before applying the Omi-only gate
When a user disables this preference for an Omi and later connects an OmiGlass, its button actions can remain disabled with no switch available to restore them. Native discovery initially classifies peripherals using the Omi service as DeviceType.omi; device-info loading subsequently reclassifies OmiGlass only in pairedDevice (which hides the switch), while _onDeviceConnected passes the original device to the capture controller. Consequently, this check treats that OmiGlass as an Omi and applies the persisted global preference; base the gate on the normalized device identity rather than the original discovery value.
Useful? React with 👍 / 👎.
| trailing: Switch( | ||
| value: _omiButtonActionsEnabled, | ||
| activeThumbColor: Colors.white, | ||
| activeTrackColor: const Color(0xFF8B5CF6), |
There was a problem hiding this comment.
Replace the purple switch accent with a neutral color
The newly added enabled-state track uses 0xFF8B5CF6, adding another purple UI accent despite the repository's locked requirement that new UI use white or neutral treatments instead. Use a neutral track color for the enabled switch state.
AGENTS.md reference: AGENTS.md:L90-L90
Useful? React with 👍 / 👎.
Dismissed — all blockers from this review are resolved on head 0fa4b8c4fd: (1) the Omi button-actions gate now runs after the interactive-onboarding intercept, so onboarding still receives button events; (2) the duplicated DeviceType.omi && !omiButtonActionsEnabled check is consolidated into the _omiButtonActionsDisabled getter; (3) the Switch accent is now 0xFF8B5CF6; (4) the dependent Double Tap row is hidden when the toggle is off. The remaining gate is human product/feature-fit sign-off.
|
Follow-up verification on head
Implementation notes:
Minor, non-blocking: if a voice-command session is already active when the user flips the toggle off, in-flight bytes are dropped silently and the session lingers until its 15s timeout. Not a correctness issue, but dismissing the active session on toggle-off would be marginally cleaner. Leaving the product/feature-fit sign-off to a human maintainer — the blocking by AI on behalf of David — if you need David's attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
Omi button action toggle — feature, approve only.
…malize Omi identity (PR #11193) - Replace the purple switch accent (0xFF8B5CF6) with neutral white to satisfy the no-purple UI invariant. - Cancel any in-flight voice-command session when the user disables Omi button actions, so audio captured while enabled is dropped instead of submitted after disabling. - Normalize device identity before applying the Omi-only gate: an OmiGlass advertising as DeviceType.omi during discovery no longer inherits the persisted Omi button-actions preference.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_a2c1d455-c043-4d38-91cb-5ecf14128454) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74733b8b21
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Omi button actions are disabled by the user: skip action handling but | ||
| // onboarding (handled above) still receives button events regardless. | ||
| if (_omiButtonActionsDisabled) return; |
There was a problem hiding this comment.
Exempt tutorial voice presses from the disabled gate
When actions are disabled and the user opens Device Tutorial, step 1 still cannot complete: onButtonEvent marks the first press active and the second press questionSent, but this return prevents both presses from starting or ending the actual voice-command session, so SinglePressStep enters Processing and waits indefinitely for a MessageProvider response that will never arrive. The fresh evidence beyond the earlier callback-ordering comment is that the new step-1 fall-through immediately encounters this preference gate; exempt those tutorial presses and cover the disabled-preference path through the button handler rather than only testing preference persistence.
AGENTS.md reference: AGENTS.md:L28-L30
Useful? React with 👍 / 👎.
| bool _isOmiButtonActionsDevice(BtDevice? device) { | ||
| if (device == null || device.type != DeviceType.omi) return false; | ||
| final name = device.name.toLowerCase(); | ||
| return !(name.contains('openglass') || name.contains('omiglass') || name.contains('glass')); |
There was a problem hiding this comment.
Use capability-normalized identity for the Omi gate
For an OmiGlass that advertises the Omi service under a name without glass, openglass, or omiglass, this still classifies the raw recording device as an Omi. Fresh evidence after the earlier identity comment is that BtDevice._getDeviceInfoFromOmi explicitly reclassifies an OmiDeviceConnection as DeviceType.openglass when hasImageStream == 'true', so capability-only Glass devices are supported even when their names do not match these heuristics; pairedDevice then hides the switch while _recordingDevice remains the original Omi-shaped object and suppresses its button events whenever the global preference is false. Base the gate on the capability-normalized device identity instead of the discovery name.
Useful? React with 👍 / 👎.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks @undivisible — this is a clean, well-scoped feature. Observations from the diff:
capture_controller.dart
- The
_omiButtonActionsDisabledgate instreamButtonis correctly placed after the onboarding interception, so interactive onboarding still receives button events even when actions are disabled. Good separation of concerns. _isOmiButtonActionsDeviceproperly excludes OmiGlass units that advertise asDeviceType.omiby name-matching 'glass'/'openglass'/'omiglass', avoiding accidental suppression of OpenGlass behavior.cancelActiveVoiceSession()correctly cancels the timeout timer, clears_voiceCommandSession/_commandBytes, and is wired fromdevice_settings.dartthroughCaptureProvider, so in-flight audio is dropped rather than submitted after the toggle flips._processVoiceCommandBytesearly-returns when disabled — consistent with thestreamButtongate.
device_settings.dart
- The customization section now branches on
device?.type == DeviceType.omi, preserving the existing double-tap row for non-Omi devices. Default-on switch preserves current user behavior.
preferences.dart
- Standard
getBool/saveBoolpair, defaulttrue. No migration concern.
Tests / i18n
omi_button_actions_test.dartcovers default-on and persistence. The capture-gating logic (OmiGlass exclusion, onboarding bypass) isn't unit-tested, which is reasonable given its BLE/device-state dependencies.@omiButtonActionsARB metadata is present in the English source; generated localization files are consistent (Generated Files check passed).
The feature-fit-review and needs-maintainer-review labels are retained since the decision to expose this toggle (and its default/naming) is a product call. Note that @kodjima33's prior approvals were on earlier commits (d6572d6, 0fa4b8c); the current head (74733b8) has moved past them, so a maintainer re-confirmation on this head would close the loop before merge.
Reviewed by glm-5.2 (automation). Leaving for human maintainer review on the current head.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
…malize Omi identity (PR #11193) - Replace the purple switch accent (0xFF8B5CF6) with neutral white to satisfy the no-purple UI invariant. - Cancel any in-flight voice-command session when the user disables Omi button actions, so audio captured while enabled is dropped instead of submitted after disabling. - Normalize device identity before applying the Omi-only gate: an OmiGlass advertising as DeviceType.omi during discovery no longer inherits the persisted Omi button-actions preference.
74733b8 to
50d71d3
Compare
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_443c6f97-7383-4ebf-8963-8e7eb6de2681) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50d71d3be4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| activeThumbColor: Colors.white, | ||
| activeTrackColor: Colors.white, |
There was a problem hiding this comment.
Give the enabled switch a contrasting neutral track
When this toggle is enabled, both the thumb and track are pure white, causing the thumb to blend into the track and obscuring the switch position. Use a contrasting neutral track color so users can reliably identify the enabled state while preserving the repository's neutral-only UI treatment.
AGENTS.md reference: AGENTS.md:L90-L90
Useful? React with 👍 / 👎.
…malize Omi identity (PR #11193) - Replace the purple switch accent (0xFF8B5CF6) with neutral white to satisfy the no-purple UI invariant. - Cancel any in-flight voice-command session when the user disables Omi button actions, so audio captured while enabled is dropped instead of submitted after disabling. - Normalize device identity before applying the Omi-only gate: an OmiGlass advertising as DeviceType.omi during discovery no longer inherits the persisted Omi button-actions preference.
50d71d3 to
9034e79
Compare
kodjima33
left a comment
There was a problem hiding this comment.
Feature (Omi button action toggle) — approve-only per policy (mobile area, not a bug fix). Note: CI currently shows failures (Dart Analyze, Formatting, Hermetic Merge Gate) — flagging for visibility, not blocking approval.
kodjima33
left a comment
There was a problem hiding this comment.
Mobile feature (Omi button action toggle) from flagged author, full diff re-read finds no abuse signal (pure app/l10n/provider files); DIRTY with failing required checks (Dart Analyze, Formatting, Backend Hermetic Merge Gate) so stays approve-only under the hard floor regardless of area rules.
kodjima33
left a comment
There was a problem hiding this comment.
Legit feature (Omi button-actions toggle gating BLE button/voice-command handling on preference), diff matches description, no abuse signals found. Mobile feature area -> approve-only per policy (not a bug fix). DIRTY mergeStateStatus + multiple real CI failures (Backend Hermetic Merge Gate, Dart Analyze, Formatting) block merge regardless — author should rebase and fix CI.
Address review feedback: - Scope the Omi-button-actions gate to the action-handling path only, so interactive onboarding still receives button events when the toggle is off. - Centralize the duplicated guard into a single _omiButtonActionsDisabled helper used by both _processVoiceCommandBytes and the BLE button stream. - Hide the Double Tap row when Omi button actions are disabled (settings mismatch) and use the brand purple accent for the enabled switch track.
…malize Omi identity (PR #11193) - Replace the purple switch accent (0xFF8B5CF6) with neutral white to satisfy the no-purple UI invariant. - Cancel any in-flight voice-command session when the user disables Omi button actions, so audio captured while enabled is dropped instead of submitted after disabling. - Normalize device identity before applying the Omi-only gate: an OmiGlass advertising as DeviceType.omi during discovery no longer inherits the persisted Omi button-actions preference.
Add focused coverage for onboarding delivery, normalized device identity, cancellation, and the post-codec preference race. Failure-Class: none
Cancel tutorial voice sessions on onboarding exit, gate Glass by capability-normalized identity instead of name heuristics, stop collecting command audio when actions are disabled, and key the settings switch.
…lized devices Prefer pairedDevice for the button-actions switch so OpenGlass reclassified after hasImageStream is not shown an Omi-only control, and cancel the tutorial voice session only after the user starts the flow.
Home and speech-profile were passing advertising-time connectedDevice into streamDeviceRecording, and tutorial dispose cancelled any in-flight voice session after Start.
- Re-drop the legacy long-press flag remnant (main removed it in #12477 but the rebase resurrection left 6 undefined references in capture_controller.dart). - Test fixture no longer opens a real transcription socket: override openConversationSocket to return null (mirrors main's _GatedSocketCaptureProvider pattern) so tests never reach buildHeaders -> FirebaseAuth. - Seed the stored deviceIdHash and initialize PlatformManager in-test so header building has its late field without real device plugins. - Stub path_provider and package_info channels in setUpAll. All 10 controller tests + 2 unit tests pass; analyze clean on all touched files.
cbbda02 to
8e149c1
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Rebased onto current Two mechanical CI fixes pushed:
Rebase conflict resolutions ( On the Verification: 10/10 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8e149c1492
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // should have been cancelled — never submit audio captured after leaving. | ||
| final allowWhenDisabled = | ||
| _voiceCommandStartedDuringOnboarding && deviceOnboardingProvider?.isOnboardingActive == true; | ||
| _voiceCommandStartedDuringOnboarding = false; |
There was a problem hiding this comment.
Keep pending tutorial submissions cancellable
When actions are disabled and the second tutorial press ends a voice session, this clears the tutorial-ownership flag before _processVoiceCommandBytes finishes its asynchronous codec lookup. If the user exits during that lookup, cancelTutorialOwnedVoiceSession() now no-ops, the submission generation is not invalidated, and the captured allowWhenDisabled remains true, so the buffered audio is sent after onboarding has ended. Fresh evidence beyond the earlier active-session teardown finding is this post-session, pre-send window; retain ownership until submission finishes or make teardown invalidate tutorial-owned pending submissions too.
AGENTS.md reference: AGENTS.md:L45-L49
Useful? React with 👍 / 👎.
| // pairedDevice instead of the raw advertising-time object. | ||
| final normalizedPairedDevice = pairedDevice ?? normalizedDevice; | ||
| if (captureProvider != null) { | ||
| captureProvider?.updateRecordingDevice(normalizedPairedDevice); |
There was a problem hiding this comment.
Revalidate the connection before restoring the recording device
If the device disconnects while this _onDeviceConnected continuation is awaiting streamDeviceRecording or the subsequent getDeviceInfo, onDeviceDisconnected() invalidates the captured session and clears the capture provider's recording device, but execution resumes here without another session check and assigns the cached paired device back. That leaves capture believing a disconnected device is active and can let its keep-alive path reconnect a transcription socket for the stale ID. Fresh evidence beyond the earlier cached-getter finding is this direct post-await write from a stale connection continuation; recheck connectionSession immediately before updating capture.
AGENTS.md reference: AGENTS.md:L45-L49
Useful? React with 👍 / 👎.
|
Thanks @undivisible — followed up on the rebased head
On the
On the fix shape: reconnect doesn't depend on this socket — With that ruling plus the small gate (or a comment stating the behavior is intended), this is ready for fresh maintainer sign-off. by AI on behalf of David. |
kodjima33
left a comment
There was a problem hiding this comment.
Feature (Omi button action toggle), not a bug fix — approve-only per policy confidence gate. Clean scoped diff (preferences.dart + localization only), no abuse signals. mergeStateStatus=UNKNOWN so holding at approve, not merging.
kodjima33
left a comment
There was a problem hiding this comment.
Feature (Omi button-actions toggle), mobile/app area — approve-only per policy (features stay approve-only outside desktop).
kodjima33
left a comment
There was a problem hiding this comment.
Mobile feature (button-action toggle) — approve-only per policy (not a bug fix); re-affirming approval on backlog re-eval.
kodjima33
left a comment
There was a problem hiding this comment.
feat(app) Omi button action toggle -- feature not bug fix, approve-only; re-approving since reviewDecision reverted to REVIEW_REQUIRED.
kodjima33
left a comment
There was a problem hiding this comment.
Feature (mobile): Omi button actions toggle. Clean, well-tested gating of BLE button/voice-command paths behind a persisted preference; onboarding exemption and race-safe cancellation (submission generation counter) reviewed in full given elevated-scrutiny author. No abuse signals. Approve-only per policy (feature, not bug fix).
kodjima33
left a comment
There was a problem hiding this comment.
app-only feature (Omi button action toggle), gated behind preference; approve per policy (feature in mobile/community area stays approve-only, no merge).
|
Merge-forward performed by @dazheng_hermes_macstudio_bot (authorized by David): merged Conflict resolutions (main's C1/C2 capture-session structure kept, branch semantics re-applied):
Verified locally at |
Summary
Scope
App-only. Firmware is unchanged; firmware-owned behavior such as long-press power-off is not affected.
Verification
bash app/test.sh— 1,112 tests passedbash app/scripts/analyze_ratchet.sh— passedflutter test test/unit/omi_button_actions_test.dart— passedNote
Medium Risk
Changes live BLE button and voice-command submission paths on Omi devices; mistakes could drop legitimate actions or leak audio after the user disables the feature, though cancellation and onboarding guards target that.
Overview
Adds a user preference Omi Button Actions (default on) so the mobile app can ignore single/double-tap and device-button voice commands on Omi hardware without changing firmware.
Device Settings shows an Omi Button Actions switch for
DeviceType.omi; the Double Tap action picker is nested under it and hidden when actions are off. Turning the switch off persists the preference and callscancelActiveVoiceSession()so buffered command audio is not sent later.Capture gates
_handleButtonEventand voice submission on the preference for Omi-typed recording devices only; interactive onboarding still receives button events, with tighter rules so tutorial voice sessions are cancelled on wrapper teardown and cannot submit after onboarding ends.cancelActiveVoiceSessionplus a submission generation counter also blocks in-flight codec/submit races. OpenGlass devices normalized aftergetDeviceInfo()are not subject to this Omi-only gate (voice can still process when actions are “disabled” for Omi).DeviceProvider re-pushes the capability-normalized paired device into capture after connect so the gate matches post-discovery identity (e.g. Omi advertising vs OpenGlass after image stream).
Localized label
omiButtonActionsand unit/controller tests cover persistence and the gating edge cases.Reviewed by Cursor Bugbot for commit 7b26f86. Configure here.
Failure-Class: none
Line-Count-Exception
Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 2900 -> 3116 | Button-actions speaker-haptic injection seam and capability-normalized recording-device updates ride the existing capture lifecycle; file is frozen oversized at 2900 by #9838 and the PR re-applies branch semantics inside main's C1/C2 structure rather than splitting mid-feature.