Repository navigation
Conversation
…asedHardware#13100) CV1 firmware previously advanced and persisted the SD ring read pointer (`read_seq`) from the `bt_gatt_notify_cb` transmission completion callback every 2 seconds and upon BLE disconnection (introduced in BasedHardware#9954). That callback only indicates radio transmission of the ATT packet and link-layer ACK; it does not guarantee that the mobile OS delivered the packet to the client app or that the app durably flushed Opus frames to disk. When a transfer disconnected mid-sync, the firmware advanced `read_seq` 20–22 records (~10 KB) ahead of the client's locally saved prefix. On reconnect, `CMD_RING_INFO` reported the advanced cursor, permanently discarding the uncommitted audio packets from the SD ring. This patch decouples radio flow control from storage durability: - In `storage.c`, removed `sync_checkpoint_advance()`, `sync_confirmed_bytes`, and periodic auto-advance timers. - `storage_data_tx_done` now strictly performs flow control via `transport_bulk_tx_release()`. - On link drop (`conn == NULL`) and `NOTIFY_DONE`, the transfer stops without modifying `read_seq`. - `sd_ring_advance()` is restored strictly to client `CMD_RING_ADVANCE` (0x12). - Removed unused `sd_ring_advance_async` in `sd_card.h` and `sd_card.c`. Verified: - Reproduces 22-record (9,768-byte) permanent loss gap on unpatched baseline. - Preserves `read_seq` at initial uncommitted sequence across link drops and NOTIFY_DONE in patched test harness. - Durably advances cursor strictly upon client `CMD_RING_ADVANCE`. - Passed `clang-format --dry-run --Werror` on touched firmware files. - Passed `PRE_PUSH_BASE_REMOTE=upstream ./scripts/pre-push`. Failure-Class: FC-split-mutation-authority PayPal: [email protected]
|
Thanks @TheRWX — verified this against main and issue #13100; the diagnosis and fix direction check out. What I verified:
Client compatibility: on current main, One gap against the repo's Definition of Done: this is a behavior change with no regression test landed in-repo — the reproduction harness described in the PR body was standalone and isn't included. The firmware tree currently has no wired test lane for this path, so at minimum please attach the harness (or a link to it) so the interrupted-transfer scenario is reproducible by maintainers. Firmware data-durability behavior on the primary capture loop needs maintainer sign-off before a firmware release — 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 |
|
Reviewed the full diff against main (head 2575ce8). Treating GATT TX completion as flow control only, with ring advancement left exclusively to the client's CMD_RING_ADVANCE, matches the storage-authoritative direction and closes the data-loss window described in #13100. Main still contains the checkpoint code, so this is not superseded. Per-file notes:
Two things worth a maintainer's eye before this leaves draft:
Static review only - the firmware CI jobs are path-filtered/skipped on this PR, so the standalone harness verification described in the PR body is the main functional evidence; the needs-tests label stays appropriate. When you consider it ready, mark it Ready for review. Firmware data-loss semantics and the client-protocol compatibility question above need a firmware maintainer's sign-off before merge. Automated maintainer review on behalf of the Omi maintainers; feedback is AI-generated. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
Summary
Fixes #13100.
CV1 firmware previously advanced and persisted the SD ring read pointer (
read_seq) from thebt_gatt_notify_cbtransmission completion callback every 2 seconds and upon BLE disconnection (introduced in #9954). That callback only indicates radio transmission of the ATT packet and link-layer ACK; it does not guarantee that the mobile OS delivered the packet to the client app or that the app durably flushed Opus frames to disk.When a transfer disconnected mid-sync, the firmware advanced
read_seq20–22 records (~10 KB) ahead of the client's locally saved prefix. On reconnect,CMD_RING_INFOreported the advanced cursor, permanently discarding uncommitted audio packets from the SD ring.This PR decouples radio flow control from storage durability:
storage.c, removedsync_checkpoint_advance(),sync_confirmed_bytes, and periodic auto-advance timers.storage_data_tx_donenow strictly performs flow control viatransport_bulk_tx_release().conn == NULL) andNOTIFY_DONE, the transfer stops without modifyingread_seq.sd_ring_advance()is restored strictly to clientCMD_RING_ADVANCE(0x12).sd_ring_advance_asyncinsd_card.handsd_card.c.Verification
read_seqfrom 100 to 122 on disconnect and onNOTIFY_DONE, reproducing the exact 22-record (9,768-byte) permanent audio loss gap.read_seqremains firmly locked at 100 across disconnects and completion, advancing strictly upon clientCMD_RING_ADVANCE(122).clang-format --dry-run --Werrorpassed across all touched firmware files.scripts/test-pre-push-firmware-format-prerequisite.shpassed.PRE_PUSH_BASE_REMOTE=upstream ./scripts/pre-pushpassed all 12 manifest checks and policy guards.Failure-Class: FC-split-mutation-authority
PayPal: [email protected]