Skip to content

Handle batch discard and restore without losing recording obligations #24110

Open

Description

@Git-on-my-level

A successfully persisted relevance discard on a batch_live_v1 capture currently makes register_recording return False. The strict finalizer gate retries with a registration failure before reaching the existing terminal fanout fence. This causes bounded retry churn; the strict behavior preserves the audio obligation.

Fix this with a restore-aware authoritative fence. A prototype that skips registration based on the returned model's discarded state is unsafe: a user can restore the durable row before claim_finalization_fanout reads it. Restore sets discarded=False without changing the finalization binding, so the claim can admit the restored completed row and terminalize fanout without its deterministic record_pending audio job. A separate read before claiming does not close that race.

The correction must preserve all of these outcomes:

  • An intentional discard reaches a terminal no-fanout outcome without registration retry churn.
  • A restore before the fanout transaction cannot admit kept-capture fanout without retaining its canonical audio job; changed state must retry or atomically retain the obligation.
  • A processing revival uses the current kept state, rather than the stale initial discarded snapshot.
  • Silent backfill retains its existing processing fence; real/unknown audio obligations remain strict.
  • Privacy/deletion fences and finalization revision/lease ownership still apply.

Reproduction tests in commit 75babcd603199c168a8cf6a121624494b772c4fb cover newly persisted discard, stale-snapshot revival and silent discard. Before the prototype they produced two failures and one passing revival control. The prototype passes those cases but misses the concurrent restore race; add a real Firestore transaction race regression before implementing the eventual correction. The prototype was explicitly reverted under lead ruling f498ab and is not part of the final PR tree.

Evidence: PR #24104; Luna R5 identified the restore race. Code boundaries: backend/utils/conversations/finalizer.py, backend/database/conversations.py::restore_conversation_from_discarded, and backend/database/conversation_finalization_jobs.py::_claim_finalization_fanout_txn.

Owner: rollout lead to assign the restore-aware follow-up. Next: by 2026-10-30 18:00 UTC, assign an implementation owner and a dated regression/fix plan, or renew the promise with evidence. Tracked under the C1 step of card:two-lane-transcription-local-bench-quality-to-all-users.

Activity

  1. moved this from Someday to In progress in omi TODO / bountieson Oct 30, 2026
  2. Dimank92 commented on Oct 30, 2026

    @Dimank92
    Contributor

    I have resolved this issue in PR #24119 with the restore-aware authoritative fence in finalizer, lifecycle, and cfj transaction logic, along with full test coverage (90/90 tests passing).

    Payout wallet (USDC Base / Polygon / Arbitrum / Stellar):
    0xC345C07229307d4f1c7935aD2cAe48e390215808

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions