Repository navigation
Description
Update (March 22, 2026): The "failed offline sync" originally described as Bug 2 in this issue has a different root cause — the failing flash pages contain firmware diagnostic logs, not audio. That fix is tracked separately on #5733 (S2). This issue now covers only the duplicate conversation problem and the missing drift correction.
Describe the bug
The Limitless pendant integration creates duplicate conversations because real-time streaming and batch flash page download process the same audio independently. The backend's merge logic (process_segment() → get_closest_conversation_to_timestamps() in backend/routers/sync.py L638) correctly merges when timestamps align, but even small clock drift causes the timestamps to not overlap, so the backend creates duplicates instead.
The clock is synced on every connect (limitless_connection.dart L76), but only going forward — flash pages already stored on the pendant retain their drifted timestamps with no retroactive correction.
To Reproduce
- Unpair and re-pair the Limitless pendant to the Omi app
- Have any conversation (even brief, e.g., talking to a pet)
- Wait for the app to trigger batch download of stored flash pages
- See the same conversation appear twice in the conversation list
Current behavior
- After fresh pairing, conversations are duplicated within ~1 hour — one from real-time streaming, one from batch flash page processing
- The
_initialize()method (limitless_connection.dartL73–91) writes the phone's current time to the pendant but never reads the pendant's current RTC time first, so the drift magnitude is never measured - Flash page timestamps are used as-is in
flash_page_wal_sync.dartL294 with no drift offset applied - The session gap detector at L324 (
sessionGapThresholdMs = 120000) fragments recordings based on drifted timestamps - Audio filenames at L511 embed the drifted timestamp, which the backend extracts to locate conversations
- The pendant sends its internal clock in Type-8 BLE notifications (field 6, epoch ms) on every connection, but
_handleNotification()never parses them — this is a free drift measurement the app ignores
Expected behavior
- On reconnect, the app should measure the drift between the pendant's RTC and phone time before syncing the clock forward
- The measured drift offset should be applied retroactively to all flash page timestamps during batch download
- The backend's existing merge logic should then correctly match batch audio to real-time conversations, producing a single merged conversation instead of duplicates
- This is how the Omi device avoids the problem —
omi_connection.dartL29–33 syncs time on every connect, and the SD card sync uses firmware-embedded timestamp markers anchored to the synced clock
Screenshots
Smartphone + device:
- Device: Limitless Pendant v1.0, firmware 1.1.20
- OS: iOS 26.3.1
- App Version: Omi AI 1.0.526 (778)
Proposed fix (client-side only — backend merge logic already works)
Part 1: Read pendant clock via Type-8 notifications (limitless_connection.dart)
The pendant already sends Type-8 BLE notifications containing its internal clock in field 6 as epoch milliseconds. These arrive on every connection but _handleNotification() doesn't parse them. Add a Type-8 parser to extract the pendant's clock, then compute drift before calling SetCurrentTime:
// Parse Type-8 notification:
// f1: 8 (message type)
// f4: [payload] → f8: [inner] → f6: EPOCH_MS (pendant clock)
//
// Compute drift:
_clockDriftOffsetMs = pendantEpochMs - DateTime.now().millisecondsSinceEpoch;
Part 2: Apply drift correction to flash page timestamps (flash_page_wal_sync.dart)
Before using timestampMs at L294 and in filename generation at L511:
final rawTimestampMs = pageData['timestamp_ms'] as int? ?? DateTime.now().millisecondsSinceEpoch;
final driftOffsetMs = limitlessConnection.clockDriftOffsetMs ?? 0;
final timestampMs = rawTimestampMs - driftOffsetMs;
This corrects timestamps before session boundary detection and before they're embedded in filenames. Once filenames carry corrected timestamps, the backend's existing get_closest_conversation_to_timestamps() merges correctly instead of duplicating.
Part 3 (optional): Sync mode toggle
Add a user-facing toggle under Developer Settings → Experimental:
- Real-time + batch merge (default): Real-time streams live, batch replaces/merges for higher-quality transcript
- Real-time only: Disables batch download — no duplicates, no audio backup
- Batch only: Disables real-time streaming — only processes stored flash pages
Workaround
An iOS Shortcuts automation that opens the Omi app daily at 4:00 AM (Open App → Wait 20s → Go to Home Screen) forces a daily reconnect and clock resync, limiting drift accumulation. This reduces duplicates but does not eliminate them.
Code references (main branch)
| File | Lines | What |
|---|---|---|
app/lib/services/devices/limitless_connection.dart |
L73–91 | _initialize() — syncs clock forward, never measures drift |
app/lib/services/devices/limitless_connection.dart |
L145–161 | _handleRealTimePayload() — real-time audio path |
app/lib/services/devices/limitless_connection.dart |
L206–315 | _handleStorageBuffer() — batch audio path |
app/lib/services/devices/limitless_connection.dart |
L728–732 | _encodeSetCurrentTime() — BLE message type 6, write only |
app/lib/services/devices/omi_connection.dart |
L29–33 | Omi device connect() with performSyncTime() (reference) |
app/lib/services/wals/flash_page_wal_sync.dart |
L294 | Flash page timestamp used without drift correction |
app/lib/services/wals/flash_page_wal_sync.dart |
L324–331 | Session gap detection on raw drifted timestamps |
app/lib/services/wals/flash_page_wal_sync.dart |
L511 | Audio filename embeds drifted timestamp |
backend/routers/sync.py |
L621–693 | process_segment() — merge logic (works when timestamps align) |
backend/routers/sync.py |
L636–638 | get_closest_conversation_to_timestamps() — existing dedup |
Related issues
- Audio capture data loss: offline sync failures, silent drops, and recording loss #5733 (S2) — Limitless batch sync failure (root cause: firmware diagnostic pages, separate fix)
- Limitless pendant: large offline recordings fail to create conversations after sync #5154 — Original Limitless offline sync failure report


Activity
brightshore-ventures commentedon Mar 17, 2026
Adding debug logs from a Limitless Pendant sync failure on 2026-03-12. The pendant had been disconnected over the weekend and this was the first reconnection attempt.
Summary of what the log shows:
flash_page_download_completedwithfilesSaved: 0on all five attemptsLimitless initialization failederror mid-sessionpcm8before reverting toopus_fs320This is consistent with clock/timestamp drift causing the flash page layout to become unreadable by the Opus frame parser — the data is there but misaligned.
Full debug log (redacted, truncated — 4,119 identical warnings collapsed)
{"timestamp":"2026-03-12T22:07:52.441Z","level":"EVENT","type":"pure_socket_disconnecting","url":"wss://api.omiapi.com/v4/listen?language=en&sample_rate=16000&codec=opus_fs320&uid=[REDACTED_UID]&include_speech_profile=true&stt_service=soniox&conversation_timeout=120&source=limitless&speaker_auto_assign=enabled","current_status":"PureSocketStatus.connected"} {"timestamp":"2026-03-12T22:07:52.441Z","level":"EVENT","type":"pure_socket_closed","close_code":-1,"close_reason":"unknown","url":"wss://api.omiapi.com/v4/listen?language=en&sample_rate=16000&codec=opus_fs320&uid=[REDACTED_UID]&include_speech_profile=true&stt_service=soniox&conversation_timeout=120&source=limitless&speaker_auto_assign=enabled"} {"timestamp":"2026-03-12T22:07:52.450Z","level":"EVENT","type":"transcription_socket_closed","close_code":-1} {"timestamp":"2026-03-12T22:07:52.803Z","level":"EVENT","type":"pure_socket_connected","url":"wss://api.omiapi.com/v4/listen?language=multi&sample_rate=16000&codec=opus_fs320&uid=[REDACTED_UID]&include_speech_profile=true&stt_service=soniox&conversation_timeout=120&source=limitless&custom_stt=enabled&speaker_auto_assign=enabled"} {"ts":"2026-03-12T22:08:14.852Z","level":"WARN","message":"SyncProvider: user cancelled sync"} {"timestamp":"2026-03-12T22:08:24.365Z","level":"EVENT","type":"device_connection_state","device_id":"[REDACTED_DEVICE_ID]","state":"disconnected"} {"timestamp":"2026-03-12T22:08:27.420Z","level":"EVENT","type":"device_connection_state","device_id":"[REDACTED_DEVICE_ID]","state":"connected"} {"ts":"2026-03-12T22:08:32.011Z","level":"INFO","message":"Limitless device initialized successfully"} {"timestamp":"2026-03-12T22:08:32.045Z","level":"EVENT","type":"pure_socket_closed","close_code":-1,"close_reason":"unknown","url":"wss://api.omiapi.com/v4/listen?language=multi&sample_rate=16000&codec=opus_fs320&uid=[REDACTED_UID]&include_speech_profile=true&stt_service=soniox&conversation_timeout=120&source=limitless&custom_stt=enabled&speaker_auto_assign=enabled"} {"timestamp":"2026-03-12T22:08:32.045Z","level":"EVENT","type":"transcription_socket_closed","close_code":-1} {"timestamp":"2026-03-12T22:08:32.363Z","level":"EVENT","type":"transcription_socket_connected","sample_rate":16000,"codec":"opus_fs320","language":"multi","include_speech_profile":false} {"timestamp":"2026-03-12T22:08:32.404Z","level":"EVENT","type":"limitless_storage_status","oldestPage":966807,"newestPage":979235,"currentSession":51981,"freePages":82804,"totalPages":95232} {"ts":"2026-03-12T22:08:45.829Z","level":"INFO","message":"Limitless batch mode enabled"} # --- 4,119 identical warnings omitted (session 51096, flash pages 966807–967649). 3 samples: --- {"ts":"2026-03-12T22:08:45.927Z","level":"WARN","message":"Limitless flash page yielded zero Opus frames","extra":{"index":966807,"session":51096,"seq":986346,"flashPageDataSize":3749}} {"ts":"2026-03-12T22:08:45.964Z","level":"WARN","message":"Limitless flash page yielded zero Opus frames","extra":{"index":966808,"session":51096,"seq":986347,"flashPageDataSize":3904}} {"ts":"2026-03-12T22:08:45.994Z","level":"WARN","message":"Limitless flash page yielded zero Opus frames","extra":{"index":966809,"session":51096,"seq":986348,"flashPageDataSize":3904}} # --- (all pages have non-zero data sizes ~3750-4019 bytes but decoder extracts 0 Opus frames) --- {"timestamp":"2026-03-12T22:09:16.032Z","level":"EVENT","type":"flash_page_download_completed","filesSaved":0} {"ts":"2026-03-12T22:09:20.116Z","level":"ERROR","message":"Local upload batch failed: Exception: Server is temporarily unavailable","extra":{"batchIndex":7,"filesInBatch":4}} {"ts":"2026-03-12T22:09:20.115Z","level":"ERROR","message":"Local upload batch failed: Exception: Server is temporarily unavailable","extra":{"batchIndex":7,"filesInBatch":4}} {"ts":"2026-03-12T22:09:20.251Z","level":"WARN","message":"Local upload cancelled","extra":{"batchesCompleted":0,"batchesFailed":6,"walsRemaining":36}} {"ts":"2026-03-12T22:09:20.251Z","level":"WARN","message":"Local upload cancelled","extra":{"batchesCompleted":0,"batchesFailed":8,"walsRemaining":30}} {"timestamp":"2026-03-12T22:09:20.344Z","level":"EVENT","type":"sync_completed","newConversations":0,"updatedConversations":0} {"timestamp":"2026-03-12T22:09:20.346Z","level":"EVENT","type":"local_upload_finished","batchesCompleted":0,"batchesFailed":8,"corrupted":0,"newConversations":0,"updatedConversations":0} {"ts":"2026-03-12T22:09:20.408Z","level":"ERROR","message":"Local upload batch failed: Exception: Server is temporarily unavailable","extra":{"batchIndex":1,"filesInBatch":4}} {"ts":"2026-03-12T22:09:20.436Z","level":"WARN","message":"Local upload cancelled","extra":{"batchesCompleted":0,"batchesFailed":2,"walsRemaining":48}} {"timestamp":"2026-03-12T22:09:20.462Z","level":"EVENT","type":"local_upload_finished","batchesCompleted":0,"batchesFailed":2,"corrupted":0,"newConversations":0,"updatedConversations":0} {"ts":"2026-03-12T22:09:20.754Z","level":"ERROR","message":"Local upload batch failed: Exception: Server is temporarily unavailable","extra":{"batchIndex":4,"filesInBatch":4}} {"ts":"2026-03-12T22:09:20.820Z","level":"WARN","message":"Local upload cancelled","extra":{"batchesCompleted":0,"batchesFailed":5,"walsRemaining":39}} {"timestamp":"2026-03-12T22:09:20.851Z","level":"EVENT","type":"local_upload_finished","batchesCompleted":0,"batchesFailed":5,"corrupted":0,"newConversations":0,"updatedConversations":0} {"timestamp":"2026-03-12T22:09:29.297Z","level":"EVENT","type":"wal_initialized","totalWals":7930,"missing":54,"synced":7876} {"timestamp":"2026-03-12T22:09:30.088Z","level":"EVENT","type":"device_connection_state","device_id":"[REDACTED_DEVICE_ID]","state":"connected"} {"ts":"2026-03-12T22:09:34.771Z","level":"INFO","message":"Limitless device initialized successfully"} {"timestamp":"2026-03-12T22:09:34.806Z","level":"EVENT","type":"polling_socket_connected","service_id":"onDeviceWhisper","buffer_duration_ms":5000,"min_buffer_bytes":32000} {"timestamp":"2026-03-12T22:09:35.701Z","level":"EVENT","type":"transcription_socket_connected","sample_rate":16000,"codec":"opus_fs320","language":"multi","include_speech_profile":false} {"timestamp":"2026-03-12T22:09:35.857Z","level":"EVENT","type":"limitless_storage_status","oldestPage":966807,"newestPage":979259,"currentSession":51989,"freePages":82780,"totalPages":95232} {"ts":"2026-03-12T22:09:52.904Z","level":"INFO","message":"SyncProvider: starting sync all WALs","extra":{"totalMissing":55,"sdCardWals":0,"deviceWals":1}} {"ts":"2026-03-12T22:09:52.939Z","level":"INFO","message":"Limitless batch mode enabled"} # --- second batch download: 12,453 pages, again filesSaved:0 --- {"timestamp":"2026-03-12T22:10:54.699Z","level":"EVENT","type":"flash_page_download_completed","filesSaved":0} {"ts":"2026-03-12T22:10:54.699Z","level":"INFO","message":"Limitless batch mode disabled","extra":{"pendingPagesCleared":0,"pendingFragmentsCleared":1}} {"ts":"2026-03-12T22:11:26.804Z","level":"INFO","message":"Sync Phase 2: Uploading phone files to cloud"} {"timestamp":"2026-03-12T22:11:26.867Z","level":"EVENT","type":"local_upload_started","walCount":32} {"timestamp":"2026-03-12T22:15:02.062Z","level":"EVENT","type":"sync_completed","newConversations":5,"updatedConversations":3} {"timestamp":"2026-03-12T22:15:53.808Z","level":"EVENT","type":"sync_completed","newConversations":0,"updatedConversations":7} {"timestamp":"2026-03-12T22:16:05.175Z","level":"EVENT","type":"device_connection_state","device_id":"[REDACTED_DEVICE_ID]","state":"disconnected"} {"timestamp":"2026-03-12T22:16:12.242Z","level":"EVENT","type":"device_connection_state","device_id":"[REDACTED_DEVICE_ID]","state":"connected"} {"ts":"2026-03-12T22:16:16.863Z","level":"INFO","message":"Limitless device initialized successfully"} {"timestamp":"2026-03-12T22:16:17.283Z","level":"EVENT","type":"transcription_socket_connected","sample_rate":16000,"codec":"opus_fs320","language":"multi","include_speech_profile":false} {"timestamp":"2026-03-12T22:16:17.377Z","level":"EVENT","type":"limitless_storage_status","oldestPage":966807,"newestPage":979317,"currentSession":51993,"freePages":82722,"totalPages":95232} {"ts":"2026-03-12T22:16:23.593Z","level":"INFO","message":"Sync Phase 1b: Downloading flash page data to phone"} {"ts":"2026-03-12T22:16:23.615Z","level":"INFO","message":"Limitless batch mode enabled"} # --- third batch download: 12,511 pages, filesSaved:0 --- {"timestamp":"2026-03-12T22:16:53.891Z","level":"EVENT","type":"flash_page_download_completed","filesSaved":0} {"ts":"2026-03-12T22:16:53.891Z","level":"INFO","message":"Sync Phase 2: Uploading phone files to cloud"} {"timestamp":"2026-03-12T22:16:53.955Z","level":"EVENT","type":"sync_completed","newConversations":0,"updatedConversations":0} {"timestamp":"2026-03-12T22:17:07.476Z","level":"EVENT","type":"device_connection_state","device_id":"[REDACTED_DEVICE_ID]","state":"disconnected"} {"timestamp":"2026-03-12T22:17:53.129Z","level":"EVENT","type":"device_connection_state","device_id":"[REDACTED_DEVICE_ID]","state":"connected"} {"ts":"2026-03-12T22:18:12.408Z","level":"INFO","message":"Limitless device initialized successfully"} {"timestamp":"2026-03-12T22:18:12.441Z","level":"EVENT","type":"composite_socket_stopping"} {"timestamp":"2026-03-12T22:18:12.441Z","level":"EVENT","type":"polling_socket_connected","service_id":"onDeviceWhisper","buffer_duration_ms":5000,"min_buffer_bytes":32000} {"timestamp":"2026-03-12T22:18:12.845Z","level":"EVENT","type":"pure_socket_connected","url":"wss://api.omi.me/v4/listen?language=multi&sample_rate=16000&codec=opus_fs320&uid=[REDACTED_UID]&include_speech_profile=true&stt_service=soniox&conversation_timeout=120&source=limitless&custom_stt=enabled&speaker_auto_assign=enabled"} {"timestamp":"2026-03-12T22:18:12.980Z","level":"EVENT","type":"limitless_storage_status","oldestPage":966807,"newestPage":979325,"currentSession":51998,"freePages":82714,"totalPages":95232} # --- fourth batch download: 12,519 pages, filesSaved:0 --- {"timestamp":"2026-03-12T22:18:34.191Z","level":"EVENT","type":"flash_page_download_started","startPage":966807,"endPage":979325,"totalPages":12519} {"timestamp":"2026-03-12T22:19:05.184Z","level":"EVENT","type":"flash_page_download_completed","filesSaved":0} {"timestamp":"2026-03-12T22:20:15.734Z","level":"EVENT","type":"pure_socket_disconnecting","url":"wss://api.omi.me/v4/listen?language=multi&sample_rate=16000&codec=opus_fs320&uid=[REDACTED_UID]&include_speech_profile=true&stt_service=soniox&conversation_timeout=120&source=limitless&custom_stt=enabled&speaker_auto_assign=enabled","current_status":"PureSocketStatus.disconnected"} {"timestamp":"2026-03-12T22:20:37.686Z","level":"EVENT","type":"composite_socket_connected","primary_status":"PureSocketStatus.connected","secondary_status":"PureSocketStatus.connected"} {"timestamp":"2026-03-12T22:23:16.192Z","level":"EVENT","type":"wal_initialized","totalWals":7930,"missing":0,"synced":7930} {"timestamp":"2026-03-12T22:23:54.841Z","level":"EVENT","type":"device_connection_state","device_id":"[REDACTED_DEVICE_ID]","state":"connected"} {"ts":"2026-03-12T22:23:58.137Z","level":"ERROR","message":"Limitless initialization failed"} {"timestamp":"2026-03-12T22:23:58.144Z","level":"EVENT","type":"device_connection_state","device_id":"[REDACTED_DEVICE_ID]","state":"disconnected"} {"timestamp":"2026-03-12T22:24:00.389Z","level":"EVENT","type":"device_connection_state","device_id":"[REDACTED_DEVICE_ID]","state":"connected"} {"timestamp":"2026-03-12T22:24:00.565Z","level":"EVENT","type":"transcription_socket_connected","sample_rate":16000,"codec":"pcm8","language":"multi","include_speech_profile":false} {"ts":"2026-03-12T22:24:07.038Z","level":"INFO","message":"Limitless device initialized successfully"} {"timestamp":"2026-03-12T22:24:07.106Z","level":"EVENT","type":"polling_socket_connected","service_id":"onDeviceWhisper","buffer_duration_ms":5000,"min_buffer_bytes":32000} {"timestamp":"2026-03-12T22:24:07.116Z","level":"EVENT","type":"limitless_storage_status","oldestPage":966807,"newestPage":979380,"currentSession":52007,"freePages":82659,"totalPages":95232} {"timestamp":"2026-03-12T22:24:07.979Z","level":"EVENT","type":"transcription_socket_connected","sample_rate":16000,"codec":"opus_fs320","language":"multi","include_speech_profile":false} {"timestamp":"2026-03-12T22:24:08.196Z","level":"EVENT","type":"limitless_storage_status","oldestPage":966807,"newestPage":979381,"currentSession":52007,"freePages":82658,"totalPages":95232} {"timestamp":"2026-03-12T22:24:17.212Z","level":"EVENT","type":"sync_started","totalMissingWals":1,"sdcard":0,"flashPage":1,"phone":0} {"ts":"2026-03-12T22:24:17.212Z","level":"INFO","message":"Sync Phase 1a: Downloading SD card data to phone"} # --- fifth batch download: 12,575 pages, same zero Opus frames pattern --- {"timestamp":"2026-03-12T22:24:17.242Z","level":"EVENT","type":"flash_page_download_started","startPage":966807,"endPage":979381,"totalPages":12575} {"ts":"2026-03-12T22:24:40.463Z","level":"INFO","message":"Limitless batch mode disabled","extra":{"pendingPagesCleared":0,"pendingFragmentsCleared":1}}[-]Limitless pendant: clock drift causes duplicate conversations and failed offline sync[/-][+]Limitless pendant: clock drift causes duplicate conversations and missing timestamp correction[/+]brightshore-ventures commentedon Mar 23, 2026
Update: Root cause identified — not clock drift
My analysis above was wrong about the cause. The "zero Opus frames" pages don't contain drifted audio — they contain firmware diagnostic logs.
I captured the same failed sync from both sides simultaneously (Omi app debug log + nRF Connect BLE packet capture) and reassembled all 70 failing pages from raw BLE traffic. Every page contains only:
storage_thread_,audio_thread_ha, etc.)<inf> bt_data_comm: Finished batch upload of flash_page)Zero of the 70 pages contain any audio data. The parser returns zero Opus frames because there are no Opus frames — the pages use protobuf fields
0x52/0x5a/0x62where the parser expects0x12(audio data).No audio was lost. Session 1349 started with
Recording state set to NOT_RECORDING/Device mode set to IDLE_MODE. These were idle/diagnostic sessions, not recordings.The March 12 log above (session 51096, pages 966807–967649) is almost certainly the same issue — 4,119 pages of firmware logs from an idle weekend, not drifted audio.
The fix and full analysis are posted on #5733. Clock drift is still a real issue for duplicate conversations (the other bug in this issue), but it's not what causes the batch sync failure.
fix(app): harden Limitless clock-drift correction (BasedHardware#5734)
fix(app): correct Limitless flash timestamps for clock drift (#5734) (#…