Repository navigation
Description
TL;DR: Live phone-mic audio is marked "synced" the moment it's sent over the socket, so the app keeps no backup of it. If the server never saves the text, there's nothing to resend. Last week 495 phone-mic recordings sent audio and never got any text back: 101 of them were longer than 30 seconds, about 12 hours of audio in total. None had a connection error, so no repair ran. The phone mic should keep its frames until the transcript confirms them, as #19199 already does for the pendant. A fix with tests is ready; a PR will follow.
Product impact
- Primary loop layer: Capture
- Involves data loss: phone-mic speech the server didn't save has no local copy to recover from.
Describe the bug
- All three phone-mic send paths call
markFrameSyncedright after sending the frame:capture_controller.dart:387,:2419and:3629. - When every frame in a minute-long chunk is marked synced,
_chunkstores nothing unless "unlimited local storage" is on (local_wal_sync.dart:539). - fix: make live capture uploads durable and self-healing #19199 stopped doing this for the pendant (
capture_controller.dart:1790: "Do not mark pendant frames synced on transport send"). The phone path was left as it was. - Only frames captured while the socket is disconnected are kept. A session that stays connected while the server loses its text has nothing to recover from.
To reproduce (replay-world test with the real CaptureController and LocalWalSyncImpl, a scripted socket and the fake native mic)
- Record 200 s of phone-mic audio with the socket connected.
- The server closes the conversation with a transcript that covers only seconds 1–20.
- Look at the phone's WALs.
Current behavior
No WAL exists for the session; none of the uncovered 180 seconds can be recovered.
Expected behavior
The phone keeps the audio until the transcript confirms it, then releases what is covered and uploads the rest for repair.
Since when
#5995 (merged 2026-03-28) added the phone-mic WAL with "mark synced on send". It affects all app versions.
Impact, last 7 days (PostHog Recording Completed, recording_source = 'phone_mic_live', 2026-09-25 to 2026-10-02)
| Recordings | Audio | |
|---|---|---|
| All live phone-mic recordings (iOS 1,327, Android 710, iPadOS 9) | 2,046 | ~904 h |
| Audio sent, no text ever came back (iOS 229, Android 265, iPadOS 1) | 495 | ~13 h |
| … of which 30 s or longer | 101 | ~12 h |
| … of which 10 min or longer | 10 | ~8.5 h |
- All 495 had
socket_error_count = 0, so the app's repair path never ran and no local copy exists. - Some of the short ones may be silence (the phone in a pocket, nobody talking).
- PostHog can't count partial loss, where some text arrived and some didn't.
Proposed fix (tested locally)
- Stop marking phone frames synced on send. They're then stamped and released by the same transcript confirmation as the pendant, with the coverage check from Flutter transcription: a partial transcript deletes the pendant's whole audio backup #20364.
- Storage cost: phone audio is PCM16 at 16 kHz, about 1.9 MB/min (about 115 MB per hour of recording). It is held on disk until the conversation is confirmed, then deleted.
- Upload cost: only audio the transcript doesn't cover is uploaded. That's heavier than the pendant's Opus (about 2.9 MB per 90 s). Encoding the backup as Opus would cut it and could be a follow-up.
Verification
- The scenario test fails on
main(0 s recoverable) 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
Recording Completed events from the last 7 days with recording_source = 'phone_mic_live', transcript_observed = false, audio_observed = true and socket_bytes_submitted > 0, bucketed by duration_seconds and split by socket_error_count. Here, transcript_observed means the app saw at least one live transcript segment during the recording.
Additional context
- Related: Flutter transcription: a partial transcript deletes the pendant's whole audio backup #20364, fix: make live capture uploads durable and self-healing #19199, fix(app+backend): add WAL support for phone mic recording #5995.
- Open PRs ⚡ Optimize property access in audio frame loops #18611 and ⚡ Optimize repeated property access in audio frame processing loops #18615 edit the same phone-mic send lines.
Activity