Skip to content

fix(app): stamp and release every conversation's pendant backup on one socket - #20380

Closed
Itaxh1 wants to merge 8 commits into
BasedHardware:mainfrom
Itaxh1:fix/wal-stamp-later-conversations
Closed

Itaxh1 wants to merge 8 commits into
BasedHardware:mainfrom
Itaxh1:fix/wal-stamp-later-conversations

Conversation

@Itaxh1

@Itaxh1 Itaxh1 commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR: On a pendant connection that stays open, the app tagged and released the backup audio of only the first conversation. Every later conversation's backup stayed on the phone and was uploaded again without a conversation, and the server turned it into a duplicate (#20365). Now each conversation the server closes starts a fresh backup window while recording continues, so later conversations are tagged and released exactly like the first. App only, no backend change. Last week this pattern affected up to about 8,500 conversations across about 585 users on the builds that include #19199.

What changed and why

Closes #20365

  • The session window (_sessionStartSeconds) is set only when a socket is published, and _resetStateVariables() clears it when the server starts processing a conversation. A pendant socket stays open across conversations, so from the second conversation on:
    • _finalizeAndStampSession skipped stamping (sessionStartSeconds > 0);
    • the memory_created handler skipped confirmation.
  • The new _startNextConversationWindow() runs right after that reset in the memory_processing_started handler. If a socket is still open and capture hasn't stopped, it starts the next conversation's window at that moment. This includes a capture that is paused (pendant mute, or a call suspending the pendant) or interrupted (a phone call, Siri, a mic stall), because it resumes on the same socket.
  • Nothing changes when the user has stopped recording (stop) or capture has failed (error): no new window is opened.
  • Process now resets the session the same way, so it now opens the next window at the close too (found by cubic's review). The server processes that conversation through POST /v1/conversations, not the listen session's finalization, so no memory_processing_started for it arrives to re-stamp the new window.
  • Each stamp is fenced at its close (found by cubic's review). A pendant recording runs on into the next conversation, and the stamp also matches WALs by recording id. So a chunk of the next conversation that landed while the closing one was still being stamped could be claimed by it. Both closing paths now take only the WALs that existed right after the close's drain (walsNow()). These are the WAL objects, not their ids, because two tails drained in the same second share an id. A WAL created later is the next conversation's, even when its start is backdated. Both paths drain, fence and read the close time through one helper, _drainClosingConversation(), so they can't drift apart.
    • The fence travels through prepareConversationStamp(…, walsAtClose:), so stampConversationId keeps its signature for the session spies that call it dynamically.
    • The WALs taken at the close include the tail its drain just made, whatever second the tail's start rounds to. So even a sub-second tail stays with its conversation, with its real start and duration (found by cubic's review).
  • Each close keeps its own state (found by cubic's review). The session start, the socket-repair flag and the 30 s fallback are kept per conversation id until that conversation's ConversationEvent. They used to share one slot: an event that arrived after the next close took that close's state, and the later event found none. Flutter transcription: a partial transcript deletes the pendant's whole audio backup #20364 (fix(app): release the pendant backup only for audio the saved transcript covers #20376) keys its segment-arrival snapshot the same way.
  • Stamps run in close order (found by cubic's review). The WALs at a close include an earlier conversation's that are still unstamped, under the same recording id, so a later close whose stamp ran first claimed them. That happened when its drain had nothing to write and finished first, or when the server closed the next conversation while Process now's request was still out. Each close now chains its stamp after the earlier ones (after:), Process now included, and the release paths wait on that chain. They no longer clear it, so a close that happens during a wait keeps its stamp in later waits.
  • The next conversation keeps the recording's location (found by cubic's review). The location snapshot belongs to the recording, but each close cleared it, so from the second conversation on the safety WALs carried no location. A close where capture goes on into the next conversation now keeps it, decided by the same check that opens the next window (_captureOutlivesClose). A close after the user stopped still clears it.
  • A Process now that makes no conversation (a network error or a 404) has no id to stamp with. Its audio carries the recording's id, so the next close in the recording stamps it, whether that's the conversation the server kept open or the one it had already closed.
  • Stamping still only takes WALs that have no conversation yet, so the previous conversation's pieces are never re-stamped.
  • Side effect: a later conversation now gets its own activeCaptureSessionId (live-<start>-<n>, where the counter separates windows opened in the same second, found by cubic's review), as the first conversation already did with live-<start>. Before, it was null and callers fell back to the recording id. The live-transcript store and the capture page's scroll state are therefore keyed per conversation from the second one on.

Order: land #20364 (#20376) first. Today these later conversations escape the all-or-nothing release that #20364 fixes, because they are never confirmed. Once this PR stamps and confirms them, they need #20364's coverage check so that a partial transcript can't delete their audio. The two PRs merge cleanly in either order.

Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 3799 -> 3862 | the conversation-processing handler must reopen the safety-WAL window at the existing socket/event owner
Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 1815 -> 1830 | the WAL owner must fence each conversation stamp at its close at the existing stamp boundary

Product invariants affected

none

How it was verified

  • flutter test test/services/capture/capture_next_conversation_window_test.dart test/unit/wal_stamp_fence_test.dart: 16 passed. On main without the fix:
    • the three-conversation scenario fails: the second conversation's two WALs are left unstamped;
    • the capture-identity scenario fails;
    • the stopped-phone scenario passes on both, as it should.
  • The muted-pendant and phone-call scenarios fail with this PR's first guard, which opened the window only for record and deviceRecord (found by cubic's review).
  • The late-event and same-second scenarios fail on the previous commit. c1's late event took c2's close state, and both windows were named live-<second>.
  • The two close-order scenarios fail on the previous commit. Back-to-back closes stamped c1's copies with c2, and a close during Process now stamped the processed conversation's audio with c2.
  • The location scenario fails on the previous commit: c2's copies carried no location.
  • The scenarios wait for the expected WAL state, in memory and in the saved index, and fail with the WAL state if it never arrives. A quiet moment no longer counts as done, so slow file writes can't race the assertions or the teardown.
  • Capture, WAL, sync, spine and capture-provider suites (test/unit/*wal*|*capture*|*sync*|*transcri*|*recording*|*segment*, test/services/capture, test/services/wals, test/spine, test/providers/capture_provider_test.dart): 959 passed.
  • bash app/test.sh: 3,914 passed, 5 skipped, 0 failed.
  • Combined with Flutter transcription: a partial transcript deletes the pendant's whole audio backup #20364 and Flutter transcription: phone-mic audio has no backup once it is sent #20366 on a local merge, the three branches merge cleanly. On that merge, the related suites pass (987 tests), and bash app/test.sh reports 3,942 passed, 5 skipped, 0 failed.
  • flutter analyze on the changed files: no issues.
  • Not run on a physical device.

Tests

app/test/services/capture/capture_next_conversation_window_test.dart (new) uses the replay world: the real CaptureController, LocalWalSyncImpl and RecordingTransferCoordinator, a scripted socket and a scripted Opus pendant.

  • Three conversations close on one socket. After each, every WAL is released, and a recovery pass uploads nothing.
  • After the first conversation closes while the pendant keeps streaming, the next conversation has its own non-null capture identity.
  • With a location fix, c1's copies carry the recording's location, and after c1 closes, so do c2's. The replay world takes a location fix (locationFix), with the compatibility upload stubbed.
  • The pendant is muted across a conversation close. The muted conversation is released, and after the unmute the next conversation's audio is released too, with nothing uploaded.
  • A phone call interrupts the phone mic while the server closes a conversation. The next window opens. When the call ends, the resumed audio streams on the same socket while that window stays active. On this branch alone, streamed phone audio has no safety copy to stamp (Flutter transcription: phone-mic audio has no backup once it is sent #20366). On the local merge with Flutter transcription: phone-mic audio has no backup once it is sent #20366's fix, the resumed audio is kept and stamped with the next conversation.
  • When the user stops the phone mic before the server closes the conversation, no new window is opened.
  • After Process now, the pendant streams on and the next conversation's copies are stamped and released. This fails without the change, because there is no window after Process now.
  • A Process now makes no conversation (the replay world's stub returns null, as a failed request does). The pendant streams on, and the server's close stamps the audio from before and after Process now with the conversation it kept open.
  • The transcript fixture covers each conversation end to end, so the releases the scenarios expect don't lean on Flutter transcription: a partial transcript deletes the pendant's whole audio backup #20364's coverage slack (found by cubic's review).
  • Every scenario checks that the streamed audio is in a copy before each close, so a release can't pass on no copies at all (found by cubic's review).
  • The server is slow: c1's event misses its 30 s fallback and arrives after c2 has closed. c2's copies survive c1's event, and c2's own event then releases them.
  • Two conversations close within the same virtual second, and their windows get different capture ids.
  • c2 closes before c1's stamp is on disk, with nothing of its own to drain. c1's copies are still stamped with c1.
  • The server is slow to answer Process now, and the next conversation closes first. The audio from before Process now goes with the conversation Process now made, and c2's own event releases c2's copies. The replay world can now hold and answer Process now (processResponse).
  • The session spies (test/spine/c1_location_completion_test.dart, the Process-now and backlog widget tests) still pass, with stampConversationId unchanged.

app/test/unit/wal_stamp_fence_test.dart (new): a fenced stamp claims the WALs that existed at the close, including a backdated one. It leaves WALs created after the close for the next conversation, including one whose start is backdated. Two WALs that share an id are told apart. The fence holds for one stamp only, and half a second of audio drained at the close still goes to the closing conversation.

Failure class (fixes)

Failure-Class: none

Review in cubic

…e socket

The session window starts only when a socket opens, and the server closing a
conversation clears it. On a pendant socket that stays open, every later
conversation's WALs were never stamped or confirmed: they stayed on the phone
and were later uploaded without a conversation, which the server turns into a
duplicate. When processing starts and capture continues, start the next
conversation's window, so its backup is stamped and released like the first.

Closes BasedHardware#20365
@Itaxh1

Itaxh1 commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 2, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@Itaxh1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@apoorvdarshan

Copy link
Copy Markdown
Collaborator

Reviewed the original implementation at 75b2c1fe1ad55b7ddad3cec4b00164212b8a5312. Original later-conversation stamping work remains credited to Ashwin Kumar U / Itaxh1.

The combined 23-test later-conversation/recovery run exposed a fixture wait race: the healthy confirmation was still releasing WALs when an unchanged index was treated as completion. The same case passed alone. Test-only follow-up Itaxh1#4 waits for an empty WAL list with a bounded timeout; all 23 tests then passed together, focused analysis was clean and 14 local preflight checks passed. No runtime change or hardware acceptance is claimed. #20376 must precede this PR.

A pendant muted across a conversation close, or a phone call that
interrupts the mic, resumes on the same socket. The window guard admitted
only record and deviceRecord, so the audio after the resume stayed
unstamped. Skip only a stopped or failed capture.

The scenario tests now wait for the expected WAL state, in memory and in
the saved index, instead of a quiet moment, and fail with the WAL state
if it never arrives.
@Itaxh1

Itaxh1 commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 2, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@Itaxh1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

…ess now

A pendant recording runs on into the next conversation, and the stamp
matches WALs by recording id, so a chunk of the next conversation that
landed while the closing one was still being stamped could be claimed by
it. Both stamps, on a server close and on Process now, now take only the
WALs that start before the close.

Process now resets the session like a server close but never reopened
the window, so the audio after it stayed unstamped while the pendant
kept streaming. It now opens the next window at the close too.
@Itaxh1

Itaxh1 commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 2, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@Itaxh1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

… before releases

The stamp leaves WALs that start at or after the close to the next conversation. A
tail drained with under a second of audio started at the drain's own second, so the
fence could leave it to the next conversation. The close is now read after the drain,
and a sub-second tail starts at least a second before it.

The window scenarios now check that the streamed audio is in a copy before each close,
so a release can't pass on no copies at all. A new scenario shows that a Process now
which made no conversation leaves its audio to the conversation the server kept open:
the next close in the same recording stamps it.
@Itaxh1

Itaxh1 commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 3, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@Itaxh1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

…ALs at the close

- The close state (session start, socket-repair flag, 30 s fallback) was one slot.
  A conversation event that arrived after the next close took that close's state,
  and the later event found none. Closes are now kept by conversation id, and an
  event only finishes its own.
- The stamp fence now takes the WALs that exist right after the close's drain,
  instead of a time cutoff. A sub-second tail keeps its real start and duration,
  and a WAL created after the close stays with the next conversation even when
  its start is backdated.
- Windows opened after the first one get a counter in their capture id, so two
  that open in the same second still name different conversations.
@Itaxh1

Itaxh1 commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 3, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@Itaxh1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

…n between paths

- Two tails drained in the same second get the same Wal.id, so a fence on ids could
  admit a WAL created after the close. The fence now holds the WAL objects that
  existed right after the close's drain.
- Both closing paths drain, fence and take the close time through one helper,
  _drainClosingConversation(), so the two can't drift apart.
- The late-event scenario now checks that c2's copies survive c1's event before
  c2's own event releases them.
@Itaxh1

Itaxh1 commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 3, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@Itaxh1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

…audio goes

A close's WALs include an earlier conversation's that are still unstamped,
under the same recording id. When a close's drain finished first (an empty
tail, or a server close during Process now's request), its stamp claimed
the earlier conversation's audio. Each close now chains its stamp after
the earlier ones, Process now included, and the waiters no longer clear
the chain, so a close during a wait keeps its stamp in later waits.

The phone-mic call scenario now streams resumed audio and checks it goes
out on the same socket while the window opened at the close is active.
@Itaxh1

Itaxh1 commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 3, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@Itaxh1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

…indow

The location snapshot belongs to the recording, but each close cleared it,
so from the second conversation on, the safety WALs carried no location.
A close where capture goes on into the next conversation now keeps it; one
after the user stopped still clears it.

The scenarios' transcript fixture now covers each conversation end to end,
so the release they expect doesn't lean on a coverage slack.
@Itaxh1

Itaxh1 commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 3, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@Itaxh1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@Git-on-my-level

Copy link
Copy Markdown
Member

Reviewed the diff against main at 172f4d6 — this is a well-shaped fix for #20365; the per-close state map, close-ordered stamp chain, and WAL-identity fence are the right design.

Per-file notes:

  • capture_controller.dart — _pendingCloses keyed by conversation id fixes the single-slot _pendingAutoSync* overwrite. The chained, never-cleared _pendingFinalizeAndStamp preserves prepare/stamp single-flight on LocalWalSyncImpl's one _conversationStampWalsAtClose slot (each close's prepare runs only after the previous link's stamp completed, and the Process-now error path still awaits earlierStamps). The activeCaptureSessionId suffix is safe since all in-tree consumers treat it as an opaque per-window id (capture-scenario/v1 contract).
  • local_wal_sync.dart — Set<Wal>.identity() is the correct fence given two tails drained in the same second share a WAL id, and stampConversationId's fence check correctly keeps same-recording WALs backdated before the close with the closer, which the time window alone cannot distinguish. I verified the tail WAL joins _wals synchronously before finalizeCurrentSession's first await, so the walsNow() snapshot holds the close's tail.
  • wal_stamp_fence_test.dart and capture_next_conversation_window_test.dart — good coverage: fence semantics (same-second ids, fence consumed by one stamp only, sub-second tail) and 12 replay scenarios including muted close, Process now, late events, back-to-back closes, call interruption, and stop-opens-no-window.
  • capture_replay_world.dart — the processResponse/locationFix seams are narrowly scoped.
  • changelog entry — accurate user-facing description.

One process note: Dart Analyze & Tests was skipped by path filtering on this head, so the new test files haven't run in CI on 172f4d6 — worth forcing the full app lane before flipping out of draft.

No blocking concerns; leaving for normal maintainer review since this sits in the capture/WAL durability core.


AI-generated maintainer feedback on behalf of the Omi maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added the flutter flutter work label Oct 3, 2026
@Git-on-my-level

Git-on-my-level commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Reviewed the diff at 172f4d6 — the approach looks right, and the tricky invariants hold together. Per-file notes:

  • app/lib/services/capture/capture_controller.dart — _startNextConversationWindow guarded by _captureOutlivesClose (socket alive, state not stop/error) is the correct re-arm condition: paused/interrupted captures that resume on the same socket keep their window, terminal states open nothing. Replacing the single-slot auto-sync fields with the per-conversation _pendingCloses map fixes the late-ConversationEvent clobber, and the never-cleared chained _pendingFinalizeAndStamp (after: linkage) serializes stamps in close order, including the Process-now path whose onError still awaits earlier stamps. The live-<seconds>-<N> suffix is safe — I checked consumers and nothing parses the format, only opaque keys (localSegmentStore.replaceSession, UI ValueKeys).
  • app/lib/services/wals/local_wal_sync.dart — the walsAtClose identity fence is necessary rather than cosmetic: Wal.id is '${device}_$timerStart', so two tails drained in the same second share an id and a time-window reach can't tell them apart; fencing by object identity taken right after the close's drain handles that, including backdated WALs. stampConversationId consuming and clearing the fence in one stamp is the right one-shot semantics.
  • app/test/unit/wal_stamp_fence_test.dart — good coverage of exactly the subtle cases (same-second shared ids, fence one-shot-ness, sub-second tail belongs to the closing conversation).
  • app/test/services/capture/capture_next_conversation_window_test.dart — the replay-world scenarios (muted close, Process-now interleavings, back-to-back closes, same-second windows, phone-mic call interruption) map well onto the failure modes in Flutter transcription: later conversations on one pendant connection never get their backup tagged, so they are re-uploaded as duplicates #20365.
  • app/test/support/capture/capture_replay_world.dart — the added processResponse/locationFix seams are minimal and hermetic.
  • app/changelog/unreleased/20261002-pendant-later-conversations-not-reuploaded.json — accurate, user-facing phrasing that matches the behavior change.

One verification note: since this is a draft, CI skipped the Dart suite, so the new tests haven't run there yet — worth marking ready (or a ci:full run) before merge so the 500+ new test lines actually execute against this head. Also confirmed error containment: failed drains are still awaited via Future.wait, and _deleteWal swallows file errors, so a failed confirm can't poison the next close's stamp chain.

Nice work on the fence design — leaving for maintainer review once it's out of draft.

@Itaxh1 Itaxh1 closed this Oct 4, 2026
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Hey @Itaxh1 👋

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:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

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!

aryanorastar added a commit that referenced this pull request Nov 22, 2026
…#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.
Git-on-my-level pushed a commit to Git-on-my-level/omi that referenced this pull request Nov 22, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flutter flutter work

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

3 participants