Skip to content

fix(firmware): make CV1 capture durable and 3.2× faster on iPhone - #10572

Closed
axAilotl wants to merge 6 commits into
BasedHardware:mainfrom
axAilotl:codex/cv1-firmware-reliability
Closed

axAilotl wants to merge 6 commits into
BasedHardware:mainfrom
axAilotl:codex/cv1-firmware-reliability

Conversation

@axAilotl

@axAilotl axAilotl commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • preserve every accepted Opus frame across transient BLE, SD queue, remount, and disconnect failures
  • make the SD ring authoritative before live GATT enqueue, retaining a recoverable copy until an explicit durable app ADVANCE
  • keep the live and storage paths on the same stable record identity so replay is duplicate-safe
  • reject unsafe live-only delivery when durable storage is unavailable
  • add CRC-covered ring completion, bounded bulk-transfer link policy, right-sized dual-core ACL buffers, and a one-shot 15 ms interval request during contiguous backlog drains
  • bind the CV1 DIS and MCUboot app-core versions and reject dual-core OTA version drift in the release gate

Root cause

The live path treated a successful bt_gatt_notify_cb enqueue as ownership transfer. The controller can accept a frame and then lose the RF link or app before durable receipt, so transport.c skipped storage and permanently dropped the only recoverable copy.

The corrected ownership rule is: the pendant SD/ring owns the record until the app explicitly advances the durable watermark. GATT completion is flow control, not durable acknowledgment.

Physical findings

Tested on a physical CV1 and iPhone 13 Pro Max running iOS 26.5.2:

  • stock durable backlog baseline: 10,166,673 bytes in 622 s = 15.96 KiB/s
  • candidate steady window: 18,162,224 bytes in 348 s = 50.97 KiB/s (3.19x)
  • audited 56 consecutive durable ranges beginning at sequence 125,361 with zero gaps, overlaps, or duplicate source IDs; subsequent metadata confirmed 224,361 → 226,161
  • Bluetooth off/on, app termination/relaunch, and a complete MCUboot OTA all resumed at the exact unfinished or next durable sequence
  • the first range after OTA was exactly 202,761 → 204,561; the app reclaimed the pendant without re-pairing or a hot restart

SCA-144 regression

Head 9c052f5ffa22f9ef9c9bcdd55fdf7064837da0c2 adds host regressions proving:

  • a live enqueue accepted immediately before disconnect remains recoverable from storage
  • a later durable ACK reclaims the record idempotently without duplicate ownership
  • storage unavailability cannot silently degrade an accepted live enqueue into live-only loss

Companion PRs

Validation

  • Apple Clang host build with -Wall -Wextra -Werror: passed
  • audio_storage_packer_tests: passed
  • omi/firmware/scripts/ci/test-check-cv1-version-sync.sh: passed
  • repository pre-push: CV1 version sync, 58 dev-harness tests, final-PR-diff selection, CI prediction, Firestore contention/supervisor, hygiene, architecture, and contract checks passed before explicit PR-body injection retry
  • cmake / ctest: unavailable on this host

Residual risk

  • This host could not rerun the NCS sysbuild or physical-device suite for the final ownership-only commit. Existing physical CV1 evidence covers the preceding branch state; CI and hardware qualification should remain required before release.
  • The companion app durable-ACK contract must land before this firmware is released.

No merge, release, tag, or firmware publication is performed by this update.

Failure-Class: none

@Git-on-my-level

Copy link
Copy Markdown
Member

Maintainer review signal (not a formal approval because this is still draft and it touches firmware release workflow + broad CV1 storage/transport behavior):

This is a coherent fix around CV1 durable capture/backlog sync, and the direction looks promising: moving storage advancement to an explicit app ADVANCE, retaining SD/control responses across transient enqueue failures, adding CRC-covered DONE metadata, and binding DIS + MCUboot versions are all the right kinds of guardrails for the incident described in the PR.

Before this is merge-ready, I’d want human firmware/release review on a few areas:

  • Release/workflow risk: .github/workflows/firmware_release.yml and the new CV1 version-sync scripts now gate published firmware identity across both DIS and MCUboot. The shell/YAML parses cleanly, but this should be reviewed by someone comfortable owning the CV1 release process because a mistake here affects production OTA behavior.
  • Firmware/runtime risk: the SD ring, BLE bulk transfer, shutdown drain, and AAD sleep/wake paths are materially changed. The included host-native contracts and physical CV1/iPhone validation are useful, but I’d still want maintainer validation on device for shutdown while SD remount/write is delayed, mid-transfer disconnect/reconnect, and the companion app ADVANCE contract before releasing firmware built from this.
  • Agent-instruction impact: omi/firmware/AGENTS.md now instructs AI/coding agents to bump both CONFIG_BT_DIS_FW_REV_STR and CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION, and points agents at the new durability tests. That guidance looks safe and aligned with the new release gate, but because it changes future agent behavior in the firmware tree, a maintainer should verify the wording/path expectations before relying on it.

No security/supply-chain attempt found in the diff. I’m leaving this as a positive signal + maintainer-review request rather than approval while it remains draft and because the release/agent-instruction surfaces need human ownership.


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 workflow-review Needs maintainer review for workflow, automation, hooks, or CI behavior labels Jul 25, 2026
@axAilotl
axAilotl force-pushed the codex/cv1-firmware-reliability branch from 5ac05c5 to 0af64e6 Compare July 25, 2026 21:57
Alex Vega added 5 commits July 25, 2026 17:58
Treat GATT TX completion as flow control only. Remove firmware-side auto-advance checkpoints and durably advance the SD watermark only in response to the app's explicit ADVANCE command.

Failure-Class: none
Stop re-requesting aggressive connection parameters when a phone selects a slower interval; keep the negotiated callback observational.

Failure-Class: none
Reject DIS/MCUboot version drift before building, preserve reviewed nonzero build numbers for normal releases, and atomically synchronize explicit overrides. Bump the physically verified candidate to 3.0.28.

Failure-Class: none

Verified: NCS 2.9.0 Docker dual-core build; physical CV1 dual-core OTA; MTU 498 / PHY 2M; 3,996,000 bytes at 98.7 KiB/s with matching CRC; version suite; make preflight (46 checks).
Use right-sized dual-core ACL buffers, increase controller TX depth, and request a bounded 15 ms connection interval only while a contiguous ring drain is active. Restore the normal interval after the drain and keep rejection non-fatal.

Physical iPhone validation sustained 50.97 KiB/s versus 15.96 KiB/s stock across 18,162,224 bytes (3.19x), with zero gaps or overlaps through reconnect, app restart, and OTA reflash.

Failure-Class: none
@axAilotl
axAilotl force-pushed the codex/cv1-firmware-reliability branch from 0af64e6 to 4fb849e Compare July 25, 2026 21:59
undivisible added a commit to undivisible/omi-v4 that referenced this pull request Jul 26, 2026
undivisible pushed a commit to undivisible/omi-v4 that referenced this pull request Jul 26, 2026
Correct the attribution for work imported from BasedHardware/omi#10572. Supersedes the local-only address in 1842244.
undivisible pushed a commit to undivisible/omi-v4 that referenced this pull request Jul 26, 2026
Corrects the author identity for the upstream durability work from BasedHardware/omi#10572.
Make the SD ring authoritative before live GATT delivery and classify repeated durable app ACKs as idempotent reclaim operations.

Failure-Class: FC-split-mutation-authority
Co-authored-by: multica-agent <[email protected]>
@undivisible undivisible added human Human-authored pull request firmware firmware work docs-tooling Layer: Documentation, examples, dev tools privacy-review Touches user-data persistence, permissions, or privacy-sensitive surfaces labels Aug 10, 2026
@Git-on-my-level Git-on-my-level removed the docs-tooling Layer: Documentation, examples, dev tools label Aug 11, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks for the very thorough CV1 durability work here. I reviewed the firmware/storage path statically and ran the new lightweight host checks that are possible in this review environment.

What looks good:

  • omi/firmware/omi/src/lib/core/transport.c changes the ownership model so write_current_frame_to_storage() succeeds before live GATT duplication, and broadcast_audio_packets() now backpressures instead of bypassing older queued frames. That matches the stated “SD owns until explicit app advance” contract.
  • omi/firmware/omi/src/lib/core/storage.c removes the old TX-completion checkpoint advancement and makes CMD_RING_ADVANCE the durable reclaim boundary; the new CRC-covered DONE notification also gives the app a stronger transfer-integrity check.
  • omi/firmware/omi/src/sd_card.c keeps accepted writes ordered via retained retry, drains pending writes before info/read snapshots, and makes advance persistence synchronous with media sync. That is the right place for this durability boundary.
  • omi/firmware/omi/src/mic.c and omi/firmware/omi/src/lib/core/codec.c now provide explicit shutdown/pause/drain gates so the final captured block and partial codec frame are not thrown away before storage commit.
  • .github/workflows/firmware_release.yml, .github/checks-manifest.yaml, and omi/firmware/scripts/ci/*cv1-version*.sh move the CV1 DIS/MCUboot version pairing into a checked release boundary instead of relying on operator memory.

Agent-instruction impact: this PR also changes omi/firmware/AGENTS.md. The new guidance tells coding/review agents working in firmware to keep CONFIG_BT_DIS_FW_REV_STR and CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION in sync and points them at the new host-native durability tests. That is a safe and useful behavior change, but because it changes repo agent instructions and release workflow guidance it should stay visible for human maintainer sign-off.

Validation I ran:

  • bash omi/firmware/scripts/ci/test-check-cv1-version-sync.sh — passed.
  • Direct host compile/run of omi/firmware/omi/tests/audio_storage_packer/test_audio_storage_packer.c with the production helper sources — passed (audio_storage_packer_tests: PASS). The local review container does not have CMake/NCS sysbuild installed, so I did not run the full firmware Docker/NCS build here.

I am not requesting changes from this pass. Because this is still draft, touches firmware durability plus release workflow/agent-instruction surfaces, and changes user-data persistence behavior, I’m leaving final merge readiness to a human maintainer after the full CV1 firmware build/physical validation evidence is accepted.

— Automated maintainer review by glm-5.2


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

@axAilotl

Copy link
Copy Markdown
Contributor Author

Closing this experimental CV1/storage-first branch. The only firmware reliability change being carried forward is #11578; this PR is not part of that release candidate.

@axAilotl axAilotl closed this Aug 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hey @axAilotl 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

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

Labels

firmware firmware work human Human-authored pull request needs-maintainer-review Needs a human maintainer to sign off before merge privacy-review Touches user-data persistence, permissions, or privacy-sensitive surfaces workflow-review Needs maintainer review for workflow, automation, hooks, or CI behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants