Skip to content

fix(app): link later live conversations to their own backups (#20365) - #26035

Merged
aryanorastar merged 4 commits into
mainfrom
codex/20365-conversation-backup
Nov 22, 2026
Merged

aryanorastar merged 4 commits into
mainfrom
codex/20365-conversation-backup

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

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.

aryanorastar and others added 4 commits November 22, 2026 15:07
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 #20380 and #24846.

Co-authored-by: Ashwin <[email protected]>

Co-authored-by: cocvn157 <[email protected]>
Keep all unresolved Process Now decisions. Defer ambiguous events until exact IDs arrive, including a late older close during a newer disk drain; preserve unlinked audio on uncertainty.
Caption persistence, coalescing and provider tests now read the live window identity rather than hard-coding the former seconds-only key. Storage-only arbitrary key tests remain unchanged.
A failed middle snapshot must await prior admitted stamps before its tail completes. A negative regression proves a later server close cannot bypass the unresolved predecessor.
@aryanorastar
aryanorastar marked this pull request as ready for review November 22, 2026 10:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T10:30:05.817368Z 4c7fd5f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flutter transcription: later conversations on one pendant connection never get their backup tagged, so they are re-uploaded as duplicates

1 participant