Skip to content

feat(conversations-v3): per-owner live re-derive for fragmented live windows - #25817

Merged
Git-on-my-level merged 35 commits into
mainfrom
lane/v3-live-rederive
Nov 20, 2026
Merged

Git-on-my-level merged 35 commits into
mainfrom
lane/v3-live-rederive

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

What

backend/scripts/conversations_v3_backfill.py run --mode rederive-live replans one owner's finished live v3 windows in one [since, until) window from their source recordings with the current planner (#25764 manual cuts and exclusive claims, #25786 stretch cohesion), and commits the result. Until now the repair tool could only re-derive legacy donors (derive) and rows a backfill had made (rederive). Finished live windows are kept as they are by planner.preserve_finished_windows, so the fragments built before those fixes (a lunch tail of ~18 tiny visible manual_end cards, ~66 hidden below_word_minimum topic pieces on 11-19) stay fragmented.

It runs as an ordinary backfill run: same ledger, start marker, queue, backfill-builder lease, outline and notes path, status, resume and undo. CONVERSATIONS_V3_BACKFILL=off still stops all of it.

DESIGN:

Reads and writes per owner-day. Sized against one real owner-day (2026-11-19 UTC, ro-prod metadata-only runQuery, counts only): 503 documents started that day (203 sources, 244 v3 rows: 86 visible and 158 hidden; 56 deleted or merged).

  • Dry-run: one metadata read of the window (503 reads), then per partition (≤192 documents planned, ≤256 loaded) the started_at range read plus by-id reads of sources and rows named by claims outside the range, plus one lease read. About 1,000 reads. No writes, no model calls.

  • Run: the same loader reads (~550). Each commit batch's transaction reads its sources and the rows it writes or retires, plus a tombstone per written row (~400–700). It writes:

    • the rebuilt and created rows;
    • a 5-field retire patch per absorbed row;
    • a claims-only update per affected source;
    • one prior document per changed, created or retired row;
    • about 10 ledger updates per partition.

    For the sized day that is at most ~700 writes, and fewer when windows are unchanged, because an unchanged window gets no write.

  • Priors: each partition reads its own copies by id twice, before its commit and when it settles (at most 256 each). resume and undo list the run's copies once (pages of 200). So prior reads grow linearly with the run, not with partitions times copies.

  • Undo: lists priors (pages of 200), reads each row, its tombstone and its sources once per group, and writes each restored row and source once.

LLM cost. One outline call per stretch in the partition (cache hits are free), then notes only for windows that changed. Unchanged windows keep their row and their notes. The dry-run prices this at the gateway Luna card, the same as the backfill estimate: outline per stretch, plus notes, agentic notes or tasks-only by word count for every window after. By that card an owner-day plans at well under $1 (a planning estimate; gateway usage has the actual spend). The coordinator reads the exact number from the dry-run before running.

Custody.

  • Adoption. A rebuilt window keeps the id of the earliest row it absorbs (service._match). A rebuilt window whose speech, bounds, claims and Home decision equal the stored row is not written, so its notes do not re-run.
  • Retire. Every other absorbed row becomes a sync bridge to its survivor: deleted, discarded, a cleared summary_due_at, sync_merged_into, v3_claims_transferred_to, a bumped sync_content_revision and v3_derived=false. That is the patch a sync merge gives its absorbed rows, so deleting a bridge later releases none of the survivor's claims. The survivor lists its bridges in sync_merged_from, so deleting it purges them, as with a sync merge. That list lands in the final commit batch together with the retirements, so it never names a row that is still live. Nothing is hard-deleted, subcollections stay, and reads by id follow the bridge. Dropping v3_derived keeps every v3 planner read (claims closure, time queries, adoption) from treating it as a user deletion. Its claims leave the sources in the same commit that writes the survivor, so no claim is orphaned and claims stay deduplicated. Audio pieces come from the planner's exclusive claims, so no audio is duplicated.
  • No derived effects. Rebuilt rows are stamped backfilled and v3_rederive_live_run. Their notes take no memories, tasks, webhooks, notifications or created fanout, and they use the backfill's own notes marker.
  • Never touched. These are offered to the planner as published finished rows, so their lines, claims and audio stay theirs. They are never written, and the ledger counts each one:
    • open windows, and every source an open window holds;
    • rows overlapping since or until;
    • deleted rows, because until their claims are released those claims still fence their speech;
    • rows with app results: the owner can edit those with no marker, and a replan never regenerates them;
    • rows whose summary the owner rewrote. The summary endpoint deletes the generated sections, so a card with notes, an overview and no sections counts as edited, which is the rule refinement already applies;
    • edited rows (user title, overview or corrections, transcript corrections, speaker assignments, star, folder, photos, kept-by-user, absorbed by a merge);
    • locked, shared, private, discarded, deleted, unreadable, legacy-backfilled, notes-pending and transcribing rows;
    • rows on sources that are pending, unsealed, transcribing, failed, purge-pending, private, deleted or legacy donors;
    • rows on a source whose stored document plus a few more claims would pass the 1 MB document limit (sources_blocked_size_limit, the SCA-2791 shape). The dry-run reports this per partition before any write.
  • No audio purge. The commit for a live re-derive writes only claims on its sources, so it never arms or cancels an audio purge.
  • Speech coverage. The pass blocks (rederive_live_coverage) and writes nothing if any segment an eligible row held would not be in a rebuilt or protected row.
  • Fail-closed blocks. rederive_live_open covers speech within five minutes of now, and is checked before any paid call. rederive_live_boundary covers a window that would cross since or until. rederive_live_outline_failed means a repair never commits fallback failed tiles. document_too_large means a source's claims would grow past the limit or a prior is too large to record, and is checked before any write.
  • Partial failure. Priors are written before the first commit batch, and the run's own rows are recognised on a resume. So a commit that fails after some batches can be resumed to finish, or undone exactly. Retirement happens only in the final batch, so nothing is hidden before its survivor exists.
  • Undo. Before each commit, the run writes every changed, created or retired row's stored document and its claims with their list positions to conversations_v3_backfill_runs/{run_id}/conversations_v3_rederive_priors. That collection sits under the owner, so account deletion purges it, and it has a budget in .github/firestore-collection-budgets.json.
    • No copy outlives what it copies. Priors are never written for a conversation already deleted, or once account deletion began. Deleting a conversation a run stamped empties its priors and its bridges' priors to a purged stub, in every live run of the owner, before anything else. Every copy belongs to a row a run stamped after the copy was made, because a commit that fails for any reason drops the copies of rows it did not write, and a resume records them again. Each partition's attempt first drops the run's copies of the rows it loads that no run stamped since, and resume and undo do so for every copy of the run, which covers a process that stopped between recording a copy and stamping its row. Undo never restores such a row, so these copies would only ever be retained content. So the stamp-gated deletion path always reaches a copy. After a protection migration has written its rows and photos, it empties the copies of every stamped row it reached that were stored at another level. It records those rows on every attempt, so a retry after a failed purge purges again. The commit also checks the tombstones of the rows it retires, so a row the owner deletes before its retirement fails the commit. A run with a stub refuses undo as a whole rather than restoring around it. Rows no run touched pay nothing. A finished undo deletes the run's priors.
    • Undo takes both builder leases and waits for in-flight notes.
    • It restores each group of rows that share a source in one transaction: documents back exactly and each source's claim list back in its original order. A row the run created is hidden in that transaction, then erased with the conversation deletion helper, so its child collections go too.
    • It refuses after the owner deleted a rebuilt row (owner_deleted_rebuilt_row), or while a newer live run restamped one (undo_newer_run_first). It also refuses after the owner changed a row the run wrote, created or retired (owner_edited_rebuilt_row). Once a partition settles its notes, the run records a digest of each row's owner surface: title, overview, edit fields, star, folder, photos, visibility, lock, deletion and merge. Undo compares against that digest. Before the digest exists, it checks the edit fields, visibility, lock and any merge against the stored prior. A row the owner changed before its partition settled gets a baseline that never matches. A retired row must still be the run's bridge to its survivor. It checks every prior before restoring any group, and each group's transaction checks again.
    • An interrupted undo is rerun as is. Rows it already restored, and created rows it already hid (v3_rederive_live_undone), are finished, not refused. That holds when they carry an earlier run's stamp, too.
    • Restored rows pass through the recurring-voice fence the commit uses, so a voice link the owner revoked is never written back.
    • Undo refuses when a source named by the run is gone (undo_source_missing). It checks every source of every group before restoring the first group.
    • A copy is never recorded at a protection level its row has left: save_priors reads each row's level in its transaction.
    • A resumed attempt keeps the first copy of a row, so claim positions are the ones from before the run.
    • Undo refuses once account deletion began (account_deletion). Before restoring anything, it refuses a group of rows sharing sources that is too large for one transaction (undo_group_too_large: more than the write cap or 8 MB).
    • The test compares every conversation document before the run with after undo, byte for byte. In production, the Firestore commit hook also stamps home_source_version and home_content_invalidated on every conversation write. So a restore is exact apart from those two fields, and the rerun check ignores them.

Production number that proves it. After deploy, the coordinator runs the dry-run on the named owner's 11-19 and then the run. The readback is the run ledger's windows_after, visible_after, rows_retired and outline_calls, taken against the dry-run's before counts. For the lunch tail and the 08:16–12:56Z stretch, the target is visible finished v3 windows shorter than 30 s per active source-hour going from the 2.538/h lunch baseline to near 0, with 0 same-file duplicate pairs.

Not in scope / known limits

  • 34 of the sized day's sources are stuck in_progress for hours. They count as unsealed, so rows on them stay protected and the dry-run reports them as sources_blocked_unsealed.
  • A late live speech append to a rebuilt row after the run is replaced by the restored document on undo. The runbook states this.
  • Before a partition settles, the run's own notes (process_conversation) may discard a rebuilt card or add app results to it. So an owner discard or app run on that card during the notes drain cannot be told apart from the run's output, and undo before settle can restore over it. After settle, the baseline digest covers both. The runbook says to undo only settled runs.
  • Dry-run "after" counts outline each stretch as one chapter, so windows_after is the fewest windows the run can produce and rows_retired_est (eligible rows minus the windows that adopt one) the most it is expected to retire. The run ledger has the exact counts.
  • A partition whose final commit would exceed the transaction write cap (sources + retired rows + row + lease over 450) blocks as backfill_partition_budget before any write.

Verification

Unit tests at the code layer only. Nothing ran against the emulator or production.

  • New tests/unit/test_conversations_v3_live_rederive.py has 58 tests, plus two deletion wiring tests in test_merge_conversations_canonical_delete.py. They run the real loader, planner, commit transaction and undo transaction on the strict in-memory Firestore:
    • the fragmented lunch folds into one card that keeps the earliest id;
    • hidden topic pieces of one stretch become one visible card;
    • a second pass over its own result writes nothing;
    • open windows and rows past until stay byte-identical;
    • edited and locked rows are skipped and keep their speech;
    • unsettled speech refuses before a paid call;
    • lost speech blocks the pass;
    • undo restores every row and claim exactly, and a rerun of undo is idempotent;
    • undo refuses after an owner deletion, an owner edit (title, star, photos) of a rebuilt or created row, a summary edit or merge after baselines, a merge before baselines, or a newer run;
    • an over-cap partition, a window crossing until, an oversized prior and claims growth past the document limit each block before any write;
    • a source already near the document limit is reported by the dry-run and left alone;
    • a commit that fails after its first batch leaves the absorbed rows untouched, resumes to the full result, and undoes byte for byte;
    • an undo interrupted before erasing a created row finishes on rerun, and an undo of a later run over an earlier run's rows can be rerun, then the earlier run undone;
    • an owner star before the partition settles is never taken as the baseline;
    • priors are never written once account deletion began, or for a conversation the owner deleted, and deleting a rebuilt conversation purges its priors and its bridges' priors;
    • undo refuses once account deletion began, and refuses a group too large for one transaction before restoring any;
    • the survivor lists its bridges in sync_merged_from, and the dry-run reports unclaimed live speech and windows that would cross the edge;
    • a deleted row whose claims are not yet released still fences its speech;
    • a card whose summary the owner rewrote is left alone, and undo refuses after a summary rewrite made before baselines;
    • deleting a retired bridge releases none of the survivor's claims, and undo refuses when a named source is gone;
    • a resumed attempt keeps the first copy of a row; a failed commit keeps no copy of a row it did not write; a protection migration empties a re-derived row's copies only after re-protecting it;
    • a row deleted before its retirement fails the commit, and a card with app results is left alone;
    • a failed commit empties the copies of rows changed meanwhile;
    • undo applies the recurring-voice fence;
    • the run ledger counts unclaimed speech, and in a partial commit the survivor does not list its bridges yet;
    • a deleted or re-protected conversation keeps no undo copy and undo refuses, a protection migration empties copies of stamped rows first, and a restored row is recognised despite the commit hook's stamps;
    • the dry-run preview counts before and after and writes nothing;
    • the operator dry-run prints no uid and refuses the live edge.
  • Main was merged in again (feat(conversations-v3): cut at sit-downs when the silence gap is over five minutes #25829 settle-on-landing stretches; the live path keeps default timing). All test_conversations_v3_* files pass, as do every test file that imports merge_conversations or exercises migrate_conversations_level_batch. Two migration fakes gained to_dict, which real snapshots have. The Firestore query-shape, outside-query, index-oracle, runtime-witness and lifecycle-writer guards pass, as do check_conversation_lifecycle_writes.py and check_conversation_readers.py. GitHub's backend unit shards have failed only on 1-second per-test timing guards in files this PR does not touch (test_live_recap_telemetry, test_monitoring_adapter_hpa_contract). The recap test runs in 0.5 s locally; reruns were requested.

Review

Panel review-20261119t194708-ded2 on 10ce159: FIX-FIRST. Luna and GLM Flash completed; DeepSeek failed with an empty result. Triage:

  • F1 (blocking) accept: undo now refuses when the owner edited a row the run wrote or created. There are regressions for title, star and photos on both kinds of row.
  • F2 (blocking) accept: a created row is erased through database.conversations.delete_conversation, which also deletes its children, after the transaction hides it and drops its claims.
  • F3 (major) accept: the write cap is checked before priors or commit. Regression test added.
  • F4 (nit) accept: renamed and recomputed as rows_retired_est.

Panel review-20261119t202258-de84 on 8b07afc: FIX-FIRST. Luna and GLM Flash completed; DeepSeek timed out. Triage:

  • F1 (blocking) accept: a settled partition records an owner-surface digest per row (title, overview, edit fields, visibility, lock, deletion, merge), and undo refuses when it changed. There is a regression for a summary edit.
  • F2 (major) accept: a rebuilt row merged away after the run refuses undo, both before and after baselines, and a retired row must still be the run's bridge to its survivor. Regressions added.
  • F3 (minor) accept: an oversized prior blocks as document_too_large before any write. Regression added.
  • F4 (minor) partly accept: added the rederive_live_boundary block test and a multi-batch commit test showing retirement only in the final batch. Not added: the moved-source path, which live sources never take, because speech_moved is false for them and any concurrent change fails the revision fence as source_changed.
  • F5 (minor) reject: retired rows lie inside their survivor's span, and the smart-merge barrier gap begins at the survivor's finished_at, so they never sit in a later merge's gap. Writing smart-merge donor lineage would forge a merge ledger that no merge wrote.

Panel review-20261119t210824-f141 on 7a6d35b was invalid: an early omi-panel collect removed its checkout while members ran. Its one finding (checkout missing) was rejected and the panel rerun.

Panel review-20261119t212417-ad5e on 7a6d35b: FIX-FIRST. Luna and GLM Flash completed; DeepSeek timed out. Triage:

  • F1 (blocking) accept: save_priors reads the account-deletion marker in each transaction and refuses (account_deletion). Regression added.
  • F2 (major) accept: record_baselines first checks the row against its prior. A row the owner changed before the settle gets a baseline that never matches. Regression added.
  • F3 (major) accept: a row equal to its prior is already restored, whatever stamp it carries, so a rerun is not undo_newer_run_first. Regression added for run-over-run.
  • F4 (major) and F7 (minor) accept: the undo's hide stamps v3_rederive_live_undone, and a rerun erases such rows instead of refusing. Regression added.
  • F5 (minor) reject, and the case is now reported: recording=True without v3_backfill_run is written only by v3 capture. Legacy conversations are not recordings, so they are never loaded as sources, and converted donors are blocked as backfill_donor. A sealed recording no window claims is live speech the builder lost, and making it a card with no derived effects is the repair. The dry-run now reports it as sources_unclaimed, so the operator sees it first.
  • F6 (minor) reject: before a partition settles, structured, apps_results and folder are being rewritten by the run's own notes pass, so they cannot be compared with the prior. F2's fix closes the gap up to the settle. A partition that never settles is resumed, not left half done.
  • F8 (nit) partly accept: added a classify_live_window count test. The source_changed fence for live sources is the existing revision fence in commit_projection, which its own suite covers.

Merged origin/main (#25817 had become conflicted). Main's claim transfer (_v3_absorbed) and custom boundary timing combine with this change. Live re-derive runs with derive timing, so the custom timing paths are off for it.

Panel review-20261119t220910-1af6 on eeb6bda: FIX-FIRST. Luna and GLM Flash completed; DeepSeek failed with an empty result. Triage:

  • F1 (blocking) accept: priors are purged when a stamped conversation is deleted, along with its bridges' priors, in every live run of the owner. A finished undo drops the run's priors. save_priors refuses a conversation already tombstoned. Regressions added, including the deletion wiring.
  • F2 (blocking) accept: each undo transaction reads the account-deletion marker and refuses. Regression added.
  • F3 (blocking) accept: the survivor's sync_merged_from lists its bridges, so deleting the survivor purges them through the existing sync-bridge path. Undo restores the survivor's prior document, and with it the prior list. This also gives smart merge the lineage that the de84 F5 finding asked about.
  • F4 (major) accept: the estimate copies every sources_ count, so sources_unclaimed reaches the preview. Regression added.
  • F5 (major) accept: undo checks every group's writes and bytes against one transaction before restoring any, and refuses with undo_group_too_large rather than failing midway. Regression added.

Panel review-20261119t225938-d579 on 7d8cfcc: FIX-FIRST. Luna and GLM Flash completed; DeepSeek failed with an empty result. Triage:

  • F1 (blocking) accept: a protection-level migration of a stamped row first empties its priors to a purged stub, so no copy stays at the old level. Regression added, including the migration wiring.
  • F2 (blocking) and F4 (minor) accept: the purge pages through every run ledger by id, with no 200-run cap.
  • F3 (blocking) accept: data_protection_level is in the owner surface and in the check before baselines. Regression added. A purged stub refuses the whole undo, so a migrated row is never restored around.
  • F5 (minor) accept: the rerun check compares rows apart from the commit hook's stamp fields, and the PR states that a restore is exact apart from those two fields. Regression added.
  • F6 (nit) accept: the dry-run reports windows_crossing_edge. Regression added.

Panel review-20261119t235010-7c85 on 49d66c9: FIX-FIRST. All three members completed. Triage:

  • F1 (blocking) accept: when the commit fails after the copies were written, the copies of rows the owner deleted or re-protected in that gap are emptied to stubs. The commit's revision fence makes any such change fail the commit, so the gap is always caught there. Regression added.
  • F2 (blocking) accept: the survivor's sync_merged_from is staged with the retirements and lands only in the final batch. Regression added: in a partial commit the survivor lists nothing.
  • F3 (major) accept: deleted rows are offered as protected finished rows, so their unreleased claims fence the replan (protected_deleted). Regression added.
  • F4 (minor) reject: the purge runs only for rows a live run stamped, and only over that owner's live runs, which are operator runs counted in single digits per day. Undo already refuses on the tombstone, so deferring the purge would only keep the copy longer.
  • F5 (minor) accept: the group size counts each prior's claims and up to 64 KB per source claims list.
  • F6 (minor) accept: restored rows go through filter_processing_write inside the undo transaction. Regression added.
  • F7 (minor) reject: a source's claims are a set keyed by conversation and span, and no reader depends on their list order. Exactness is tested when nothing else moved. When another row's claims moved meanwhile, the restored set is still exact.
  • F8 (minor) accept: both regressions added (partial-commit survivor and the run ledger's sources_unclaimed).
  • F9 (minor) reject: an owner-day is 1–3 partitions of at most about 250 priors, so re-listing costs under 1,000 reads per run, against the commit's own writes of about 700.
  • F10 (minor) accept: a live run keeps the loader's sources_unclaimed. Regression added.
  • F11 (minor) reject: the re-derive repairs window boundaries. Rewriting every row whose stored status or tile differs would re-run notes for windows that did not change, which the brief excludes. Stuck notes belong to the summary repair path.

Panel review-20261120t002457-a83a on 36e529d: FIX-FIRST. All three members completed. CI on 36e529d was green. Triage:

  • F1 and F2 (blocking) accept: a card with notes, an overview and no generated sections counts as owner-edited. It is protected, and before baselines undo refuses it. This is the convention main's refinement uses, because the summary endpoint writes no separate marker. App-result edits have no marker at all, so they are caught only once baselines exist.
  • F3 (blocking) and F8 (minor) accept: the retire patch now carries v3_claims_transferred_to and a bumped sync_content_revision, as a sync merge's absorbed row does. Regression added.
  • F4 (major) accept: the migration empties only the copies of rows it actually re-protects. Regression added.
  • F5 (minor) accept: undo refuses (undo_source_missing) before writing anything. Regression added.
  • F6 (minor) accept: regression added for deleting a bridge.
  • F7 (minor) reject: classify_live_window tests deleted and sync_merged_into first, so every bridge the run writes counts as deleted. No path clears deleted on a bridge.
  • F9 (nit) accept: save_priors keeps an existing copy, so a resumed attempt records nothing over the first. Regression added.

Panel review-20261120t010840-047f on c3c99c5: FIX-FIRST. Only Luna completed; DeepSeek returned an empty result and GLM Flash timed out. CI on c3c99c5 was green. Triage:

  • F1 (blocking) accept: save_priors reads each row's current protection level in its transaction and refuses (source_changed) a copy at a level the row has left. The migration also empties the copy of any row a live run stamped after the migration's snapshot. Regression added for the fence.
  • F2 (major) accept: the undo pre-check reads every source of every group before the first group restores. Regression added with two groups.

Panel review-20261120t014903-c9eb on 4de3684: FIX-FIRST. Luna and GLM Flash completed; DeepSeek returned an empty result. CI on 4de3684 was green. Triage:

  • F1 (blocking) and F7 (nit) accept: the migration empties copies only after it re-protects a row, for every row stamped at that moment. Nothing is purged before, so a failed migration leaves undo intact. Regression added.
  • F2 (blocking) accept: the commit checks tombstones for the rows it retires. Regression added. The deletion-path half is closed by the invariant under F5.
  • F3 (major) and F5 (major) accept: every copy now belongs to a row its run stamped, because a failed commit drops the copies of rows it did not write. That means the stamp-gated deletion and migration paths reach every copy, and a resume records fresh copies under the level fence. Regressions added.
  • F4 (major) accept: rows with app results are protected (protected_app_results). The owner can edit those with no marker, and a replan never regenerates them. The dry-run counts them. Regression added.
  • F6 (minor) reject in code, and documented instead: a capture longer than one partition makes both partitions' windows cross the edge. The dry-run already reports this as windows_crossing_edge before any write, and the operator widens since/until or leaves that capture alone. Clipping a capture's lines to the partition would split one conversation in two, which is the fragmentation this tool removes.

Panel review-20261120t023041-3445 on cac9f55: FIX-FIRST. Only Luna completed; DeepSeek and GLM Flash timed out. CI on cac9f55 was green. Triage:

  • F1 (blocking) accept: the migration purges after its rows and photos are written, and records re-derived rows on every attempt. So a retry purges even when the row is already at the target level. Copies already at the target level, and copies of created rows, are kept. Regressions added.
  • F2 (blocking) reject: a copy exists only for a row that passed protection, and protection refuses any row with a set owner field (star, folder, photos, user title or overview, and so on). So a prior's owner fields are always unset, and clearing one cannot differ from the prior. Setting one is caught. After settle, the baseline digest compares by equality.
  • F3 (blocking) accept: the cleanup that drops unwritten copies runs for every failure, not only Conflict. If the cleanup itself fails, the partition stays unfinished until resume or undo. Regression added.

Panel review-20261120t031408-74ad on b8b9a68: FIX-FIRST. Only Luna answered; DeepSeek returned an empty result and GLM Flash an invalid one. Triage:

  • F1 (blocking) accept, closed from the run side: each attempt and each undo first drops the run's copies of rows no run stamped since the copy, which covers a hard stop between recording a copy and stamping its row. A row a newer run restamped keeps its copy, so undo still waits for that run. Regression added. Not taken: purging on every deletion regardless of stamp. That broke five deletion test suites built on fake clients, and it would add a run-ledger read to every product deletion.

Panel review-20261120t035349-fb30 on 2684b6f: FIX-FIRST. Luna and GLM Flash completed; DeepSeek returned an empty result. CI on 2684b6f was green (68 checks, after rerunning one shard whose git checkout hit an early EOF). Triage:

  • F1 (major) accept: each partition reads only its own copies, by id, before its commit and when it settles. The settle step gets the ids from the partition ledger (prior_ids). The full scan for stale copies runs once per resume and once per undo. The budget entry states this. Regression added: a partition run with list_priors made to fail.
  • F2 (major) reject: a retired bridge is deleted, and the migration skips deleted rows, as it does every sync-merge bridge on main. So the bridge document itself stays at the old level with the same content as its copy, and the copy exposes nothing the bridge does not. The copy cannot be restored either: re-protecting the survivor changes its owner-surface data_protection_level, so undo refuses the run (owner_edited_rebuilt_row).
  • F3 (minor) accept as documented: a run whose undo refuses for good keeps its copies until the owner deletes the touched conversations or the account. The runbook says so, and says the copies are dropped by hand only with the owner's approval, since that gives up the undo. No release command was added, so priors are never dropped as a side effect.
  • F4 (nit) reject: as designed and documented. Whether a window crosses an edge depends on the outline's windows. The dry-run reports windows_crossing_edge before any paid call, so the operator widens the window first.
  • F5 (nit) accept: the loader's range overflow now blocks as rederive_live_range_overflow, and backfill_partition_budget means only the final-commit write cap. Regression added; runbook updated.

That push (c5aadce) failed the lifecycle payload inventory: a new field on the pinned 'notes' partition payload. Fixed in f20d08a: the settle step takes the ids from a local. CI on f20d08a was green (64 checks).

Panel review-20261120t044101-1ca3 on c5aadce: FIX-FIRST. All three members completed. Triage:

  • F1 (blocking) and F5 (minor) reject, documented as a known limit: process_conversation, which the run's own notes use, writes both discarded and apps_results. So before a partition settles, a difference from the prior can be the run's output. Refusing on it would turn every such row's baseline into CHANGED_BEFORE_SETTLE and make the run permanently un-undoable. Rows that were discarded or had app results before the run are protected and never touched. After settle, the digest compares both. The gap is the notes drain of a just-rebuilt card, and the runbook says to undo only settled runs.
  • F2 (major) reject: only deleting a row a live run stamped reaches _live_run_ids. That reads the owner's run documents once each, and an owner holds a handful of operator runs. A mode filter would add a query shape and an index for no measurable saving.
  • F3 (major) accept: prior_ids is now every row the partition writes or retires. So a resumed partition's settle step also baselines the rows the failed attempt already wrote. The regression fails without the fix.
  • F4 (minor) reject: this is intentional (panel 3445 F1). A retry after a failed purge must purge even when the row is already at the target level. keep_level makes that purge write nothing for copies already at the level, and only rows a live run stamped pay its reads.
  • F6 (minor) reject: the test already pins rows_unchanged, rows_retired and priors_recorded, and asserts that no later transaction sets, updates or deletes a conversation.
  • F7 (minor) accept: the retire patch clears summary_due_at, as main's absorbed-row patch does. The site is declared in the lifecycle writer inventory. Regression added.
  • F8 (minor) reject: the branch is reachable. An eligible row with no spoken segments adds nothing to the coverage set, and when no rebuilt window overlaps it, it stays as it is (rows_kept_unabsorbed). A row with speech that no window holds blocks the pass by design.
    Failure-Class: FC-irreversible-terminal-hide

Line-Count-Exception: backend/database/conversations.py | 5307 -> 5341 | Protection migration purges old-level repair priors, and the owner writers and processing transaction preserve embedded task and calendar edits.
Line-Count-Exception: backend/database/action_items.py | 2182 -> 2224 | The action-item create transactions own the source recheck that fences linked tasks against repair undo.

Product invariants affected

none

🤖 Generated with Claude Code

…windows

Adds `--mode rederive-live` to the per-owner v3 repair tool. For one owner and
one [since, until) window it replans finished live v3 windows from their sealed
source recordings with the current planner, keeps the earliest absorbed id,
retires absorbed rows as sync bridges, and records exact priors for undo.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 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-20T19:53:38.754726Z afcf348 New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 10ce159f1b

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

page.append(entry)
size += amount

@firestore.transactional

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Purge undo priors when their conversation content is deleted

After a live re-derive, deleting a rebuilt conversation leaves its original transcript and notes in this new sibling collection. The deletion path in routers/conversations.py::_delete_conversation_under_gate and database/conversations.py::delete_conversation removes primary content and known sibling evidence, but a repository-wide search for conversations_v3_rederive_priors and its accessors finds no deletion integration. Consequently, inline encrypted content in entry['raw'] remains recoverable with the owner's key even after conversation erasure succeeds; refusing undo on a tombstone does not erase this copy. Add these priors to the conversation-erasure lifecycle, including copies belonging to absorbed rows.

Useful? React with 👍 / 👎.

tx.delete(coll.document(entry['id']))
removed += 1
else:
tx.set(coll.document(entry['id']), entry['raw'])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Protect post-rebuild owner edits before restoring a prior

If the owner edits a rebuilt conversation before the operator undoes the run, this full-document replacement silently discards those edits. For example, database/conversations.py::update_conversation_title updates user_title and structured.title without clearing v3_rederive_live_run, so the row still passes the run-stamp check and its new title is overwritten by the old snapshot. The same problem applies to owner corrections and other mutations that retain the stamp. Refuse undo when owner-managed state has changed since the rebuild, or explicitly preserve that state rather than treating the run stamp as proof that the document is unchanged.

Useful? React with 👍 / 👎.

}


def load_live_rederive(uid, *, since, until, run_id, firestore_client=None):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add the required conversation-lifecycle change note

This commit introduces a new lifecycle operation that rebuilds, retires, and restores live conversations, but its changed-file list contains no note under backend/docs/listen_pusher_pipeline/changes/. backend/AGENTS.md explicitly requires a note in that directory for conversation-lifecycle changes; the runbook update does not satisfy that separate requirement. Add a change note covering the repair behavior, rollout/flag state, and verification evidence.

AGENTS.md reference: backend/AGENTS.md:L164-L164

Useful? React with 👍 / 👎.

Comment on lines +243 to +245
stamp = (snapshot.to_dict() or {}).get('v3_rederive_live_run') if snapshot.exists else None
if stamp not in (None, run_id):
return 'undo_newer_run_first'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Recognize already-restored priors when resuming an undo

If run B rebuilds rows previously rebuilt by run A, undoing B restores their original v3_rederive_live_run='A' stamps. Since undo_live_run restores source-connected groups in separate transactions, an interruption after the first group leaves those restored rows alongside groups still stamped B. Retrying undo B then rejects the restored A stamps here as undo_newer_run_first, so the remaining groups cannot be restored; the transactional check in undo_live_rederive has the same problem. Distinguish already-restored priors from genuinely newer runs, for example by recording group completion atomically with restoration.

Useful? React with 👍 / 👎.

Git-on-my-level and others added 8 commits November 20, 2026 03:16
…es created rows fully

Panel review-20261119t194708-ded2 on 10ce159:
- F1: undo refuses (owner_edited_rebuilt_row) when the owner edited, shared,
  locked or added photos to a row the run wrote or created.
- F2: a created row is hidden in the undo transaction, then erased with the
  conversation deletion helper so its child collections go too.
- F3: a partition whose final batch would exceed the transaction write cap
  blocks (backfill_partition_budget) before any write.
- F4: the dry-run reports rows_retired_est (eligible rows minus windows that
  adopt one) instead of a mislabelled upper bound.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…esumes partial commits

- A source whose stored document is within a claims update of Firestore's
  1 MiB limit is blocked as size_limit: its rows stay untouched and the
  dry-run reports it up front (SCA-2791 shape). A planned claims list that
  would grow a committed source past the limit blocks the partition as
  document_too_large before priors or commit.
- A resumed partition after a mid-commit failure replans the rows the run
  already wrote (their own notes marker no longer protects them), so the
  absorbed rows still retire; undo is exact from the partial and resumed states.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…baseline

Undo of a live re-derive now refuses when the owner changed a row the run
wrote, created or retired after the run: a settled partition records a
digest of each row's owner surface (title, overview, edit fields, star,
folder, photos, visibility, lock, deletion, merge), and a retired row must
still be the run's bridge to its survivor. A post-run merge of a rebuilt
row also refuses before baselines exist. A prior too large to record
blocks as document_too_large before any write.

Adds regressions for a summary edit or merge after baselines, a merge
before baselines, a window crossing until, an oversized prior, retirement
only in the final commit batch, and run_step recording baselines.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…honour account deletion

An interrupted undo of a live re-derive can now be rerun: rows it already
restored (even ones carrying an earlier run's stamp) and created rows it
already hid (stamped v3_rederive_live_undone) are finished instead of
refused as a newer run or an owner edit. Priors are written in
transactions fenced on the account-deletion marker. A row the owner
changed before its partition settled gets a baseline that never matches,
so undo keeps refusing it. The dry-run reports sealed live sources no
window claimed (sources_unclaimed).

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolves conflicts with the claim transfer (absorbed donors) in
commit_projection and the custom boundary timing in reconcile.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… lists bridges on survivors

The survivor of a live re-derive lists the rows it retired in
sync_merged_from, so deleting it purges its bridges through the existing
sync-bridge path. Deleting a conversation a run stamped deletes its undo
priors (and its bridges') from every live run of the owner first; a
finished undo drops the run's priors; priors are never written for a
conversation already tombstoned. Undo refuses once account deletion
began, and refuses a group too large for one transaction before
restoring any. The dry-run preview now carries sources_unclaimed.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… or protection change

Deleting a stamped conversation, or migrating its protection level, now
empties its undo priors (and its bridges') to a purged stub in every live
run of the owner, paging through all run ledgers. A run holding a stub
refuses undo as a whole. data_protection_level is part of the owner
surface. The rerun check ignores the commit hook's home feed stamps.
The dry-run reports windows that would cross the partition edge.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s deleted rows

The survivor's sync_merged_from now lands in the final commit batch with
the retirements, so a partial commit never lists still-live rows. Deleted
rows are offered as protected finished rows so their unreleased claims
fence the replan. A failed commit empties the copies of rows the owner
deleted or re-protected after they were recorded. Undo re-applies the
recurring-voice fence to restored rows and counts claims in the group
size. A live run's ledger keeps the loader's sources_unclaimed.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 36e529d42b

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +75 to +76
if any(raw.get(field) for field in OWNER_EDIT_FIELDS):
return 'edited'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve owner-edited summaries when selecting rows to rebuild

If an owner edits a live conversation's summary before this repair runs, database/conversations.py::update_conversation_summary writes structured.overview and removes structured.sections, but does not set user_overview or another field in OWNER_EDIT_FIELDS. This check therefore considers that conversation eligible, and _rederive_live_prior clears its structured data before rebuilding, silently replacing the owner's summary. Persist and check an explicit summary-edit marker so these rows are protected, just like manually retitled rows.

Useful? React with 👍 / 👎.

}
if any(owner_changed(current[cid] or {}, by_id[cid]) for cid in ours):
raise Conflict('owner_edited_rebuilt_row')
from database.recurring_voice_privacy import filter_processing_write

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move the new privacy-helper import to module scope

The new undo transaction imports filter_processing_write inside its callback, contrary to the explicit requirement in backend/AGENTS.md that all imports be at module scope. Move this import to the module's import block; the newly added local imports in the protection-migration and prior-purge helpers need the same treatment.

AGENTS.md reference: backend/AGENTS.md:L168-L168

Useful? React with 👍 / 👎.

Comment on lines +681 to +684
priors = runs.list_priors(uid, run_id, firestore_client=firestore_client)
if any(leases.held(uid, 'summary-' + e['id'], firestore_client=firestore_client) for e in priors):
return _undo_refused(uid, run_id, 'notes_in_flight', firestore_client)
blocker = rederive_store.live_undo_blocker(uid, run_id, priors, firestore_client=firestore_client)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep both builder leases alive during undo preflight

For a large live re-derive run, or an operator connection with high Firestore latency, this preflight can exceed the leases' 240-second lifetime: it performs one sequential summary-lease read per prior, and live_undo_blocker then performs two more sequential document reads per prior. Neither builder lease is renewed until after the first restoration group. Consequently, the first undo_live_rederive rejects the expired backfill lease with lease_lost, and retrying repeats the entire scan without making progress. Keep both leases renewed throughout enumeration and validation, rather than starting renewal only after restoration.

Useful? React with 👍 / 👎.

# No rebuilt window covers its time: nothing absorbed it, so it stays as it is.
kept += 1
continue
retire[cid] = _retire_patch(survivor, run_id)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve standalone task associations before retiring donors

When an absorbed live conversation already owns standalone action items, this retirement leaves their conversation_id pointing to the now-deleted donor and does not transfer their target_task_id links into the survivor. The survivor's task list and progress count then exclude those tasks: routers/action_items.py::get_conversation_action_items and get_conversation_action_items_count query only the requested conversation ID, while requesting the deleted donor returns 404. Ordinary live refinement avoids this through store.merge_donors_have_tasks, but the new retirement path bypasses that guard. Protect task-bearing donors, or migrate their task associations and links together with corresponding undo state.

Useful? React with 👍 / 👎.

Git-on-my-level and others added 11 commits November 19, 2026 19:44
…es like a sync merge

A card whose summary the owner rewrote (notes written, overview, no
generated sections: the summary endpoint deletes them) is protected, and
undo refuses it before baselines. The retire patch carries
v3_claims_transferred_to and a bumped sync_content_revision, as a sync
merge's absorbed row does, so deleting a bridge releases none of the
survivor's claims. Undo refuses when a named source is gone, before any
write. A resumed attempt keeps the first prior of a row. The protection
migration empties only copies of rows it actually re-protects.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…el and preflights undo sources

save_priors reads each row's protection level in its transaction and
refuses a copy at a level the row has left; the protection migration also
empties the copy of a row a live run stamped after its snapshot. The undo
pre-check reads every source of every group before the first restores.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… row

A failed commit drops the undo copies of rows it did not write (a resume
records them again), so the stamp-gated deletion and protection paths
reach every copy. The protection migration empties a re-derived row's
copies only after re-protecting it. The commit checks tombstones of the
rows it retires. Rows with app results are protected: the owner can edit
them without a marker and a replan never regenerates them.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y failed live commit

The protection migration purges live re-derive copies after its rows and
photos are written, recording re-derived rows on every attempt so a retry
purges again; copies already at the target level (and created-row copies)
are kept. A live commit that fails for any reason drops the copies of rows
it did not write.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolves the reconcile conflict with settle-on-landing stretches (#25829).

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…left behind

Each live attempt and each undo first drops the run's copies of rows no
run stamped since the copy (a process stopped between recording the copy
and stamping its row). Undo never restores such a row, so the copies are
only retained content. A row a newer run restamped keeps its copy, so undo
still waits for that run.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…undo copies

Each partition reads its copies by id before its commit and when it
settles (the settle step takes the ids from the partition ledger), so
prior reads grow linearly with the run. The full stale-copy scan runs
once per resume and once per undo. The loader's range overflow blocks as
rederive_live_range_overflow, distinct from the final-commit write cap.
The runbook says a permanently refused undo keeps its copies until the
owner deletes the rows or the account.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cle inventory pins it

The settle step takes the partition's copy ids from a local, not from a
new field on the pinned 'notes' partition payload.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…on touched

The settle step baselines every row the partition writes or retires, so
rows a failed attempt already wrote get a baseline after the resume.
Retired bridges clear summary_due_at as main's absorbed rows do (declared
in the lifecycle writer inventory). The runbook says to undo only settled
runs: before settle the run's own notes may discard a card or add app
results.

Failure-Class: FC-irreversible-terminal-hide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Nov 20, 2026
## What changed and why

SCA-3299. A sync redirect was hiding the donor recording while leaving
its V3 Home card claims there. Sync now moves an eligible donor's
transcript-only claims and its cards' source links to the survivor in
the same Firestore transaction, with an immediate pending marker for V3.
Deletion re-reads the card links after durable delete intent. Sources
with playback, tombstones, competing claims, or insufficient speech
evidence stay in place.

The operator command previews one nominated redirect chain, applies only
the reviewed revision-bound receipt, and restores only fields whose
documents still match the repair commit. It preserves published card
content and visibility. A historical overlap without exact segment and
custody evidence remains for review. Coordinate the preview with the
live re-derive owner in #25817 and record the TestFlight build and
serving revision in SCA-3299 before readback. This release is separate
from the sit-down configuration rollout.

## Product invariants affected

none

## How it was verified

- 2,083 focused backend unit cases passed across sync assignment, V3
claim growth, claim deletion and the lifecycle writer guard.
- `make preflight` passed all 42 selected checks with this PR body.
- Both Firestore emulator tests passed. They cover the stale V3
reconcile commit, deletion with a stale card snapshot, dry-run drift,
apply retries, rollback and edit/tombstone conflicts.
- Production preview, mutation, serving verification and internal
TestFlight QA are pending release and operational approval.

## Tests

- `backend/tests/unit/test_conversations_v3_claim_growth.py` asserts two
redirects, retry idempotency, preserved user title and one owner per
segment after V3 reconciliation.
-
`backend/tests/integration/test_conversations_v3_sync_custody_firestore.py`
exercises live Firestore transaction semantics on the local emulator.

UI-Evidence: none -- backend custody fix with no UI changes

## Failure class (fixes)

Failure-Class: FC-split-mutation-authority

Line-Count-Exception: backend/utils/sync/assignment.py | 1617 -> 1677 |
Keep claim, redirect, card linkage and rollover staging in the owning
transaction. The standalone custody module owns speech and claim
validation.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/25845?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/25845?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25845&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1f957dc21

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +76 to +77
if any(raw.get(field) for field in OWNER_EDIT_FIELDS) or summary_edited(raw):
return 'edited'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Protect owner-edited action items before rebuilding a card

If an owner edits or completes a conversation action item before the repair runs, this eligibility check still permits rebuilding the card. routers/conversations.py::update_action_item_description and the completion endpoint call database/conversations.py::update_conversation_action_items, which updates only structured.action_items, without setting any checked edit marker. _rederive_live_prior then clears the entire structured object, discarding those changes. The standalone-task guard does not protect a surviving card because it checks only retired donors. Persist and check an action-item edit marker, or preserve these owner-managed items when rebuilding.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c2cb2f3213

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +715 to +717
for cid in result['created']:
# Already hidden with no claims; the deletion helper also erases its child collections.
conversations_db.delete_conversation(uid, cid)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Protect task-bearing created rows before undo removes them

If an owner creates a standalone task linked to a card newly created by the repair, undo still deletes that card. POST /v1/action-items accepts conversation_id, and its create path writes only the task, so neither owner_changed nor the embedded action-item revision detects this activity. delete_conversation does not migrate these sibling tasks, leaving their conversation links dangling; get_conversation_action_items subsequently returns 404 for that ID. Check for standalone tasks before restoring any undo group and refuse removal, or preserve their associations by migrating them to a restored conversation.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 851024a013

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +80 to +83
structured = raw.get('structured')
if isinstance(structured, dict) and structured.get('action_items'):
# Historical items can contain owner edits with no revision marker.
return 'action_items'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve owner-managed calendar event state before rebuilding

If an owner has marked an extracted calendar event as created before the repair, this eligibility check still allows the conversation to be rebuilt. routers/conversations.py::set_conversation_events_state persists that choice through update_conversation_events, which writes only structured.events and sets no checked edit marker. _rederive_live_prior then clears the entire structured object, losing the owner's event state whenever the window changes. Protect rows with owner-managed events or preserve those events across the rebuild, as is already done for embedded action items.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f387796ff

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +684 to +685
if retired and merge_donors_have_tasks(uid, retired, firestore_client=client, transaction=tx):
raise Conflict('rederive_live_donor_tasks')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fence task creation against donor retirement

If a task-create request validates a donor immediately before this transaction retires it, the task can still commit afterward with its conversation_id pointing to the deleted donor. The new transactional task-create fence in database/action_items.py::_check_undo_removals checks conversation availability only when an undo-removal marker exists, but live retirement writes no such marker. Consequently, this task query can correctly return empty and both transactions can succeed sequentially, leaving the task absent from the survivor's task list and its original conversation endpoint returning 404. Unlike the previously reported case of an already task-bearing donor, the fresh evidence here is the marker-only create fence, which leaves this validate-before-retire/commit-after-retire ordering unprotected. Add a shared transactional fence for retirement and task association, or migrate the association.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit 4a87a21 into main Nov 20, 2026
66 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/v3-live-rederive branch November 20, 2026 22:27
Git-on-my-level added a commit that referenced this pull request Nov 21, 2026
## Change

Add an explicit historical sit-down timing option to the per-owner live
repair in #25817. This branch targets the repair branch so its review
covers only the timing change.

- Use 900 seconds of recorded silence for partitioning, outlining and
planning. Refuse forced partition cuts and verify internal seams against
decoded speech, since late text can extend past the stored end time.
- Use the 3,600-second lock from the latest speech landing. Stop on
unknown landing times or an unsettled stretch. Pass the timing through
the existing backfill run ledger and refuse a worker configuration
mismatch.
- Keep ordinary derive and non-opt-in live repair timing. The dry-run
still estimates counts with placeholder outlines.

## Worker verification

178 focused backend unit tests passed under Python 3.11 on synthetic
data. Coverage includes the 899/900-second seam, 3,599/3,600-second
lock, stale recording-end metadata, worker configuration drift, the
sit-down outline and resulting card, and the existing repair and undo
regressions.

SCA-3355 tracks the owner-scoped preview and publication approval.
Production account data was untouched. Keep live application gated on
the reviewed repair, exact serving evidence, the private preview, and
its approved rollback.

## Product invariants affected

None selected by PR preflight.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/25863?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/25863?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25863&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
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.

1 participant