Flutter transcription: later conversations on one pendant connection never get their backup tagged, so they are re-uploaded as duplicates
TL;DR: The app tags a pendant conversation's backup audio (the WAL) only for the first conversation after a connection opens. Every later conversation on the same connection is left untagged, so its backup is never released. The background drain later uploads that backup without a conversation, and the server creates a duplicate conversation from audio it already transcribed. On the builds that include #19199, 1,779 pendant recordings last week produced 2 or more conversations: about 8,500 later conversations across about 585 users. That is the upper bound of affected conversations. A fix with tests is ready; a PR will follow.
Product impact
- Primary loop layer: Capture
- [x] Involves broken sync/trust: duplicate conversations, plus upload and batch-STT work for audio that was already transcribed live.
Describe the bug
-
The session window only starts when a socket is published:
capture_controller.dart:1336-1337sets_sessionStartSecondswhen it is 0 and the socket is new. -
When the server closes a conversation, the
memory_processing_startedhandler reads the window (:3141) and stamps the WALs (:3148). Then_resetStateVariables()(:3150) sets_sessionStartSeconds = 0(:875). -
The pendant socket stays open for the next conversation, so the window never restarts. For the second conversation the pending session start is 0:
_finalizeAndStampSessionskips stamping (:3316);- the
memory_createdhandler skips confirmation (:3173).
So the conversation id is never stamped and the backup is never released.
-
#19424 also stamps WALs with the recording id, but that stamp runs inside
stampConversationId, which is skipped here. #19424's description lists later silence-rollover generations as a known residual.
To reproduce (replay-world test with the real CaptureController and LocalWalSyncImpl, a scripted socket and a scripted pendant)
- Stream 140 s of pendant audio. The server closes conversation
c1with a full transcript, andc1's WALs are released (correct). - Keep streaming another 140 s on the same socket. The server closes
c2with a full transcript. c2's WALs staymisswithconversationId == null. On the next recovery wake they're uploaded without a conversation.
Current behavior
From the second conversation onward, backups are left untagged and kept, then uploaded later with no conversation.
Expected behavior
Each conversation's backup is tagged and released when its transcript confirms it, the same way as the first conversation.
Since when
- The session window and its reset date from #6294 (merged 2026-04-04).
- It did little harm while pendant audio was marked synced on send.
- Since #19199 (merged 2026-09-26), every pendant frame is backed up and untagged recent WALs are drained in the background. So every later conversation's audio is now uploaded again.
- Affected builds: iOS 1.0.553 build 1301 and Android 1.0.553 build 1320, both out since about 2026-09-30.
Server cross-check
- Untagged uploads become new conversations. An upload without a conversation never merges into a live conversation (
assignment.py:171-172: "Live and user-managed rows can only be explicit targets"). The sync job therefore creates a new conversation, which is the duplicate #19424 describes. - The recording-id binding can't rescue them. It needs the audio to fall inside [
started_at− 5 s,finished_at+ 60 s] of the conversation that carries the recording id (recording_session_target.py:25-26). According to #19424, a silence rollover gives later conversations a new server recording id.
Impact, last 7 days (PostHog, 2026-09-25 to 2026-10-02)
- Recordings with several conversations: 1,779
pendant_liverecordings on builds 1301 and 1320 produced 2 or moreMemory Createdconversations (1,281 iOS, 498 Android). They averaged about 2 hours and about 6 conversations each. - Later conversations: 8,531 second-or-later conversations (6,021 iOS, 2,510 Android) across about 585 users.
- This is an upper bound. A reconnect between conversations restarts the window and avoids the bug.
Recording Completed.socket_connection_countis 0 on every pendant recording, so PostHog can't rule reconnects out. That is a separate telemetry gap. - Uploads can't be separated.
Recording Upload Startedon those builds shows more than 137,000 attempts (about 145 GB) in roughly 3 days, but the event has no field that marks these re-uploads.
Proposed fix (tested locally)
When the server closes a conversation and capture continues on the same socket, start the next conversation's window at that moment. Its WALs are then stamped (conversation id and recording id) and released on confirmation, like the first conversation's. The stamp only takes WALs that have no conversation yet, so the previous conversation's pieces aren't affected.
Verification
- The scenario test fails on
main(two WALs left untagged) and passes with the fix. - The existing capture, WAL and sync tests (949) and the full app suite (3,904 passed, 0 failed) pass.
How the PostHog numbers were measured
For each Recording Completed with recording_source = 'pendant_live' and $app_build IN ('1301', '1320') in the last 7 days, count the same person's Memory Created events (recording_hardware_type IN ('omi', 'openglass'), same builds) from the recording's start (timestamp − duration_seconds) to 2 minutes after its end. A recording with n ≥ 2 contributes n − 1 later conversations.
Additional context
Related: #20364 (a partial transcript deletes the whole backup), #19199, #19424, #6294.
Fixed on main by #26035, merge commit 52e6dcb5a677e308c5d859a2bb2b192bdd2b7ab0.
Every continuing-socket conversation now owns an exclusive backup cut and its own confirmation state. Covered copies enter synced retention; partial, interrupted or ambiguous audio stays recoverable, with upload preferences preserved. The regressions include reversed events, overlapping Process Now requests, disk failures, account changes and restart discovery.
Final reviewed head 4c7fd5f38d1776b281acab5579382e90b5983320 passed Mobile App Checks: 10,133 Flutter tests passed (8 skipped), hermetic journeys, generated files, Android compile/JVM tests and emulator acceptance. Synthetic replay exercises the production controller, ledger, files and recovery coordinator.
Mobile shipment is pending the normal release workflow; the unreleased changelog entry tracks inclusion. This closure records the verified code fix on main.