Repository navigation
feat(firmware): add idle sleep and BLE device controls - #10604
undivisible wants to merge 20 commits into
Conversation
11505a9 to
9a9cfd0
Compare
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for pushing this forward. The battery/power-control direction is useful, and the PR already includes good validation notes plus mobile coverage for the new transport methods.
I do see one blocker before this should move out of draft / toward merge:
- The new BLE control characteristics use plain
BT_GATT_PERM_WRITE/BT_GATT_PERM_READ | BT_GATT_PERM_WRITEfor sleep, capture state, and persisted device name. With the current permissions, a nearby BLE client that can connect can issue a system-off command or persistently rename the device without an encrypted/authenticated link. For sleep in particular, that is a denial-of-service / UX risk because waking requires physical button access. Please require an appropriate protected link for these control writes (for example encrypted/authenticated GATT permissions consistent with the rest of Omi's pairing model, or another maintainer-approved authorization gate) before enabling these controls by default.
A couple of non-blocking notes for the maintainer pass:
- This also touches
.github/scripts/check-release-process-guards.py; the narrow guard update looks aligned with the isolated tag checkout described in the PR, and the new focused guard test passes locally. - Because this is a draft firmware behavior change depending on #10572, and physical system-off/wake / charger / LED behavior still needs hands-on validation, it should stay under human maintainer review before merge.
Local validation I ran:
python -m pytest .github/scripts/test_check_release_process_guards.py::test_desktop_qualification_runner_accepts_run_isolated_tag_checkout -qpassed.- The full release-guard pytest file has pre-existing parent-fixture failures in this shallow review checkout, so I did not treat that as a PR regression.
- Flutter/Dart tooling was not installed in this review environment, so I could not rerun the new app test locally.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
101dac2 to
7d99732
Compare
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the update. I re-reviewed the current head and the main blocker from the earlier review is still present:
- The new BLE sleep, capture-state, and persisted device-name characteristics are still registered with plain
BT_GATT_PERM_WRITE/BT_GATT_PERM_READ | BT_GATT_PERM_WRITE. Because these controls are enabled by default, a connected nearby BLE client could still issue system-off or persistently rename the device without a protected link or other maintainer-approved authorization gate. Sleep is especially sensitive because recovery requires physical button access.
Please require an appropriate protected/encrypted/authenticated link or another explicit authorization gate for these control writes before this moves toward merge.
Keeping this as a requested change on the current head. Separate from that blocker, this should remain under human maintainer/security review because it is still a draft firmware power/control behavior change, depends on #10572, touches workflow-adjacent release-guard coverage, and the physical system-off/wake, charger, and LED behavior still need hands-on validation.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the follow-up update. I re-reviewed the current head and the earlier blocking BLE-permissions issue looks addressed: the sleep, capture-state, and persisted device-name characteristics are now registered with encrypted read/write permissions where applicable.
I’m not approving this automatically because this is still a firmware power/control behavior change that depends on #10572, the PR notes that physical system-off/wake, idle-timeout duration, charger readings, and LED electrical output still need hands-on observation, and the Desktop Swift CI checks are currently failing. This should stay under human maintainer/security review before merge, but from the automation pass the prior BLE authorization blocker no longer appears to be blocking on this 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.
Resolved on head 91689c8: the BLE sleep/capture/name characteristics now require encrypted GATT access; preserving human-review requirements separately.
91689c8 to
a384e60
Compare
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for continuing to tighten this up. The earlier BLE control-permission blocker appears addressed on the current head: the sleep, capture-state, and device-name controls now use encrypted GATT permissions where applicable.
I found a new blocking issue before this can move forward:
omi/firmware/omi/src/lib/core/transport.cstill registersaudio_ccc_config_changed_handlerin the audio service CCC entries, but on this head the function is only declared and no longer defined. The base branch has the definition; this head has only the prototype/usages. WithCONFIG_OMI_ENABLE_CAPTURE_LED=yalso enabled,transport.cadditionally declares/callsupdate_advertising_name()from the device-name work handler, but that helper is not defined either. These missing definitions should fail the firmware build/link path for the enabled configuration, so please restore/implement them before merge.
Separate from that blocker, this should remain under human maintainer/security review because it changes firmware power/control behavior, depends on #10572, and the PR still notes hands-on validation gaps for physical system-off/wake, idle timeout, charger readings, and LED output.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
1955e5b to
e65713c
Compare
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for continuing to iterate on this.
I re-reviewed the current head. The prior automation blocker about missing audio_ccc_config_changed_handler / update_advertising_name() definitions appears resolved on this head: both helpers are now present in omi/firmware/omi/src/lib/core/transport.c, and the BLE sleep / capture-state / device-name controls are registered with encrypted permissions where applicable.
I’m not approving this automatically because this remains a firmware power/control change with security-sensitive BLE controls, it still depends on #10572 being merged first, and the PR’s validation notes still leave physical system-off/wake, idle-timeout duration, charger readings, and LED electrical output for hands-on maintainer validation. Please keep this under human maintainer/security review before merge.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
Current head restores the missing transport.c helper definitions; the prior automation build/link blocker no longer applies.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for continuing to iterate here.
I found one current-head blocker that should be fixed before this moves forward:
update_idle_sleep()treats the device as active only when it is charging, connected with audio notifications subscribed, or in a connected storage transfer. With offline storage enabled inomi.conf, a disconnected pendant that is actively capturing/writing to SD still hasis_connected == falseand will accumulate idle time. After the timeout, the main loop can callturnoff_all()and stop a long offline recording session unexpectedly. Please either gate auto-sleep on an explicit “not recording / no offline capture active” state, or keep the feature disabled until firmware can distinguish real idle from disconnected offline recording.
The earlier BLE permission and missing-helper blockers look addressed on this head, but this remains firmware power/control behavior with security-sensitive BLE controls, an open dependency on #10572, and hands-on validation gaps for physical system-off/wake, idle timeout, charger readings, and LED output, so it still needs human maintainer/security review before merge.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Done
You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit e54302b. Configure here.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the follow-up changes here.
The previous automation blocker around idle sleep interrupting disconnected offline recording looks resolved on this head: update_idle_sleep() now also holds the device awake when offline storage is enabled and the SD/mic path indicates active capture, in addition to connected storage transfer and subscribed audio.
I’m not approving because this is still firmware power/control behavior with encrypted BLE device controls, an open dependency on #10572, and remaining hands-on validation items for physical system-off/wake, idle timeout, charger readings, and LED output. Human maintainer/security review should still sign off before merge.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
Resolved on current head: idle auto-sleep now treats offline SD/mic capture as active, so the stale automation change request no longer applies.
3c72837 to
bb7c073
Compare
Shipping omi.conf enabled idle auto-sleep and two new LED patterns in the same change. Auto-sleep with no user-visible warning can end a session the user believes is still recording, and the capture/low-battery patterns change the LED language users already learned. Ship the BLE sleep and rename controls, leave the behaviour changes opt-in per build, and document the LED language next to set_led_state(). Failure-Class: none
main's desktop_qualify_beta.yml carries the full run-isolated checkout line again, and test_desktop_release_flow_contract asserts the guard pins that exact fragment, so the relaxed constant fails the contract. Restore main's guard text and keep the focused acceptance test. Failure-Class: none
6de5334 to
3eb5da8
Compare
Resolved on current head: encrypted GATT permissions restored for sensitive controls, and idle sleep is disabled/gated for offline-capture-capable builds.
|
Thanks for the latest update — I re-reviewed the current head and the automation blockers I raised on the previous head look addressed. Specific notes from this pass:
I’m not approving this automatically because this is still firmware power-off / BLE identity-control behavior, has workflow/check-manifest changes, carries a rebase/blocking state, and needs maintainer/product sign-off on the final shipped UX for sleep/LED behavior. Leaving this for human maintainer review for firmware power-control and workflow sign-off before merge. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Thanks for the firmware review. Both concerns are addressed on the current head: LED patterns — the capture and low-battery LED patterns are now opt-in Kconfig, disabled in Idle auto-sleep data loss — two guards:
Also merged |
The DIS/BAS/device-name/device-appearance assignments are already configured below (omi.conf lines 86-108); the commented duplicates above were stale documentation that contradicted the effective config.
|
Addressed the four review points (all already resolved or fixed on the current head):
I have not run this on hardware; the LED config changes are config-gated so the default firmware path is unchanged. |
|
Thanks for the latest round on this head — re-reviewed
Leaving the merge decision with a human maintainer as before: this is power/identity firmware behavior on an encrypted link, the stacked dependency #10572 is still open, the shipped UX for app-driven sleep and the opt-in LED language still needs product sign-off before idle sleep is enabled in a shipping config, and on-device QA (pairing on the three encrypted characteristics, rename visibility in advertisement/scan response, physical system-off/wake) hasn't been run. The two Desktop Swift checks are also still queued. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Re-reviewed the current head. Thanks @undivisible — this round cleanly addresses the earlier human review feedback:
Also verified on this head: the encrypted GATT permissions for sleep (19B10014), capture-state (19B10015), and device-name (19B10016) are in place; the What remains before merge, for a human maintainer:
Leaving for human maintainer review. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
Merge origin/main into codex/firmware-idle-auto-sleep. Single conflict in .github/checks-manifest.yaml (both sides added test entries at the same location); kept both the PR's firmware-idle-sleep-tests entry and main's new iOS test entries.
|
Reviving this PR after the community-call ask (a user asked for exactly this "disable/put to sleep" capability on the Sep 25 call). @undivisible — status: the changes requested on Aug 9 were addressed in your Aug 18 commits (distinct double-blink low-battery LED, storage-sync stays awake, config cleanup) and Git-on-my-level's Aug 19 review confirmed them on Updates today:
Remaining before merge: a fresh maintainer review of the current head (the Aug 9 CHANGES_REQUESTED predates the fixes), an NCS 2.9.0 compile, and hardware QA. Requesting re-review from @TuEmb and @Git-on-my-level. |
…ntrols
The mobile-changelog-entry hygiene gate (added to main after this PR opened) requires an app/changelog/unreleased fragment for any app/ change. The PR adds service-layer transports only and ships no user-facing UI, and the firmware features behind them are opt-in Kconfig disabled in omi.conf, so the fragment is {"kind": "none"}.
|
CI green on the current head
What remains before merge, unchanged in kind from earlier rounds:
|
|
Since my last review: addressed — idle-sleep policy moved into a Zephyr-free Verdict: solid and safely gated on this head — what remains is a maintainer decision, not contributor rework.
Security: no plaintext control surface — sleep and rename both require pairing/encryption, and capture-state clears on disconnect so it cannot stay latched. Blast radius: a slept pendant needs a physical button press (BLE cannot wake it), which is exactly the product behavior a maintainer should sign off on. Two notes before this leaves draft:
USER IMPACT: none at merge — every new behavior ships behind Kconfig flags that are off in the shipping build; once enabled, users get app-driven sleep/rename and, later, auto-sleep after idle. What I'd still want: a firmware by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Since my last review: addressed (low-battery warning is now an explicit double-blink phase machine in main.c with a bogus-0%-read guard and a reset when battery recovers; the contradictory CONFIG_BT_BAS/DIS=n lines were removed from omi.conf — the =y lines later in the file were already winning, so no behavior change; the idle policy is now host-testable and wired into the checks manifest; a Dart unit test covers the new sleep/rename writes; branch re-merged on current main) · still open (nothing from my prior review — the encrypted-permission, helper-definition, and offline-capture blockers all remain fixed on this head; the #10572 dependency is moot since that PR was closed unmerged and this branch carries its own storage/idle handling) · newly introduced (a firmware-idle-sleep-tests entry in .github/checks-manifest.yaml — I ran bash omi/firmware/omi/tests/run_idle_sleep_test.sh locally and it passes). The production changes here are correct and nicely scoped; nothing blocking from automation, but this one stays with the human maintainers (firmware power/identity surface, draft PR). What I verified on this head:
Security: WRITE_ENCRYPT requires an encrypted link but not an authenticated (MITM-protected) one — Just Works pairing leaves a narrow proximity-based rename/power-off surface. I think that's acceptable for this threat model, but it's exactly what the security-review label should sign off on. Performance: the idle poll calls transport_is_audio_subscribed() once a second (one conn ref + CCC query) — negligible. USER IMPACT: none yet — this adds encrypted firmware controls and opt-in flags with no shipped app UI, so users see no behavior change until the app wires up sleep/rename actions. What I'd still want as a reviewer: on-hardware validation of the button system-off wake path and idle-sleep current draw (the PR notes this is untested), maintainer sign-off on the encrypted-write model before merge, and a product decision on when idle auto-sleep and the LED patterns get enabled in a release. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |

Summary
omi.confcurrent_connectionbehindget_current_connection()across all call sitesReview round: changes requested
BT_GATT_PERM_*_ENCRYPT; an unpaired central can no longer power off or rename the pendant.charging || audio_subscribedalone. The policy moved toomi/firmware/omi/src/lib/core/idle_sleep.h: a storage sync transfer is activity, and any build that can capture offline never auto-sleeps, because the firmware cannot distinguish an idle pendant from one recording to SD.OMI_ENABLE_IDLE_SLEEPnowdepends on !OMI_ENABLE_OFFLINE_STORAGE.omi.conf, so the shipping build's LED language and power behavior are unchanged; the LED language is documented next toset_led_state().Status update — 2026-09-26 (revive)
What this does, in plain terms: three opt-in firmware features — auto-sleep when the pendant is idle, a BLE "sleep now" command, and renaming the pendant from the app — plus two optional LED indicators (capture state, low battery). Everything ships disabled:
omi.confkeeps the current behavior byte-for-byte until maintainers flip a Kconfig flag in a release. For users this means multi-day battery life becomes possible and lost/renamed pendants become manageable, with zero behavior change until product opts in.OMI_ENABLE_OFFLINE_STORAGEexists in main's Kconfig,OMI_ENABLE_IDLE_SLEEP depends on !OMI_ENABLE_OFFLINE_STORAGEholds against it, and the idle-sleep host tests pass on the merged tree.maininto the branch (merge commitb68d860a84). Upstream drift ontransport.c,main.c,settings.cand the app connector since this branch diverged: zero files, so the review rounds of Aug 4–19 remain valid for the code as-is. Single textual conflict was.github/checks-manifest.yaml(both sides added test entries at the same spot; both kept).bash omi/firmware/omi/tests/run_idle_sleep_test.sh→ passed;clang-format --dry-run -Werrorclean on all touched C files; checks-manifest parses with no duplicate ids.11aa7b5687), NCS 2.9.0 compile, and hands-on hardware QA. CI runs the app tests and the firmware host tests on this push.Validation
bash omi/firmware/omi/tests/run_idle_sleep_test.sh->idle-sleep policy tests passed; mutation-verified (dropping the offline-capture guard fails 2 assertions).firmware-idle-sleep-testsin.github/checks-manifest.yaml(local + ci lanes).make preflightrun locally on this head.Not verified on this head: no NCS toolchain or CV1 hardware was available for this review round, so the firmware was not compiled or flashed here. Physical system-off/wake, encrypted-link pairing behavior for the new characteristics, charger readings, and LED electrical output need hands-on maintainer QA.
Failure-Class: none