omi icon indicating copy to clipboard operation
omi copied to clipboard

iOS/app: legacy SD-card sync runs on ring-buffer firmware, lists a phantom recording from the ring status, and retries it forever

Open jshph opened this issue 3 weeks ago • 2 comments

Summary

On CV1 ring-buffer firmware (3.0.20+), the app still runs SDCardWalSync (Phase 1a) after the ring sync. It parses the ring status characteristic 30295782-4301-EABD-2904-2849ADFEAE43 ([used_bytes, unread_packets, free_bytes, rtc_valid], firmware lib/core/storage.c storage_read_characteristic) as the legacy listing [total, offset, start_ts]. Whenever more than ~10 s of audio is unread at connect, this produces a phantom "legacy SD" recording that can never be downloaded:

  • size = used − unread; "start timestamp" = free_bytes (decodes to 1980s dates)
  • the download sends legacy opcode 0x00 to 30295781-…; 3.0.21 only accepts 0x03, 0x10–0x13 and answers [0x01, 6] (ACK, invalid command)
  • the app treats that 2-byte reply as first data, matches no frame format, and times out ("SD card read stalled", 0 chunks)
  • the entry stays missing and is rebuilt and retried on every connect and sync; there is no attempt cap

Evidence (CV1, firmware 3.0.21, iOS app 1.0.585/1.0.586, iPhone 16 Pro, iOS 26.6.2)

App debug log: implausible_timestamp_marker_ignored {"epoch": 494582700, "source": "listing"}, then sdcard_ble_download_started {"totalBytes": 511665, "codec": "opus_fs320"} and four SD card BLE download failed: TimeoutException: SD card read stalled {"chunksDownloaded": 0}, right after a successful RingStorageSync of 1,155 records. 511,665 = 1,155 × 444 − 1,155, and 494,582,700 = 1,113,925 × 444 (free bytes). Clearing the ring (0x13) made the entry disappear.

Code pointers (main @ 7d163b938)

  • Phase 1a runs regardless of firmware: app/lib/services/wals/wal_syncs.dart:328-337
  • listing parse: app/lib/services/wals/sdcard_wal_sync.dart:185-223 (via omi_connection.dart:471-498); cached at connect :989-992, reused :262-264
  • legacy read request: omi_connection.dart:938-953, sdcard_wal_sync.dart:678
  • 2-byte ACK arms the stall timer and is treated as a gap: sdcard_wal_sync.dart:521-532, 610
  • never gives up: sdcard_wal_sync.dart:883-895

Suggested fix

Skip SDCardWalSync listing and sync when isRingBufferFirmware(fw), and treat a non-zero storage ACK ([0x01, status != 0]) as a terminal error instead of a stall.

Possibly related

#20607 (CV1 offload "upload/handshake loops"): this phantom entry would produce exactly that loop whenever more than ~10 s of audio is unread at connect.

jshph avatar Nov 05 '26 03:11 jshph

Same here, with matching log evidence.

Setup: iOS app 1.0.585, CV1 firmware 3.0.21, iPhone [model], iOS [version]. Custom live STT enabled.

Phantom listing with a 1985 timestamp, logged on every reconnect (Nov 4):

  • 18:56:29Z implausible_timestamp_marker_ignored epoch 490400664 (source: listing)
  • 19:05:30Z implausible_timestamp_marker_ignored epoch 490396668
  • 22:13:51Z implausible_timestamp_marker_ignored epoch 490311420

Legacy SD download stalls with 0 chunks and takes the whole sync down with it:

  • 22:19:31Z sync_started totalMissingWals 1336 (sdcard 2, phone 1334)
  • 22:20:34Z ring sync completes (sync_advance advance_ok true), then Sync Phase 1a: Downloading SD card data to phone
  • 22:20:34Z sdcard_ble_download_started walId …_1793830091, totalBytes 2724893, codec opus_fs320
  • 22:24:53Z SD card BLE download failed: TimeoutException: SD card read stalled chunksDownloaded 0
  • 22:24:53Z coordinated recording transfer hit transient network error; re-arming recovery

Earlier that day, Offline Sync showed "Downloading from your Omi · 0s of 42s" (330.1 KB) indefinitely, which looks like the same phantom entry.

Impact: The stall blocks the rest of the sync. Audio held only on my phone grew from 9 s to about 3.5 h over the afternoon (wal_stale_missing pending_audio_seconds 12707). +1 to skipping SDCardWalSync on ring-buffer firmware and treating the invalid-command ACK as terminal. Happy to share the full debug log privately.

Fri3ndLyLi0n avatar Nov 05 '26 22:11 Fri3ndLyLi0n

Additional replacement-pendant source with quoted zero-chunk legacy-read diagnostics

Veckie’s November 7 diagnostic thread includes the original debug log and two screenshots. Initial remote retrieval failed; Aryan has since supplied local copies, and they have now been inspected. The log is 203,770 bytes with 575 valid JSON entries, November 7 06:20:19.310–06:56:37.676 UTC.

Verified sequence:

  • 06:20:51: button listener subscribed. No recorded button events or voice-question events during this log; actual physical press timing is not established.
  • 06:21:02–06:21:28: ring sync on firmware 3.0.21; 3,489 records advanced with advance_ok: true.
  • 06:21:28, 06:24:06 and 06:49:44: legacy SD read starts for the same 1,545,627-byte entry. Failures at 06:23:23.828 and 06:49:22.035 report zero chunks. The third read has no completion before the log ends. An implausible listing timestamp is recorded at 06:20:51.738. The size equals 3,489 × (444 − 1), matching the size relationship described in #24663; that arithmetic is a supporting inference, not an independent status-packet capture.
  • One nonterminal HTTP503 at 06:21:01; later passes report seven uploaded batches and then one. Ten reconcile polls still report processing with zero processed segments. There are also 163 reconcile_completed_empty records with nonzero processed-segment counts; those diagnostics alone do not prove lost conversations or readable final results.

Screenshots confirm firmware3.0.21, connected, 3m13s/1.5MB pending on the pendant, 34m on phone, 10m transcribing, 1,354 audio files and server meter26/56. Both storage options are On. A UI storage meter of0% does not establish recoverability or absence of the pending audio. These are distinct transfer/upload/processing stages; the raw evidence confirms the legacy-read stall pattern without proving one shared cause for every symptom.

The same customer’s button thread says the replacement still does not register tap → speak → tap, and 1.0.588 (1549), iPhone/iOS 27.0.1 has not fixed that button issue as of November 9. That latest message does not establish that the legacy-sync failure was reproduced on build 1549. The suggested link between a busy sync loop and button loss remains unconfirmed. Button evidence is also recorded on #24709.

Relevant implementation already exists on current main b941eda866f464fcb2a94d045adec4149a9df5a8: merged #24678 (e2924da5a762dc446853e5f5914af660aaafa929, November 5) gates attachment/listing/sync to confirmed legacy firmware and preserves rejected reads. Current phase gate. #24820 was closed without merge on November 9; do not use that closure as release evidence. Main-state safeguards do not verify the source log’s installed build, exact released artifact or the replacement’s recovery.

Reuse the original diagnostic attachment and verify which installed artifact contains #24678. Trace device-info resolution and storage routing alongside button subscription/admission, keeping both symptom outcomes separate. Preserve original audio and queue state; no clear-ring opcode, storage deletion or reinstall is requested. The current replacement/button Discord thread is the single active customer conversation; this older thread remains the diagnostic source.

aryanorastar avatar Nov 09 '26 10:11 aryanorastar