Repository navigation
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
|
The design here is right, and the head commit resolves the earlier fence-snapshot race — leaving for maintainer sign-off because no CI has run on this head and this is data-persistence logic in the core capture pipeline. What I verified:
Performance: removes the redundant re-upload (and server re-transcription) of already-transcribed audio — this is a cost reduction, not an added cost. Security: no new data leaves the device and no new surfaces; blast radius if the fence were wrong is audio misattributed between adjacent conversations on one socket, which is why CI plus an owner's look matters. USER IMPACT: During long pendant sessions, conversations after the first stop appearing twice, and their audio is no longer uploaded a second time. What I would still want before merge: (1) CI — this head has zero check runs, so none of the new tests have executed in CI (workflows may be awaiting first-time-contributor approval); a green app-test run on 9b2545e is required, and (2) a sign-off from whoever owns the capture/WAL pipeline on the identity-fence approach. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Hey @cocvn157 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
…#26035) Fixes #20365. After the first conversation closes on a continuing pendant socket, capture currently clears its WAL window and never rearms it. Later saved conversations leave their backups unlinked and eligible for duplicate upload. A single pending-close slot also loses earlier evidence when results arrive out of order. This change rotates a distinct conversation window without reconnecting, seals an exclusive WAL cut before any queued I/O, and retains per-close transcript/interruption/socket-mode evidence. Saved transcript coverage and existing committed-receipt rules still control retention. Partial, interrupted, held and uncertain audio remains recoverable, and upload preferences remain authoritative. Process Now reserves its own cut and resolves overlapping server events against every relevant outstanding response ID; ambiguous audio is never guessed into another conversation. Account retirement fences the writes and cancels pending timers. A failed disk snapshot still waits for its predecessor, so errors cannot detach the ordered tail. The close lifecycle is isolated in a small capture part, and exact WAL cut ownership lives beside the ledger. Existing lifecycle/checkpoint finalization remains separate. Architecture, custody documentation and the implementation checklist are updated. Credit: this builds on Ashwin's #20380 and cocvn157's #24846 rollover/snapshot work, adapted to current custody and typed Process Now contracts. Validation: - Original main controller fails the new three-conversation replay: c2 backups remain unlinked. - 16 new production-controller/ledger/disk/recovery replays cover sequential closes, reverse confirmations, partial coverage, duplicate events, queued disk barriers, delayed/failed and overlapping Process Now, account retirement, stop/dispose, restart and both Custom STT raw-audio settings. - 10 new snapshot ownership tests and 40 existing WAL regressions passed. The failed-middle-drain regression fails with the predecessor wait removed and passes with it restored. Caption-store/provider/coalescing consumers pass 115 tests using the authoritative window key. - All 31 hermetic mobile journeys passed (0 failed/skipped); analyzer ratchet, generated-output checks and all 27 preflight checks passed locally. - Full Flutter and Android CI on the final immutable head remain merge gates (see Checks). An initial broad local run overlapped final edits and is not claimed as frozen-head evidence. - Replay substitutes socket/native/device boundaries; no physical pendant, live provider, production recordings or store release is claimed. INV-CAP-1: Every admitted frame stays in the owner-scoped ledger; exact sealed cuts establish lineage only. Unconfirmed or partial audio stays readable/recoverable and existing policy alone releases confirmed copies into synced retention. Failure-Class: none The existing buffer-clear-after-async-flush and cross-device duplicate-capture classes have different failure mechanisms/prevention: this defect is a missing conversation-window rollover plus overwritten close evidence, resolved with per-close snapshots rather than content dedupe or cleanup policy changes. UI-Evidence: none -- capture and ledger behavior only; no Flutter view or user-facing layout changed. Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 3155 -> 3196 | Keep admission sealing beside the existing frame buffer and extension paths; token handling is extracted into conversation_wal_snapshot.dart and the capture controller shrinks.
…rdware#20365) Rotate conversation windows on continuing sockets and retain per-close evidence. Reserve exact WAL identities before queued persistence; keep uncertain Process Now audio recoverable and fence account changes. Based on prior work in BasedHardware#20380 and BasedHardware#24846. Co-authored-by: Ashwin <[email protected]> Co-authored-by: cocvn157 <[email protected]>
Fixes #20365
/claim #20365
Problem
When a pendant connection remains open across multiple conversations,
_sessionStartSecondswas initialized only when the transcription socket opened and cleared by_resetStateVariables()when the server started processing the first conversation. For every subsequent conversation on the same socket,_sessionStartSecondsremained0:_finalizeAndStampSession()andforceProcessingCurrentConversation()skipped stampingconversationIdonto the session WALs.ConversationEventconfirmation skipped judging WAL coverage for later conversations._pendingAutoSyncSessionStart,_pendingAutoSyncConversationId,_pendingAutoSyncNeedsRepair) were overwritten if a later conversation closed before an earlier conversation'sConversationEventarrived.recordingSessionId, an unfenced or out-of-order stamp could attach WALs created after a close to the closing conversation.Solution
_startNextConversationWindow): When a conversation closes (ConversationProcessingStartedEventorforceProcessingCurrentConversation) and capture continues on the open socket (_captureOutlivesClose), start the next conversation window at the close timestamp and increment_nextConversationWindowssoactiveCaptureSessionIdstays unique even for same-second closes. Retain the recording's geolocation snapshot while capture continues.walsNow()/walsAtClose): Capture an identitySet<Wal>snapshot right afterfinalizeCurrentSession()drains the closing conversation's tail (_drainClosingConversation()), and restrictstampConversationIdto WALs present inwalsAtCloseso chunks created after the close stay with the next conversation._pendingFinalizeAndStamp): Chain each close's stamp (after: _pendingFinalizeAndStamp) across both server-driven closes and Process Now closes, and keep_pendingFinalizeAndStampintact across confirmation/sync awaits so waiters never skip an in-flight stamp._pendingCloses): TracksessionStart,needsRepair, and the 30-second fallback timer perconversationIdso out-of-orderConversationEventdeliveries only complete their own close.app/test/unit/wal_stamp_fence_test.dartandapp/test/services/capture/capture_next_conversation_window_test.dartcovering multi-conversation socket sessions, muted/interrupted closes, Process Now interleavings, lateConversationEventdeliveries, back-to-back closes, and WAL identity fencing.Product invariants affected
Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 4855 -> 4938 | per-conversation close map, close-ordered stamp chain, and next-window re-arming for #20365
Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 2707 -> 2728 | WAL identity fence and serialized finalize snapshot at close for #20365
UI-Evidence: none -- background capture and WAL stamping/confirmation service logic with no UI change
Failure-Class: none