Repository navigation
fix(sync): bind safety WALs to live recording intervals - #19424
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-authored-by: Cursor <[email protected]>
Failure-Class: FC-same-speech-captured-twice-surfaces-twice Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-authored-by: Cursor <[email protected]>
Failure-Class: FC-same-speech-captured-twice-surfaces-twice Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-authored-by: Cursor <[email protected]>
Failure-Class: FC-same-speech-captured-twice-surfaces-twice Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-authored-by: Cursor <[email protected]>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
The opened and reopened events did not start the PR workflows. Failure-Class: FC-same-speech-captured-twice-surfaces-twice Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep both the same-device grouping tests and the capture-shadow tests so the pull request can merge and CI can run. Failure-Class: FC-same-speech-captured-twice-surfaces-twice Co-Authored-By: Claude Opus 5.5 <[email protected]>
Unit tests stub google.cloud before importing the sync pipeline, so a module-level Firestore import failed collection. Failure-Class: FC-same-speech-captured-twice-surfaces-twice Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Cloud Tasks payload allowlist is exact, so the new field was rejected before a task could be captured. Failure-Class: FC-same-speech-captured-twice-surfaces-twice Co-Authored-By: Claude Opus 5.5 <[email protected]>
Bind only when the full WAL interval belongs to the matching live generation, and restore the same-source refusal. Failure-Class: FC-same-speech-captured-twice-surfaces-twice Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure-Class: FC-same-speech-captured-twice-surfaces-twice
…-dedup Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure-Class: FC-same-speech-captured-twice-surfaces-twice
Itaxh1
added a commit
to Itaxh1/omi
that referenced
this pull request
Oct 2, 2026
BasedHardware#19424 stamps a WAL by its recording id even when its start, backdated from its frame count, falls before the session window. Confirmation still only looked inside the window, so a fully transcribed first chunk stayed behind and was uploaded again. With the transcript's spans in hand, every WAL stamped with the conversation is judged by them. Refs BasedHardware#20364
This was referenced Oct 2, 2026
Git-on-my-level
added a commit
that referenced
this pull request
Oct 3, 2026
…ipt covers (#20376) * fix(app): release the pendant backup only for audio the saved transcript covers A conversation with any saved text released every safety WAL in its session, so audio the server never saved was deleted for good. Confirmation now takes the saved transcript's time spans: a WAL is released only when a saved segment overlaps it (with 30 s slack) or it ended before the conversation started. The rest stays on the phone and is uploaded for repair. Closes #20364 * fix(app): judge backdated stamped backups by the saved transcript #19424 stamps a WAL by its recording id even when its start, backdated from its frame count, falls before the session window. Confirmation still only looked inside the window, so a fully transcribed first chunk stayed behind and was uploaded again. With the transcript's spans in hand, every WAL stamped with the conversation is judged by them. Refs #20364 * fix(app): take the session start as origin for a row without started_at The server sets started_at on every conversation it creates, but a row without one used its createdAt, which can sit minutes away from the audio and shift every span. The scenario tests now wait for the expected WAL state, in memory and in the saved index, before asserting and before the recovery pass, and fail with the WAL state if it never arrives. * fix(app): anchor the saved transcript to the phone's clock Saved segment times count from the server's conversation start, but the copies carry phone time, so a clock difference beyond the 30 s slack moved the release boundary: a server clock ahead released audio the transcript missed, and one behind re-uploaded audio it covered. The controller now records when each live segment last arrived and, at confirmation, takes the median of arrival minus segment end as the transcript's start on the phone. Without live segments it falls back to the server's start, as before. The full-release scenarios now also assert that copies exist before the conversation closes. * fix(app): keep each closing conversation's segment arrivals until its own event The arrival times that anchor a saved transcript to the phone's clock were held in one slot, so a conversation that closed before the previous ConversationEvent arrived replaced them. They are now kept per conversation id and taken by the matching event. #20365's change keys the rest of the close state the same way. * fix(app): retain safety audio when transcript coverage is uncertain Timestamp overlap and pre-conversation timing do not prove delivery. Keep uncertain copies for recovery and measure accepted repair uploads. Fence deletion against account changes and shared-file/id collisions. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(app): avoid duplicate speech while retaining covered safety audio Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(app): avoid duplicate repair uploads during natural speech pauses Treat transcript gaps and WAL edges up to 30 seconds as pauses because coverage now suppresses automatic repair without deleting local audio. Exercise conversational utterances and larger missing stretches in replay. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: David Zhang <[email protected]> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
One pendant recording could show up twice: the live conversation from
/v4/listen, and a second conversation created when the phone uploaded its local safety copy of the same audio without a conversation id. No user content or identifiers are included here.Root cause
app/lib/services/capture/capture_controller.dart:1807). That WAL was stamped with the live conversation id only afterConversationProcessingStarted(capture_controller.dart:3167). The stamp window requiredtimerStartto fall between session start and now (app/lib/services/wals/local_wal_sync.dart:784). Session start is recorded only when the transcription socket is published (capture_controller.dart:1318), which is after frames have already started, and WALtimerStartis backdated from the frame count, so the main chunk often sat before the window and stayed unstamped._finalizeAndStampSessionalso awaited the disk flush and then returned without stamping when a device update rolled the session during that await (capture_controller.dart:3346). An unstamped WAL uploaded with noconversation_id(app/lib/backend/http/api/conversations.dart:797).sync_content_revision(backend/utils/sync/assignment.py:65,backend/utils/sync/assignment.py:164).Fix
activeRecordingId/recording_session_id) when the WAL is created, after the previous session's tail is flushed, and send it as an optionalrecording_session_idon/v2/sync-local-files. Conversation-id stamping stays. A WAL that already carries this recording id is stamped even when its backdatedtimerStartis before session start, and a session roll during the flush no longer skips that stamp. A WAL from a different recording is left alone.recording_session_id, source, device, and lock state, and the WAL overlaps that conversation and fits within a bounded interval: up to 5 seconds beforestarted_atfor socket startup or clock skew, and up to 60 seconds afterfinished_atfor trailing silence (less than the 120-second silence-rollover gap). It then uses the existing explicit-target path, including live-target transcript dedupe. A single long, exact-text line in a mixed WAL batch is also dropped when its timestamp differs by at most 2 seconds and its duration is within the existing 25% ratio; broader clock-offset matches retain the batch gate. A query capped at six rows binds nothing when more than five candidates exist, so truncation cannot imply uniqueness. A unique resolved target is authoritative even when it differs from a locally stamped conversation id from another silence-rollover generation. Missing/ambiguous matches, provenance or interval mismatches, and lookup failures (logged with a bounded HMAC UID hash) clear an unverifiable local stamp and keep the unbound sync path. Omitting the new recording proof keeps the existing stamped-target behavior for old clients.origin/main. Old app versions omit the new fields and continue through today's unbound sync path with the existing same-source refusal. The separate Jev capture shadow continues to measure same-device pairs and remains shadow-only.The phone change ships with the next mobile release. On the first listen generation, the phone's
activeRecordingIdis sent asclient_conversation_idand is the id listen stores asexternal_data.recording_session_id. Silence rollover deliberately mints a new server recording id while the phone id may continue. A WAL that truly spans a rollover remains unbound rather than being assigned to either generation; later-generation WALs whose id differs from the server id fall back to ordinary sync. Binding for that later generation remains a documented residual until the client receives and sends the server id.Gap-only STT option for David's decision
For a bound safety WAL, the server could map existing live transcript word timestamps into the WAL's audio timeline, subtract covered intervals with a small guard band, and send only uncovered audio ranges to paid batch STT. This could save most batch STT minutes when live recognition covered nearly all speech. The server would need reliable clock alignment, VAD and gap boundaries, and a fallback to full-WAL STT when timing is uncertain; otherwise words near gaps, late live results, or speech missed by live STT could be lost. This PR leaves paid STT input unchanged pending David's ruling.
Verification
backend/test.shrun passed 263 tests acrosstest_sync_recording_session_target.py,test_sync_silent_failure.py,test_sync_cross_job_assignment.py,test_sync_cloud_tasks.py, andtest_developer_from_segments_idempotency.py. Focused Flutter tests passed 88 tests across six WAL/upload/provider files. Backend Pyright reported 0 errors.scripts/pr-preflight --pr-body-fileandOMI_PR_BODY_FILE=.local/pr-body-fix-sync-live-capture-dedup.md make preflighteach passed 53 checks. The merged main branch had a stale desktop meeting fixture that claimed five minutes with only 60 seconds of transcript span; updating that fixture to span five minutes makes its 42-test file pass.Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 3812 -> 3831 | reason: recording-session bind stays in the existing session start and stamp path
Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 1572 -> 1613 | reason: safety WAL creation and conversation stamp learn the recording id in place
Line-Count-Exception: backend/routers/sync.py | 2187 -> 2221 | reason: optional recording identity and audio interval are threaded through existing v2 sync dispatch
Line-Count-Exception: backend/utils/sync/pipeline.py | 2687 -> 2730 | reason: interval-bounded recording-session lookup runs before the existing explicit-target intake
Failure-Class: FC-same-speech-captured-twice-surfaces-twice
Product invariants affected
none
🤖 Generated with Claude Code