Skip to content

feat: customizable button actions — single/double/triple tap remappable, long press fixed (#2825) - #13705

Open
apoorvdarshan wants to merge 10 commits into
BasedHardware:mainfrom
apoorvdarshan:cursor/customizable-button-actions-5365
Open

apoorvdarshan wants to merge 10 commits into
BasedHardware:mainfrom
apoorvdarshan:cursor/customizable-button-actions-5365

Conversation

@apoorvdarshan

@apoorvdarshan apoorvdarshan commented Sep 13, 2026 •

Copy link
Copy Markdown
Collaborator

Make Omi single, double and triple taps configurable, with a shared host-testable recognizer for CV1 and DevKit. Fixes #2825.

  • Defaults: single tap asks a question; double tap mutes/unmutes; triple tap ends the conversation. Existing saved double-tap values 0/1/2 retain their historical meaning. Only an unset double-tap choice changes from end-conversation to mute/unmute.
  • Tap presses must be shorter than 300 ms, with less than 350 ms between taps. Single/double events wait for the 350 ms gap to expire; triple tap fires on the third release. A roughly 3 s hold powers off locally.
  • Wire events are 1/2/6 plus trailing release 5; new firmware no longer emits 3/4. New apps still accept old firmware's 3/5 hold-to-talk. Old apps with new firmware lose legacy hold-to-talk and cannot use triple-tap 6; old firmware cannot provide triple tap. App/firmware rollout needs coordination.
  • The app keeps the session-origin guard so a trailing release cannot terminate a tap-started voice question. Upstream capture scheduling, lifetime ownership and current capture policy are retained.
  • Integrated pinned upstream 789de5136cd124991e9956f9ff72891b3ad4416d with a regular merge. Developer testing documentation now records the default, timing and compatibility tradeoffs explicitly.

Validation

  • Pinned Flutter 3.44.5: flutter test --concurrency=2 test/unit/omi_button_action_test.dart test/providers/capture_button_dispatch_test.dart test/widgets/device_settings_double_tap_test.dart test/providers/device_provider_capture_wedge_test.dart — 37 passed.
  • bash omi/firmware/common/test/run.sh — all host gesture tests passed.
  • Localizations regenerated with flutter gen-l10n via the repo localization tool.
  • Capture-retention guards (tiered_capture_test.dart, resume_sync_fence_test.dart) — 24 passed.
  • Analyzer ratchet passed; localization freshness passed (49 locales / 3841 keys).

Remaining validation and maintainer decisions

Physical CV1/DevKit gesture timing, tap feel, BLE packets, long-press power-off and old/new app–firmware combinations remain unverified. Host C tests do not establish device firmware build/install success. Maintainers must sign off on the unset double-tap mute default, 350 ms timing and protocol compatibility; earlier approvals predate this repair head. No physical devices or simulators touched; mobile installation is coordinated separately.

Product invariants affected

INV-CAP-1 — manual mute is explicit user intent; preserve upstream automatic audio-retention behavior.

Failure-Class: FC-ambiguous-wire-event-gated-on-dropped-session-origin

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 DeviceSettings widget shows gesture defaults; isolated host fixture with saved double-tap mute choice. Rendered in headless Flutter tests using iOS theme and bundled fonts, not on a phone or simulator.

Actual triple-tap action sheet; isolated host fixture. Rendered in headless Flutter tests using iOS theme and bundled fonts, not on a phone or simulator.

make preflight passed on the repaired head; complete output is in the local repair evidence. Full pre-push gates remain enabled for the push.

The bounded pre-push gate 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/backend/preferences.dart | 1641 -> 1648 | per-gesture button action storage replacing the single doubleTapAction setting
Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 4609 -> 4622 | gesture-to-action dispatch for remappable device buttons
Line-Count-Exception: app/lib/utils/analytics/analytics_manager.dart | 3138 -> 3144 | button action analytics event

@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 120 files

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

Re-trigger cubic

Comment thread omi/firmware/omi/src/lib/core/button.c Resolved
Comment thread omi/firmware/common/button_gesture.h Resolved
Comment thread app/lib/l10n/app_localizations_ca.dart Resolved
Comment thread app/lib/l10n/app_bn.arb Resolved
Comment thread app/lib/l10n/app_localizations_de.dart Resolved
Comment thread docs/doc/developer/DevKit2Testing.mdx Resolved
@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @apoorvdarshan — this is a genuinely well-executed take on #2825: the shared recogniser, the regression test for the trailing-release bug, and the storage back-compat all check out. Detailed notes below; a few small items to consider, nothing blocking found by static review.

Verified against the issue

  • Gesture layout matches the bounty checklist exactly: single → Ask Question (default), double → Mute/Unmute (default) + remappable, triple → End Conversation (default) + remappable, long press fixed as the power switch in firmware. The "cannot be customised" constraint is respected (OmiButtonGesture deliberately omits the long press, and the settings row is informational only).

What holds up well

  • omi/firmware/common/button_gesture.c — clean pure-C recogniser: one-shot long press that swallows preceding taps and the release, wraparound-safe uint32_t timing, and the trailing 5 preserved so existing clients keep seeing the wire sequence they always have. The host test suite (test/button_gesture_test.c, incl. uptime wraparound) is registered as firmware-button-gesture-tests in .github/checks-manifest.yaml, and both CMakeLists.txt files wire the single implementation into CV1 and DevKit — 158/330 lines of duplicated FSM deleted rather than a third copy added.
  • capture_controller.dart — the _voiceSessionEndsOnRelease origin flag correctly gates the ambiguous release (5): on new firmware it trails every tap, on legacy firmware it ends hold-to-talk. The behavioural tests replay both producer sequences, and encoding the PR 🧹 [Code Health] Remove tracking of legacy long press toggle #12477 lesson in .github/failure-classes/ is exactly the right instinct.
  • preferences.dart / omi_button_action.dart — doubleTapAction keeps its historical key and 0/1/2 encoding, so no migration and existing users' settings survive; fromStoredValue returning null for unknown values so older builds fall back to defaults is good forward-compat.
  • Onboarding step-1 override and the mute in-flight guard are both preserved and covered by capture_button_dispatch_test.dart.

Small items to consider (non-blocking, from static review)

  1. button_gesture.c press-edge vs expired taps: if a new press lands on the first poll tick after the 350 ms gap has expired, the pressed && !fsm->pressed branch accepts it without draining the stale tap_count, so two intentional taps ~350–390 ms apart can merge into a double tap. Draining expired tap state before registering the press edge (as the idle branch does) closes the window.
  2. CV1 re-init: transport_start() calls button_init() again, which calls button_gesture_init() and re-zeroes the FSM after first init. Benign today (static zero-init, poll loop rescheduled separately), but a one-shot init guard would make it robust across that boundary.
  3. _startVoiceCommandTimeout changed 30 s → 15 s for the ask-a-question auto-end. It's only a comment delta here, but it's a user-visible behaviour change riding along — worth confirming it's intended.
  4. Copy nit: the fixed row / longPressFixedSubtitle says power "on / off", while the firmware path only powers off (powering on is the GPIO wake/reset path). "Hold 3 s to power off" would be more accurate.
  5. DevKit2Testing.mdx says "Settings → Device"; the page label is "Device Settings".

Where human sign-off is needed
The wire-contract change is the real product decision: single/double taps are now reported only after the 350 ms gap closes, so every existing user's button gains ~350 ms of latency, and code 6 is new on the wire. The PR states this trade-off plainly and the constant is tunable in one place — but it deserves a maintainer call plus the on-device validation pass the bounty asks for (working with Thinh on hardware). Leaving for maintainer review on that timing/UX judgement rather than anything correctness-related; all CI lanes are green and I found no security, privacy, or supply-chain concerns in the diff.


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 firmware firmware work flutter flutter work labels Sep 13, 2026
@apoorvdarshan

Copy link
Copy Markdown
Collaborator Author

Generated Files: app_en.arb long-press copy was updated in d01f292 but app/lib/l10n/app_localizations.dart still had the old template docs/strings. Regenerated with flutter gen-l10n (7977df9) — CI was failing on the build_runner step, not the separate l10n step.

@apoorvdarshan

Copy link
Copy Markdown
Collaborator Author

Desktop Swift CI (run 34787753290 @ 7977df9f)

Root cause: This PR registers firmware-button-gesture-tests in .github/checks-manifest.yaml. That path is in ROUTING_INPUTS, so selector_changed conservatively set should_run_tests=true and ran the full macOS debug suite even though the diff has no desktop/macos/ sources.

Failure mode: Not a static-contract or product regression — STATIC_OUTCOME was skipped; desktop_swift_tests hit the step regression budget (3607s wall vs 2700s budget). Release compile already passed.

Fix (pushed 86d13d2b on branch cursor/customizable-button-actions-5365): Align with the existing manifest-only rule for Flutter codegen — checks-manifest.yaml edits no longer wake desktop-swift-tests. Predictor / workflow / detect-changes routing inputs still do.

Expected CI: Detect Desktop Swift Changes may still report should_release_compile=true (unchanged); Desktop Swift Static & Test Contracts should skip when both static and tests are false; aggregate Desktop Swift Build & Tests should go green via skipped verify + passing release compile.

Verification locally:

  • python3 .github/scripts/test_pre_push_ci_prediction.py
  • Full PR file list no longer includes desktop-swift-tests phase

cursor Bot pushed a commit to apoorvdarshan/omi that referenced this pull request Sep 14, 2026
…iffs

Adding a host-side firmware check to checks-manifest.yaml made
selector_changed wake the full macOS debug suite on PRs that only
touch app/firmware paths. That lane then failed on the 2700s step
budget (3607s wall) with no Desktop Swift product signal (BasedHardware#13705).

Manifest edits still wake the bounded component lanes; predictor,
workflow, and detect-changes routing inputs still wake
desktop-swift-tests. Manifest-only and app+firmware+manifest diffs
without desktop/macos sources no longer select it.

Verification:
  python3 .github/scripts/test_pre_push_ci_prediction.py
  python3 .github/scripts/test_desktop_swift_ci_contract.py
  scripts/pre_push_ci_prediction.py --changed-files <pr files> --event pull_request
    (no desktop-swift-tests phase)

Co-authored-by: Apoorv Darshan <[email protected]>
@cursor
cursor Bot force-pushed the cursor/customizable-button-actions-5365 branch from 86d13d2 to 1e8ce2e Compare September 14, 2026 04:44
cursor Bot pushed a commit to apoorvdarshan/omi that referenced this pull request Sep 14, 2026
…iffs

Adding a host-side firmware check to checks-manifest.yaml made
selector_changed wake the full macOS debug suite on PRs that only
touch app/firmware paths. That lane then failed on the 2700s step
budget (3607s wall) with no Desktop Swift product signal (BasedHardware#13705).

Manifest edits still wake the bounded component lanes; predictor,
workflow, and detect-changes routing inputs still wake
desktop-swift-tests. Manifest-only and app+firmware+manifest diffs
without desktop/macos sources no longer select it.

Verification:
  python3 .github/scripts/test_pre_push_ci_prediction.py
  python3 .github/scripts/test_desktop_swift_ci_contract.py
  scripts/pre_push_ci_prediction.py --changed-files <pr files> --event pull_request
    (no desktop-swift-tests phase)

Co-authored-by: Apoorv Darshan <[email protected]>
@Git-on-my-level

Copy link
Copy Markdown
Member

Follow-up review on the new head (1e8ce2e), covering the nine commits since the earlier pass: regenerated l10n, the cubic-review fixes, and the CI routing change.

Everything raised earlier is addressed on this head — the press-edge drain of expired taps (button_gesture.c), the one-shot gesture_fsm_initialized guard in the CV1 driver, the long-press copy ("Hold for 3 seconds to power off your Omi" / "Power Off"), and the DevKit2Testing.mdx label. The 15 s voice-question timer turned out to be a comment-only fix: main already ran Duration(seconds: 15), so no behavior change there.

Locally verified on this head:

  • omi/firmware/common/test/run.sh equivalent — compiled with -Wall -Wextra -Werror -pedantic and ran the full host suite, including uptime wraparound: all tests passed.
  • test_pre_push_ci_prediction.py: 31/31 passed.
  • The omiDoubleTap removal from analytics_reachability_baseline.json is consistent: the five scattered call sites are consolidated into exactly one _trackButtonAction dispatcher, and the new omiButtonGesture has its single production caller.
  • The 8 new l10n keys are present in app_en.arb and in the generated app_localizations.dart.

The routing change (1e8ce2ed) is narrow as intended: manifest-only diffs no longer wake desktop-swift-tests / the release compile, while .github/actions/detect-changes/ and predictor/workflow edits still do — both sides are pinned by the two new tests.

Still leaving for maintainer sign-off, unchanged from before: the wire-contract decision (single/double taps now report ~350 ms later for every existing user, new wire code 6, codes 3/4 retired) and the on-device validation pass the bounty asks for. Nothing correctness-, security-, or supply-chain-related found; all CI lanes are green.


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 14, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @apoorvdarshan — this implements #2825 faithfully, including the requested defaults (single tap = Ask a Question, double tap = Mute/Unmute, triple tap = End Conversation, long press fixed to power off).

What I verified on 1e8ce2e:

  • omi/firmware/common/button_gesture.c / .h — the shared recogniser is pure C with no RTOS deps, and the host test is genuinely thorough: 300 ms tap window, 350 ms multi-tap gap, triple tap firing on the third release, the long press firing once and swallowing both its trailing release and any taps that led up to it, and a uint32 uptime-wraparound case. I ran the registered command (omi/firmware/common/test/run.sh) manually from this head — all tests pass. The firmware-button-gesture-tests lane isn't in this PR's visible check list, so it's worth confirming the lane triggers after the manifest registration lands.
  • omi/firmware/omi/src/lib/core/button.c and omi/firmware/devkit/src/button.c — both boards now delegate to the recogniser and delete ~490 lines of duplicated, drifted FSM code (the DevKit copy never emitted triple tap). Per-board long-press behavior is preserved (DevKit: bt_off() + turnoff_all(); CV1: turnoff_all()).
  • app/lib/models/omi_button_action.dart + omi_button_action_test.dart — wire values are pinned to button_gesture.h by test, and the legacy doubleTapAction 0/1/2 encoding is preserved, including an explicit test that a stored 0 stays "end conversation" instead of falling back to the new default. Unknown stored values resolving to the gesture default is good forward-compat hygiene.
  • app/lib/services/capture/capture_controller.dart — handleDeviceButtonState() is a clean extraction of the old inline stream handler, and the new _voiceSessionEndsOnRelease gate fixes a real bug class: current firmware sends 5 right after every tap, which previously could end a tap-started question session almost immediately. The regression test for that, plus the FC-ambiguous-wire-event-gated-on-dropped-session-origin record documenting the contract, are exactly right.
  • capture_button_dispatch_test.dart — solid coverage of default mapping, remapping, "do nothing", legacy 3/5 hold-to-talk, and onboarding interception, including the subtle case where a hold can't restart a tap-opened session.
  • docs/doc/developer/DevKit2Testing.mdx — the updated wire table (6 = triple tap; 3 and 4 reserved; long press powers off with nothing sent) matches the code and its 300/350/3000 ms constants.

Two behavior notes for the maintainer (non-blocking):

  1. Double-tap default migration — on the base of this branch, an unset doubleTapAction read 0 = end conversation; with this PR an unset value resolves to the increased button functionality + customizable buttons ($500) #2825 default of mute/unmute. Users who never explicitly chose will silently move to mute/unmute. That matches the issue's spec, but it's a UX migration worth a conscious sign-off (and maybe a release note).
  2. Wire protocol — values 3 (long press) and 4 (press) are no longer emitted by either firmware, and 6 is new. Old apps on new firmware lose hold-to-talk (expected — power-off is now fixed) and simply ignore 6; new apps keep the 3/5 legacy path for older firmware. This is a BLE protocol decision that deserves maintainer eyes, especially with the increased button functionality + customizable buttons ($500) #2825 hardware-testing phase still ahead.

Also: the branch is 222 commits behind main, and main has since refactored the same timeout area (CaptureScheduling in _startVoiceCommandTimeout), so expect a rebase before merge. MERGEABLE today and checks are green.

Leaving the formal decision to a human maintainer: the firmware wire-protocol semantics and the double-tap default migration are product calls, and the on-hardware validation from #2825 still needs to happen. Great work — the shared, host-tested recogniser is a real improvement over the duplicated FSMs.


Part of the omi keep-an-eye-on-prs automation, on behalf of David. AI-generated feedback; David may not have read it. Not a merge decision.


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

@cursor
cursor Bot force-pushed the cursor/customizable-button-actions-5365 branch from 1e8ce2e to 9db6781 Compare September 18, 2026 00:48
@apoorvdarshan

apoorvdarshan commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator Author

Rebased this branch onto latest BasedHardware/omi main (66bd908) — was ~263 commits behind. Git applied the 9 commits cleanly (no conflict markers).

CaptureScheduling / voice-timeout overlap is integrated, not overwritten: the 15s ask-a-question timer now goes through main’s _scheduling.once, and this PR’s remappable gesture dispatcher, _voiceSessionEndsOnRelease origin gate, and tests are unchanged.

Verified after the rebase:

  • omi/firmware/common/test/run.sh — passed
  • python3 .github/scripts/test_pre_push_ci_prediction.py — 37/37
  • flutter test (3.44.5) omi_button_action_test.dart + capture_button_dispatch_test.dart + device_settings_double_tap_test.dart — 29/29

Force-with-lease pushed to cursor/customizable-button-actions-5365 (9db67817e6). No new PR.

cursor Bot pushed a commit to apoorvdarshan/omi that referenced this pull request Sep 18, 2026
…iffs

Adding a host-side firmware check to checks-manifest.yaml made
selector_changed wake the full macOS debug suite on PRs that only
touch app/firmware paths. That lane then failed on the 2700s step
budget (3607s wall) with no Desktop Swift product signal (BasedHardware#13705).

Manifest edits still wake the bounded component lanes; predictor,
workflow, and detect-changes routing inputs still wake
desktop-swift-tests. Manifest-only and app+firmware+manifest diffs
without desktop/macos sources no longer select it.

Verification:
  python3 .github/scripts/test_pre_push_ci_prediction.py
  python3 .github/scripts/test_desktop_swift_ci_contract.py
  scripts/pre_push_ci_prediction.py --changed-files <pr files> --event pull_request
    (no desktop-swift-tests phase)

Co-authored-by: Apoorv Darshan <[email protected]>
@Git-on-my-level

Copy link
Copy Markdown
Member

Rebase check on the new head 9db67817 (follow-up to the earlier review of 1e8ce2e).

The rebase onto main (66bd908) is the only change — no new feature commits. What I verified on this head:

  • The dispatcher survived the rebase intact: handleDeviceButtonState() in app/lib/services/capture/capture_controller.dart still routes wire codes 1/2/6 through the per-gesture mapping, and the _voiceSessionEndsOnRelease origin gate (the fix for the trailing-5 regression) is present with both regression tests in capture_button_dispatch_test.dart.
  • The rebase correctly adopted main's CaptureScheduling work: the ask-a-question auto-end timer goes through _scheduling.once(...) at 15 s, matching main — no behavior drift there.
  • Re-ran the firmware host test on this head (omi/firmware/common/test/run.sh): all 11 cases pass, also under -fsanitize=address,undefined. As noted before, the firmware-button-gesture-tests lane still doesn't appear in this head's check-run list — worth confirming it fires once the manifest entry reaches main.
  • CI on 9db67817 is green (Dart Analyze & Tests, Generated Files, Android Compile Smoke, Hygiene, Backend Hermetic Merge Gate, …).

One new action item: GitHub currently reports the branch conflicting with main again — main has moved past 66bd908 since your rebase. It will need one more rebase before merge; given how fast main moves, rebasing shortly before merge rather than immediately is a reasonable strategy, just flagging it so it's not a surprise.

Still open from my earlier review (maintainer calls, unchanged by the rebase): the wire-protocol semantics (codes 3/4 no longer emitted, 6 new), the double-tap default migration (unset → mute/unmute), and the on-device validation phase from #2825.

Needs a human maintainer's sign-off before merge: the BLE wire-protocol change and the double-tap default migration are product decisions, and #2825's hardware-testing phase is still ahead.


Part of the omi keep-an-eye-on-prs automation, on behalf of David. AI-generated feedback; David may not have read it. Not a merge decision.


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

@cursor
cursor Bot force-pushed the cursor/customizable-button-actions-5365 branch from 9db6781 to 968461b Compare September 18, 2026 22:38
cursor Bot pushed a commit to apoorvdarshan/omi that referenced this pull request Sep 18, 2026
…iffs

Adding a host-side firmware check to checks-manifest.yaml made
selector_changed wake the full macOS debug suite on PRs that only
touch app/firmware paths. That lane then failed on the 2700s step
budget (3607s wall) with no Desktop Swift product signal (BasedHardware#13705).

Manifest edits still wake the bounded component lanes; predictor,
workflow, and detect-changes routing inputs still wake
desktop-swift-tests. Manifest-only and app+firmware+manifest diffs
without desktop/macos sources no longer select it.

Verification:
  python3 .github/scripts/test_pre_push_ci_prediction.py
  python3 .github/scripts/test_desktop_swift_ci_contract.py
  scripts/pre_push_ci_prediction.py --changed-files <pr files> --event pull_request
    (no desktop-swift-tests phase)

Co-authored-by: Apoorv Darshan <[email protected]>
@apoorvdarshan

Copy link
Copy Markdown
Collaborator Author

Rebased this branch onto latest BasedHardware/omi main (b38c545) — was 112 commits behind 66bd908 and dirty again.

Two conflicts resolved, rest of the 9 commits applied cleanly:

  • .github/checks-manifest.yaml — kept main’s new checks and this PR’s firmware-button-gesture-tests lane.
  • capture_controller.dart streamButton — kept main’s CaptureLifetime.takeSubscription + 15s _scheduling.once timeout, and this PR’s remappable handleDeviceButtonState dispatcher, _voiceSessionEndsOnRelease origin gate, and tests. Did not expand into wire-protocol / on-device validation.

Verified after the rebase:

  • omi/firmware/common/test/run.sh — passed
  • python3 .github/scripts/test_pre_push_ci_prediction.py — 38/38
  • python3 .github/scripts/test_desktop_swift_ci_contract.py — 39/39
  • Flutter tests not re-run here (no Flutter SDK on this VM); CI Dart Analyze & Tests is the authority.

Force-with-lease pushed to cursor/customizable-button-actions-5365 (968461b44f). No new PR.

@apoorvdarshan

Copy link
Copy Markdown
Collaborator Author

Hygiene failed after the rebase on product-file-line-count-ratchet (capture_controller.dart 2861→2877, analytics_manager.dart 2417→2423). Formatting and diff-hygiene were already clean.

Declared the two Line-Count-Exception allowances in the PR body — did not split those files or touch wire-protocol / on-device work. Empty commit f0849b21a1 retriggers the code-lane Hygiene job (body edits only run metadata-preflight).

Verified locally: line-count ratchet passes against the live PR body; check_diff_hygiene.py clean.

@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: customizable tap-action remapping — reclassified to mobile/app (no firmware files in current diff despite stale 'firmware' label); feature, approve-only. CI green.

cursor Bot pushed a commit to apoorvdarshan/omi that referenced this pull request Sep 19, 2026
…iffs

Adding a host-side firmware check to checks-manifest.yaml made
selector_changed wake the full macOS debug suite on PRs that only
touch app/firmware paths. That lane then failed on the 2700s step
budget (3607s wall) with no Desktop Swift product signal (BasedHardware#13705).

Manifest edits still wake the bounded component lanes; predictor,
workflow, and detect-changes routing inputs still wake
desktop-swift-tests. Manifest-only and app+firmware+manifest diffs
without desktop/macos sources no longer select it.

Verification:
  python3 .github/scripts/test_pre_push_ci_prediction.py
  python3 .github/scripts/test_desktop_swift_ci_contract.py
  scripts/pre_push_ci_prediction.py --changed-files <pr files> --event pull_request
    (no desktop-swift-tests phase)

Co-authored-by: Apoorv Darshan <[email protected]>
@cursor
cursor Bot force-pushed the cursor/customizable-button-actions-5365 branch from f0849b2 to 3b1dadd Compare September 19, 2026 23:24
cursor Bot pushed a commit to apoorvdarshan/omi that referenced this pull request Sep 22, 2026
…iffs

Adding a host-side firmware check to checks-manifest.yaml made
selector_changed wake the full macOS debug suite on PRs that only
touch app/firmware paths. That lane then failed on the 2700s step
budget (3607s wall) with no Desktop Swift product signal (BasedHardware#13705).

Manifest edits still wake the bounded component lanes; predictor,
workflow, and detect-changes routing inputs still wake
desktop-swift-tests. Manifest-only and app+firmware+manifest diffs
without desktop/macos sources no longer select it.

Verification:
  python3 .github/scripts/test_pre_push_ci_prediction.py
  python3 .github/scripts/test_desktop_swift_ci_contract.py
  scripts/pre_push_ci_prediction.py --changed-files <pr files> --event pull_request
    (no desktop-swift-tests phase)

Co-authored-by: Apoorv Darshan <[email protected]>
@cursor
cursor Bot force-pushed the cursor/customizable-button-actions-5365 branch from 3b1dadd to 9e92dad Compare September 22, 2026 05:08
cursor Bot pushed a commit to apoorvdarshan/omi that referenced this pull request Sep 24, 2026
…iffs

Adding a host-side firmware check to checks-manifest.yaml made
selector_changed wake the full macOS debug suite on PRs that only
touch app/firmware paths. That lane then failed on the 2700s step
budget (3607s wall) with no Desktop Swift product signal (BasedHardware#13705).

Manifest edits still wake the bounded component lanes; predictor,
workflow, and detect-changes routing inputs still wake
desktop-swift-tests. Manifest-only and app+firmware+manifest diffs
without desktop/macos sources no longer select it.

Verification:
  python3 .github/scripts/test_pre_push_ci_prediction.py
  python3 .github/scripts/test_desktop_swift_ci_contract.py
  scripts/pre_push_ci_prediction.py --changed-files <pr files> --event pull_request
    (no desktop-swift-tests phase)

Co-authored-by: Apoorv Darshan <[email protected]>
@cursor
cursor Bot force-pushed the cursor/customizable-button-actions-5365 branch from 9e92b35 to 834ceb7 Compare September 24, 2026 15:27
cursor Bot pushed a commit to apoorvdarshan/omi that referenced this pull request Sep 25, 2026
…iffs

Adding a host-side firmware check to checks-manifest.yaml made
selector_changed wake the full macOS debug suite on PRs that only
touch app/firmware paths. That lane then failed on the 2700s step
budget (3607s wall) with no Desktop Swift product signal (BasedHardware#13705).

Manifest edits still wake the bounded component lanes; predictor,
workflow, and detect-changes routing inputs still wake
desktop-swift-tests. Manifest-only and app+firmware+manifest diffs
without desktop/macos sources no longer select it.

Verification:
  python3 .github/scripts/test_pre_push_ci_prediction.py
  python3 .github/scripts/test_desktop_swift_ci_contract.py
  scripts/pre_push_ci_prediction.py --changed-files <pr files> --event pull_request
    (no desktop-swift-tests phase)

Co-authored-by: Apoorv Darshan <[email protected]>
@cursor
cursor Bot force-pushed the cursor/customizable-button-actions-5365 branch from 834ceb7 to 4d8cdf9 Compare September 25, 2026 04:29
cursor Bot pushed a commit to apoorvdarshan/omi that referenced this pull request Sep 25, 2026
…iffs

Adding a host-side firmware check to checks-manifest.yaml made
selector_changed wake the full macOS debug suite on PRs that only
touch app/firmware paths. That lane then failed on the 2700s step
budget (3607s wall) with no Desktop Swift product signal (BasedHardware#13705).

Manifest edits still wake the bounded component lanes; predictor,
workflow, and detect-changes routing inputs still wake
desktop-swift-tests. Manifest-only and app+firmware+manifest diffs
without desktop/macos sources no longer select it.

Verification:
  python3 .github/scripts/test_pre_push_ci_prediction.py
  python3 .github/scripts/test_desktop_swift_ci_contract.py
  scripts/pre_push_ci_prediction.py --changed-files <pr files> --event pull_request
    (no desktop-swift-tests phase)

Co-authored-by: Apoorv Darshan <[email protected]>
@cursor
cursor Bot force-pushed the cursor/customizable-button-actions-5365 branch from 4d8cdf9 to 5acd969 Compare September 25, 2026 04:30
@Git-on-my-level

Copy link
Copy Markdown
Member

Reviewed the current head end to end — this is a genuinely well-built PR. Static findings, file by file:

Firmware

  • omi/firmware/common/button_gesture.c (+ button_gesture.h): the new shared recogniser is a clean pure-C FSM. I traced tap counting (<300 ms press, <350 ms gap), single/double reported when the gap window closes, triple on third release, the one-shot 3 s long press that swallows preceding taps, the trailing release (5) preserved after each gesture, and the press-edge drain via release_pending/pending_press. The now_ms - last_release_ms diffs are uint32_t and wraparound-safe.
  • omi/firmware/devkit/src/button.c (-330) and omi/firmware/omi/src/lib/core/button.c (-158): both duplicated tick-counting FSMs collapse into the shared recogniser; both CMakeLists changes are mechanical (../common/button_gesture.c + include dir).
  • omi/firmware/common/test/ + .github/checks-manifest.yaml: host test compiled with -Wall -Wextra -Werror -pedantic, registered as firmware-button-gesture-tests following the existing manifest pattern. Good move — this contract was previously only verifiable on hardware.

App

  • app/lib/models/omi_button_action.dart: storedValue 0/1/2 preserve the historical doubleTapAction encoding (no migration), fromStoredValue returns null on unknown values with gesture-default fallback, and long press is correctly excluded from remappable gestures.
  • app/lib/services/capture/capture_controller.dart: single handleDeviceButtonState → _runButtonAction dispatch covers all five actions, and the release (5) now only ends a voice-question session when _voiceCommandTrigger == legacyLongPress — this correctly prevents the new firmware's trailing release from killing a toggle-started session. The FC-ambiguous-wire-event… failure-class record and the 237-line dispatch test lock that contract in.
  • preferences.dart, device_settings.dart, device_control_sheets.dart, settings_search_index.dart, analytics: consistent with the model; omiDoubleTap series deliberately kept for double taps.
  • docs/doc/developer/DevKit2Testing.mdx: the updated table matches the code (3/4 reserved, 5 trails every tap, 6 = triple, 300/350/3000 ms constants). Accurate.
  • Backend test changes are line-length reformatting only — unrelated churn, but minor and not worth a split on an otherwise cohesive PR.

Two things that need a maintainer decision before merge (code looks correct; these are product/compat calls):

  1. Wire-protocol compatibility: codes 3/4 are no longer emitted, 6 is new, and 5 now trails every tap. The app gating handles legacy combinations, but older app builds paired with new firmware is a fleet-compatibility judgment.
  2. The disclosed trade-off that single/double taps now report ~350 ms after the last release — whether that feels right on a real device is a product call.

Also noting the prior approval (@kodjima33, Sep 19) is on f0849b2, five commits before the current head (pushed Sep 30) — worth a quick re-confirm on this head. Checks that ran are green; Dart Analyze & Tests was path-skipped on this head, so the new Dart tests haven't run in CI.

Thanks for the exceptionally thorough work — the PR description's plain statement of the latency trade-off and the failure-class write-up made review much easier.

This review was produced by AI automation on behalf of 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.

Copilot AI balanced review requested due to automatic review settings October 2, 2026 09:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @apoorvdarshan — this is a well-executed end-to-end feature, and the PR description's honesty about the tradeoffs makes review much easier. Notes from a static pass over the current head:

Firmware

  • omi/firmware/common/button_gesture.c + button_gesture.h: the pure-C recogniser is a nice design — no RTOS dependency, host-testable, and the pending_press/release_pending pair correctly preserves the trailing release (5) that existing clients observe. The (now_ms - fsm->last_release_ms) unsigned arithmetic is wraparound-safe, and the one-shot long press swallowing leading taps is the right behavior.
  • omi/firmware/omi/src/lib/core/button.c and omi/firmware/devkit/src/button.c: removing ~490 lines of duplicated FSM across the two drivers in favor of the shared module is a real maintainability win. button_gesture_test.c (274 lines) plus the run.sh registration in .github/checks-manifest.yaml give the tap-window, triple-tap, long-press, and wraparound contracts host coverage — good call.

App

  • app/lib/models/omi_button_action.dart: keeping the historical 0/1/2 stored values for doubleTapAction (never renumber) and returning null from fromStoredValue for unknown values so older builds fall back to gesture defaults is exactly the right compatibility posture. app/lib/backend/preferences.dart keeps the same prefs key, so no migration is needed.
  • app/lib/services/capture/capture_controller.dart: the single _runButtonAction dispatcher cleans up the old per-gesture branching, and gating release (5) on a hold-started session (with the behavioural test in capture_button_dispatch_test.dart and the new failure-class artifact) directly prevents the tap-trailing-release from killing a voice-question session. Widget/unit test additions are solid.

Docs

  • docs/doc/developer/DevKit2Testing.mdx: the updated wire table matches the firmware behavior (6 = triple tap, 5 follows every tap, long press powers off with nothing sent). Accurate and narrow.

Two things for maintainer sign-off (product decisions, not code defects):

  1. Tap latency: single/double taps are now reported only after the BUTTON_GESTURE_MULTI_TAP_GAP_MS (350 ms) window closes. The PR states this plainly, but the resulting feel — and whether 350 ms is the right constant on real hardware — is a judgment call for someone who can test on a device.
  2. Wire codes 3/4 are no longer emitted. An older app paired with this firmware loses the legacy hold-to-talk question flow entirely (code 3 never arrives). Worth confirming the app-update-vs-firmware-OTA sequencing before this ships.

Minor: the reformatting-only churn in backend/tests/unit/test_conversations_batch_chunking.py, test_conversations_share_email_sanitization.py, and test_calendar_tools_sanitization.py is unrelated to this feature — if it's a stray formatter run, dropping it would keep the diff focused.

Keeping needs-maintainer-review for the two decision points above; positive-signal retained for the quality of the implementation.


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

Rebase the existing button feature, preserve onboarding interception and the newer settings menu. 21 focused button/controller/search tests passed. Failure-Class: none.
@apoorvdarshan
apoorvdarshan force-pushed the cursor/customizable-button-actions-5365 branch from 82f3eaa to 7dd3dfd Compare October 4, 2026 08:16
@Git-on-my-level

Copy link
Copy Markdown
Member

Reviewed end to end — this is a strong, cohesive implementation of #2825's gesture table, and I independently verified the firmware side: fetched omi/firmware/common/button_gesture.{c,h} + the test at this head, bash omi/firmware/common/test/run.sh passes, and a gcc -fsanitize=address,undefined build of the same suite is clean. Two extra probes beyond the shipped tests also behave as documented (an exactly-3000 ms hold fires the long press; a 4th tap after a triple is swallowed).

Highlights worth calling out:

  • button.c (CV1) and devkit/src/button.c replace two ~330/~158-line duplicated tick-counting FSMs with one host-testable recogniser; k_uptime_get_32() fixes the manual tick-counter drift and wraparound.
  • The capture_controller.dart rewrite fixes a real regression on current main: since 🧹 [Code Health] Remove tracking of legacy long press toggle #12477 dropped the session-origin flag, the trailing wire 5 after every tap was ending tap-started ask-a-question sessions before any audio was captured. The origin-gated release handling plus the replay tests in capture_button_dispatch_test.dart (and the new failure-class JSON) are exactly the right shape.
  • Legacy doubleTapAction 0/1/2 prefs encoding is preserved with explicit tests for explicit-0 and unknown-value fallback — no migration needed.

Two things I'd want a maintainer to confirm before merge (neither blocks review progress):

  1. Product call: an unset doubleTapAction now defaults to mute/unmute instead of end-conversation (per the issue's table). Stored choices are honoured; only the never-touched default changes.
  2. On-device validation: the recogniser is host-verified but hasn't run on CV1/DevKit hardware — the ~350 ms single/double-tap reporting window and tap timings deserve a real-finger pass, and the earlier approval on this PR predates the current head by several commits.

Minor: the backend test-file reformatting (test_conversations_batch_chunking.py, test_conversations_share_email_sanitization.py) is unrelated churn — harmless since Formatting is green, just noting it pads the diff.

Leaving for human maintainer review for the default-change sign-off and hardware validation.

AI-generated maintainer feedback on behalf of the Omi 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.

Integrates upstream 789de51 without rewriting PR history. Verification evidence: repair-evidence/20261011-13705-*.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.
apoorvdarshan added a commit to apoorvdarshan/omi that referenced this pull request Oct 11, 2026
@apoorvdarshan apoorvdarshan added the ci:full Maintainer-granted: run full CI on this fork PR label Oct 13, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member

Verdict: the cross-stack implementation is in good shape and unusually well tested for a firmware+app change; what remains is a product/rollout sign-off rather than code fixes.

What I verified:

  • omi/firmware/common/button_gesture.c + button_gesture.h: the new shared recognizer cleanly replaces the two divergent ad-hoc FSMs in omi/firmware/omi/src/lib/core/button.c (-158 lines) and omi/firmware/devkit/src/button.c (-330 lines). I compiled and ran the host suite locally: clean under -Wall -Wextra -Werror -pedantic, and all behavioral tests pass (single/double tap windows, triple tap reported on the third release, one-shot long press that swallows its release, 300-3000 ms hold becoming a plain release, uptime wraparound).
  • Wire protocol: codes 3 and 4 are no longer emitted, 6 (triple tap) is new, and 5 trails every tap. docs/doc/developer/DevKit2Testing.mdx documents the skew honestly: an older app on new firmware loses legacy hold-to-talk and cannot use triple tap.
  • app/lib/models/omi_button_action.dart + app/test/unit/omi_button_action_test.dart: the typed mapping preserves the historical 0/1/2 doubleTapAction encoding, with tests for explicit-0 and unknown-value fallback to the gesture default.
  • app/lib/services/capture/capture_controller.dart: the dispatch refactor keeps legacy firmware working (release 5 only ends a session that hold 3 opened - the trigger gate is intact), and app/test/providers/capture_button_dispatch_test.dart pins the trailing-5-kills-the-session regression from 🧹 [Code Health] Remove tracking of legacy long press toggle #12477. Capturing that lesson as .github/failure-classes/FC-ambiguous-wire-event-gated-on-dropped-session-origin.json is a good pattern.
  • app/lib/backend/preferences.dart, app/lib/pages/settings/device_settings.dart, settings_search_index.dart, device_control_sheets.dart: consistent wiring; the action sheet now scrolls for five options. .github/checks-manifest.yaml registers the firmware host test additively, matching the existing pattern.

UX (one deliberate change to confirm): users who never saved a double-tap choice move from the old default "end conversation" (0) to the new default "mute/unmute" - DevKit2Testing.mdx states this is intended, but it silently changes behavior for existing installs that never opened the setting. Worth an explicit maintainer yes.
Blast radius: the firmware/app rollout skew above; single/double taps now report after the 350 ms multi-tap window closes (old code waited ~300 ms), so tap feedback is slightly more delayed, and the docs themselves flag physical CV1/DevKit validation as pending (BLE packets, timing feel, power-off, old-app combinations).
Security: no concerns - no secrets, network, or dependency surface; the .github additions are a data file and an additive test registration.

USER IMPACT: People can remap single/double/triple taps under Settings -> Device (ask a question, mute, end, star, or do nothing); anyone who never changed the double-tap setting will now get mute instead of end-conversation; long press remains power-off.

Still wanted before merge: the physical device validation listed in DevKit2Testing.mdx, an explicit confirmation of the double-tap default change, and a check that the new firmware-button-gesture-tests manifest id actually executes in CI (it does not appear by name in this PR's check run list).

Leaving for human maintainer review: the default double-tap change for existing users and the app/firmware rollout coordination are product decisions, and the earlier approval (kodjima33) is on a prior head of this branch.


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

@mintlify

mintlify Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 253c306.

Approve preview

apoorvdarshan and others added 3 commits November 2, 2026 11:35
The Device page rebuilds on every DeviceProvider tick, and each OmiSettingsRow
relays out (and so repaints its whole group) when rebuilt. The three extra
gesture rows pushed the device_page perf gate over its paint budget.

Move the gesture rows into a self-contained DeviceButtonGestureRows widget
behind its own RepaintBoundary. The page caches one instance, so ticks skip
it entirely; the tutorial bumps a revision on return so a double-tap choice
saved there still shows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The device_page gate still came within 7 paints of its budget on one trial.
Every DeviceProvider tick rebuilt the customization group, relaying out and
repainting the Find and button-actions rows. Reuse the group widget while
everything it reads (device, provider, locale, find/toggle state, gesture
rows, LED and mic-gain state) is unchanged, so a tick skips it entirely.

Point the settings search entries for the tap and long-press gestures at
device_button_gesture_rows.dart, which now draws those rows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The device_page gate connects an Omi that was never saved, so getDeviceInfo
swaps pairedDevice to BtDevice.empty() mid-scenario. Keying the cached
customization group on the device object missed on exactly that rebuild,
which relaid out and repainted the whole group. The group only uses the
device for isOmi and supportsFind, so key on those instead.

Draw the dividers inside the gesture block as one coloured 1pt box instead
of a Divider (five render objects each); the line looks the same.

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

Copy link
Copy Markdown
Member

Verdict: this is in good shape — cohesive feature, correct wire-protocol handling, and unusually strong tests on both the firmware and app sides; what remains are maintainer product/rollout sign-offs, not code fixes.

What I verified:

  • omi/firmware/common/button_gesture.c + button_gesture.h: the new shared recognizer is a clean one-gesture-per-poll FSM. Checked the tricky paths: press-edge flush of an expired tap window (single/double emit only after the 350 ms gap), triple tap firing on the third release, long press as a one-shot that swallows both preceding taps and the trailing release, medium holds degrading to a plain release, and unsigned time arithmetic so k_uptime_get_32() wraparound cannot break timing (test_uptime_wraparound_does_not_break_timing covers it).
  • omi/firmware/omi/src/lib/core/button.c and omi/firmware/devkit/src/button.c: both drop their divergent copies of the old FSM for the shared one; power-off behavior per board (bt_off()+turnoff_all() on DevKit, turnoff_all() on CV1) is preserved, and the CMakeLists wiring adds the common source and include dir.
  • app/lib/services/capture/capture_controller.dart: handleDeviceButtonState routes 1/2/6 through the user's mapping, keeps legacy 3-then-5 hold-to-talk, and — the critical regression risk — only a legacyLongPress-triggered session may be ended by release 5, so the trailing 5 the new firmware sends after every tap cannot kill a tap-started ask-a-question session (capture_button_dispatch_test.dart replays exactly both producers' sequences). Onboarding step 1 forcing ask-a-question regardless of remapping is a sensible product call, and it's tested.
  • app/lib/backend/preferences.dart + app/lib/models/omi_button_action.dart: stored encoding 0/1/2 for doubleTapAction is preserved bit-for-bit, unknown/absent values fall back to per-gesture defaults, and omi_button_action_test.dart pins the wire values against button_gesture.h.
  • Settings UI (device_button_gesture_rows.dart, device_control_sheets.dart, device_settings.dart, settings_search_index.dart): per-gesture rows with a fixed informational long-press row (tested that it opens no sheet), RepaintBoundary/caching so DeviceProvider ticks don't repaint the group, and search entries retargeted to the new rows.
  • .github/checks-manifest.yaml + omi/firmware/common/test/run.sh: additive CI check; the script only host-compiles two local C files with -Werror and runs them — no network, no secrets. .github/failure-classes/FC-….json documents the session-origin gate with the regression test as the canonical artifact, and evidence.json honestly labels the UI screenshots as headless-test renders.

Material dimensions:

  • UX: single and double taps now surface only after the 350 ms gap expires (~350–390 ms after release), so ask-a-question via single tap feels slightly later than before; triple tap is immediate. Users who never chose a double-tap action will see it change from end-conversation to mute/unmute after update — explicit saved choices keep their meaning.
  • Blast radius / compatibility: new firmware stops emitting 3/4, so older apps lose legacy hold-to-talk and can't use triple tap; new apps keep accepting old firmware's 3/5. App and firmware rollout needs coordination, as the description states.
  • Security: nothing sensitive — pure logic, no secrets, no dependency changes, no data-handling changes.

USER IMPACT: people with an Omi device can choose what single, double, and triple taps do (ask, mute, end, star, nothing) in Settings → Device; long press stays as power-off; anyone who hadn't set a double-tap action will find it now mutes instead of ending the conversation.

What I'd still want before merge: physical CV1/DevKit validation of tap feel and the 300 ms/350 ms timing, a BLE packet capture of the 1/2/6-then-5 sequences, the old-app-with-new-firmware (and new-app-with-old-firmware) matrix, and maintainer sign-off on the unset-double-tap default change. Keeping needs-maintainer-review on for those product/rollout decisions — the code itself looks merge-ready to me.

Feedback is automated on behalf of 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.

@Git-on-my-level Git-on-my-level removed the firmware firmware work label Nov 2, 2026

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.

increased button functionality + customizable buttons ($500)

4 participants