Skip to content

fix(app): let a repeated Omi haptic link buzz every time - #22718

Merged
kodjima33 merged 1 commit into
BasedHardware:mainfrom
sauranshbhardwaj:fix/haptic-link-repeats
Oct 20, 2026
Merged

kodjima33 merged 1 commit into
BasedHardware:mainfrom
sauranshbhardwaj:fix/haptic-link-repeats

Conversation

@sauranshbhardwaj

@sauranshbhardwaj sauranshbhardwaj commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What's wrong

AppShell listens to app links through a deduped stream:

// app/lib/core/app_shell.dart
_linkSubscription = _appLinks.uriLinkStream.distinct().listen((uri) {
  openAppLink(uri);
});

distinct() drops any link equal to the previous one. #13698 sends omi://device/haptic?level=N through this same stream, so the second identical haptic link never reaches runExternalHapticTrigger: no buzz and no "External haptic trigger result" log line. That is the feature's main use (an agent signalling "done" again, a Shortcut run twice); the trigger's 2 s rate limiter exists because repeats are expected. Changing the level makes it work again, which hides the cause. app_links 6.4.1 emits every opened URL on iOS with no dedupe of its own, so the distinct() is the only filter.

links sent, 10 s apart before after
haptic?level=2, haptic?level=2 1 buzz 2 buzzes
haptic?level=2, haptic?level=3 2 buzzes 2 buzzes
app/settings, app/settings opened once opened once (unchanged)

Change

isRepeatedAppLink in external_haptic_trigger.dart keeps the dedupe for every link except a haptic command, and AppShell passes it to distinct. Bursts stay bounded by the existing rate limiter.

Tests

test/unit/external_haptic_trigger_test.dart, group "app link stream":

  • the same haptic link three times passes three times (main's distinct() passes one);
  • a repeated omi://app/settings is still dropped, also around a haptic link.

The existing trigger and rate limiter tests pass unchanged.

UI-Evidence: none -- no visible UI; the fix lets a repeated link reach the device haptic.

Failure-Class: none

View guided diff

AppShell listens to app links through `uriLinkStream.distinct()`, which
drops any link equal to the one before it. BasedHardware#13698 routes
`omi://device/haptic?level=N` through the same stream, so the second
identical haptic link (an agent signalling "done" again, a Shortcut run
twice) never reaches runExternalHapticTrigger: no buzz, no log line.
Changing the level makes it work again, which is how it shows up.

Haptic links are commands, so they now pass the dedupe; the trigger's
2s rate limiter already bounds bursts. Every other link is still
deduped as before.
@Git-on-my-level

Copy link
Copy Markdown
Member

This is a correct, tightly scoped fix — no blocking issues from me.

  • app/lib/core/app_shell.dart: the warm-start listener now uses .distinct(isRepeatedAppLink) instead of plain .distinct(); cold-start handling and openAppLink are untouched, so the change is confined to adjacent-dedupe policy on the warm stream.
  • app/lib/services/external_haptic_trigger.dart: isRepeatedAppLink suppresses a repeat only when ExternalHapticTrigger.tryParse(next) returns null. Since tryParse accepts exactly omi|omi-dev|omi-beta://device/haptic?level=1..3, only genuine haptic commands escape dedupe — navigation links (e.g. omi://app/settings) keep their existing drop-on-repeat behavior. Burst safety holds: repeats re-enter runExternalHapticTrigger, where the per-device 2s single-flight rate limiter still bounds physical buzzes; the old dedupe was redundant protection, not the real bound.
  • app/test/unit/external_haptic_trigger_test.dart: both behaviors are pinned — an identical haptic link sent three times passes three times, and a repeated settings link is still dropped, including around a haptic link.
  • app/changelog/unreleased/20261020-haptic-link-repeats.json: user-facing fragment present and matches the actual behavior.

Security: the deep-link → haptic surface already existed (#13698); this only removes adjacent-dedupe, and the rate limiter still caps it at one buzz per 2s per device. No new attack surface.

USER IMPACT: sending the same Omi haptic link again now buzzes the device again; every other app link behaves exactly as before.

Nothing further required from my side — leaving merge sign-off to a human maintainer.

Automated 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.

@Git-on-my-level Git-on-my-level added the flutter flutter work label Oct 20, 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.

Scoped mobile bug fix (24 lines) for haptic link dedupe with clear repro table and new test; 5/5 confidence, CI green.

@kodjima33
kodjima33 merged commit 4922a89 into BasedHardware:main Oct 20, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flutter flutter work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants