Skip to content

[codex] Add G2 selectable list support#3240

Closed
PhilippeFerreiraDeSousa wants to merge 4 commits into
devfrom
cyborgday-github-miniapp
Closed

[codex] Add G2 selectable list support#3240
PhilippeFerreiraDeSousa wants to merge 4 commits into
devfrom
cyborgday-github-miniapp

Conversation

@PhilippeFerreiraDeSousa

@PhilippeFerreiraDeSousa PhilippeFerreiraDeSousa commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds native selectable-list support for G2 display miniapps across the local miniapp SDK, phone runtime, and Bluetooth SDK native layers.

What Changed

  • Added display.showSelectableList(...) to the miniapp SDK surface.
  • Added touch event fields for native list selections: selectedItemName, selectedItemIndex, container metadata.
  • Plumbed selectable-list layouts through the local miniapp runtime to the Bluetooth SDK.
  • Implemented G2 list container creation/rebuild and list event parsing on Android and iOS.
  • Disabled the G2 native-dashboard side effect on double-click while preserving the miniapp touch event.
  • Fixed iOS Swift actor/type-check build blockers touched by the selectable-list changes.
  • Added SDK test coverage for the selectable-list display request shape.

Validation

  • mobile/modules/miniapp: bun test src/session.test.ts
  • mobile/modules/miniapp: bun run typecheck
  • mobile/modules/miniapp: bun run build
  • repo root: ./scripts/check-android-compile.sh bluetooth-sdk
  • mobile: xcodebuild -workspace ios/Mentra.xcworkspace -scheme Mentra -configuration Debug -destination id=00008120-001619E102E1A01E -derivedDataPath ios/build -allowProvisioningUpdates build
  • repo root: git diff --check

Notes

The selectable-list demo miniapp created locally for manual testing is intentionally not included in this PR.


Note

Medium Risk
Changes touch G2 display page lifecycle, gesture routing, and Bluetooth-native protobuf paths; incorrect list/text interaction could affect all G2 miniapp rendering, though scope is mostly additive with a deliberate double-click behavior change.

Overview
Adds G2 firmware-native selectable lists end-to-end: miniapps can call showSelectableList, the phone runtime emits a selectable_list layout, and Android/iOS Bluetooth SDK builds list containers on the Even Hub page and parses ListEvent gestures into touch payloads (selectedItemName, selectedItemIndex, container metadata). View-state dedup on both platforms now includes list fields so identical list updates do not churn the display.

Touch plumbing extends sendTouchEvent with optional extra fields on iOS and Android. Jest gains a stub for localMiniappRuntime.hasTouchSubscriberForGesture. On G2 firmware, double-click no longer auto-opens the native dashboard (logged as disabled); head-up toggle behavior remains when native dashboard is off.

Two new workspace miniapps ship in the diff: dev-hud (background + React UI + local sidecar that aggregates GitHub PRs via gh, Codex state from local SQLite/JSON, diff-based notifications, glasses menus via selectable lists) and selectable-list-demo (minimal list + touch demo). bun.lock registers both packages.

iOS DeviceManager gets unrelated hardening in the same diff: @MainActor timers/tasks for mic reinit and startup animation, structured viewStateKey for layout equality, and small Swift formatting fixes.

Reviewed by Cursor Bugbot for commit cd5682b. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

📋 PR Review Helper

📱 Mobile App Build

Ready to test! (commit ba09752)

📥 Download APK

🕶️ ASG Client Build

Waiting for build...


🔀 Test Locally

gh pr checkout 3240

@PhilippeFerreiraDeSousa PhilippeFerreiraDeSousa marked this pull request as ready for review June 24, 2026 23:46
@github-actions

Copy link
Copy Markdown
Contributor

PR Agent Orchestrator State

{
  "cycle": 1,
  "fixRound": 0,
  "totalReviewerRuns": 1,
  "consecutiveNoNewReviews": 1,
  "openFindings": [],
  "resolvedFindings": [],
  "nitFindings": [],
  "phase": "discovery",
  "status": "in_progress",
  "stagnationFixRounds": 0,
  "fingerprintReopenCounts": {},
  "mutedFingerprints": [],
  "lastPair": [],
  "lastOpenCount": 0
}

@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Agent Review — cycle 1

✅ No blocking findings · 0 blocking · 0 nits
Reviewers this cycle: none

No model reviews ran this cycle.

Updated automatically by the PR Agent Orchestrator each review cycle. Nits do not block merge.

@PhilippeFerreiraDeSousa

Copy link
Copy Markdown
Contributor Author

@codex review

timestamp: Long,
source: Int? = null
source: Int? = null,
extra: Map<String, Any>? = null

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't like extra

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba0975286a

ℹ️ 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".

}
signalDisplayDirty()
if (hadListContainers && pageCreated) {
displayScope.launch { rebuildPage() }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve G2 mic after clearing selectable lists

When clearDisplay() is called while a selectable list is on screen, this branch clears listContainers and only sends rebuildPage(), which shuts the EvenHub page down; because there is then no pending text/image/list, reconcileDisplay() will not call rebuildState(), so the mic restart path in rebuildState() never runs. This regresses the existing clear-display behavior for any G2 flow that has the mic enabled and clears a list (the analogous iOS branch has the same pattern).

Useful? React with 👍 / 👎.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 31a0678. Configure here.

if (view === "github") return "prList"
if (view === "codex") return "codexList"
if (view === "notifications") return "notifications"
return "main"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary view maps wrong screen

Medium Severity

screenForView treats the summary view like the default branch and sets the glasses screen to main, so choosing Home/Summary from the phone UI or restoring saved selectedView: "summary" drives the native main menu instead of the summary text view.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 31a0678. Configure here.

@PhilippeFerreiraDeSousa

Copy link
Copy Markdown
Contributor Author

Oops, I pushed extra commits, I forgot this branch was a PR already. Though need to push a change for dismissing the dashboard on double tap only if a mini app listens to it

@PhilippeFerreiraDeSousa

Copy link
Copy Markdown
Contributor Author

Closing in favor of #3249, which keeps this PR scope to the G2 selectable-list support and dashboard double-tap fallback only.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant