Repository navigation
fix(conversations-v3): group-atomic backfill undo; drain stops on account deletion - #25703
Merged
Merged
Conversation
…ount deletion Follow-up to #25686 for the head panel review-20261118t145557-1937: - Undo restores donors and removes copies per connected group in one transaction that reads the copies' deletion tombstones, so a delete racing undo never resurfaces a legacy row; a group with an owner deletion stays v3 and hands owed notes to the live marker; a donor with no claim and no new span (interrupted run, retired by re-derive) is restored. - The backfill drain checks the account-deletion marker before each chunk and the step blocks the run (account_deletion). - A converted donor no rebuilt window claims blocks the partition; re-derived prior copies drop stale notes markers. - Operator: one owner's blocked plan prints its reason and the batch continues (exit 1). Gap-free forced cuts fill partitions. - Only v3 backfill copies skip capture-loss/owner-recognition telemetry; silent-backfill recovery keeps it. Flag registry notes state the prod value. Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
The account-deletion stop is an int flag in the drain counts instead of a string under 'stopped', which pyright rejected for the int-valued dict. Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
…notes call The drain checked the deletion marker once per chunk, so a marker set after that check let the chunk's other workers still start model calls. Each row now rechecks right before its notes call and releases its lease when blocked. Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t, drain lease safety Answers panel review-20261118t171612-b1c4: - Re-derived copies start a fresh v3_backfill_attempts budget. - An undo group over 400 documents is refused whole (undo_group_too_large). - A failed account-deletion read releases the row's summary lease. - An account_deletion block keeps the chunk's notes counts in the ledger. - --no-wait keeps a blocked owner's exit 1; dry-run prints undo groups and a lower-bound deleted-donor count; runbook wording matches. - Behavioural tests pin capture-loss accounting for silent-backfill recovery (counted) and v3 backfill copies (skipped). Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
… undo errors Answers panel review-20261118t182520-4d1e: - The backfill drain's account-deletion checks read the marker past the 30s negative cache (account_deletion_blocks_user_work(fresh=True)). - load_derive resolves the deletion marker on the data plane, not the conversations client it was handed. - A Conflict inside an undo group is recorded in the ledger; the run stays 'undoing' so a rerun continues, and the operator exits 1. Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
…notes model When undo keeps a group because the owner deleted a copy, only the copies without a deletion tombstone hand their owed notes to the live marker; the deleted copy's backfill marker is just cleared (panel review-20261118t194704-adbf). Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ndo totals Answers panel review-20261118t202629-29f6: - The undo group transaction reads each copy's summary lease and refuses (notes_in_flight) when a notes write started after undo's first check. - A rerun or refused undo keeps the totals of groups already undone. - The account-deletion blocked partition records notes_remaining. - A test pins load_derive's deletion-marker read to the data plane. Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ept undo groups Answers panel review-20261118t211606-42ac: - An account-deletion stop still reads what notes remain owed, so the blocked partition's notes_remaining is accurate. - A rerun undo carries only restored/removed totals; kept groups stay in the run's documents and are recounted, never double-counted. Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
… racing undo Answers panel review-20261118t214510-6e27: - Undo persists its totals after every group, so a crash never loses groups already undone. - A delete whose tombstone lands after its group was undone (the shared delete path reads the copy before writing the tombstone) is counted as deleted_during_undo for the operator; the runbook says what to do. - An owner skipped for an active run fails the operator's exit code. - The fresh deletion-marker read keeps the check metrics (called/decision, authority_unavailable) by going through get_user_deletion_wipe_status. - Runbook: only surviving copies' notes move to the live marker. Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pies on donors Answers panel review-20261118t220607-afa0: - Each undo group's transaction writes the run's undo progress (restored and removed totals, removed copy ids), so a crash or retry never loses totals, and the race check covers every attempt's removals and lists their ids. - Deleting a backfilled copy records its id on the donor even when other claims cover the interval, so undo always sees the deletion. - A kept group clears the live notes marker on a deleted copy too. - A run with kept groups or a raced delete ends undone_partial (exit 1). - The group bound counts reads (row, tombstone, notes lease per copy). - Only a re-derive blocks on an unclaimed converted donor; a resume keeps its copy. The operator reports only Conflicts and an existing run as blocked. - Runbook: the remedy for an owner-deleted copy that blocks a re-derive. Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
deleted_during_undo_ids is a list alongside the integer totals; pyright rejected updating an int-inferred dict with it. Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e pass Answers panel review-20261118t223845-273f: load_derive gates sending the owner's transcript to the outline model, so it reads the account-deletion marker past the negative cache. Runbook states the read-count undo bound. Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nors exactly A Conflict mid-undo now still checks the copies already removed for a delete that raced them and records deleted_during_undo_ids in the error patch. undo_backfill_group returns the number of converted donors it kept, and undo_run counts that instead of every donor in the group. Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pture A live builder pass after a run carries the run tag onto a window that also holds recordings captured after the run. Undo deleted that copy. It now keeps any group whose copy holds a recording outside the group (kept_live), counts groups_kept_live/donors_kept_live and ends undone_partial. Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
… renew create_run raises BackfillRunExists (a ValueError) and the operator catches the type, not the message. Undo renews its leases inside the per-group Conflict handling, so a lease lost on renew writes the same structured error record as a failed group. Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
…bound A copy named only by a donor's post-run deleted span or recorded deleted copy still links the group's donors but is no longer read: that donor already keeps the group, so such ids cannot push a group over the read bound. Undoing a run already undone or undone_partial reports its record and changes nothing. A test pins the kept branch clearing a deleted copy's live notes marker. The runbook explains the dry-run lower bound and the kept reasons. Failure-Class: FC-irreversible-terminal-hide Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure-Class: FC-irreversible-terminal-hide
Preserve historical live re-derive while keeping per-owner backfill blocking and partial undo reporting. Pin the notes source version for the deletion admission fence and keep notes-9 checkpoints reusable. Co-authored-by: multica-agent <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #25686. It merged at 2c5a581 while omi-panel
review-20261118t145557-1937was still running on that head, and that review came back FIX-FIRST. This PR fixes its findings in the backfill drain, undo, re-derive and the operator script. Undo has to be verifiable before the first owner run, so these fixes gate the run.drain_backfillchecks the account-deletion marker before each notes chunk. Once deletion starts, no transcript goes to the notes model, and the step marks the run blocked with reasonaccount_deletion.backfill_donor_unclaimed) instead of staying hidden with no copy. A re-derived prior copy no longer inherits a stale notes marker.owner[N] blocked: <reason>, the script continues with the other owners, and it exits 1. Blocked reasons include an overfull partition, account deletion, an unreadable source and an existing run.CONVERSATIONS_V3_BACKFILLregistry notes now state the prod backend-sync value and the operator-only gating.Later review rounds on this PR (
review-20261118t171612-b1c4throughreview-20261118t223845-273f) added these fixes:notes_in_flight).deleted_during_undo_ids.undoneorundone_partialreports its record and changes nothing.undone_partial(exit 1). The group size bound counts reads, not documents. An undo that fails partway still checks the copies it already removed for a racing delete and records them in the error.donors_kept_deletedcounts only converted donors that stayed hidden.BackfillRunExists) as a blocked owner, and an owner skipped for an active run sets exit 1.From the 18:30Z smell audit:
kept_live). It countsgroups_kept_live/donors_kept_liveand endsundone_partial.started_at < until, and--untildefaults to now. Only completed, non-recording legacy rows qualify (backfill_legacy_source), so an in-progress capture is never converted. A legacy conversation that completed just before the run is in scope. Pass an explicit--untilto leave recent history alone.Rejected on purpose, and tracked as follow-ups (the coordinator agreed with the notes-lock reject, bus a16967):
conversation_tombstones.record_deletion) and undo. Undo surfaces the race instead, through the raced ids andundone_partial.Not changed here: F2 (removal of the
BATCH_PIPELINE_MERGE_STALE_HEAD_UID_ALLOWLISTprod binding). It came from #25696 (jobstore-index's #25679 repair), which was merged into #25686. Its owner and declaration live with that change.Product invariants affected
historicalseam inprocess_conversation.Failure-Class: FC-irreversible-terminal-hide
Line-Count-Exception: backend/database/conversations_v3.py | 1799 -> 1862 | Keep the connected undo transaction with the projection writer and its visibility index.
Line-Count-Exception: backend/routers/conversations.py | 3276 -> 3314 | Pass observed row existence through the existing delete paths so undo races return the refresh response.
Line-Count-Exception: backend/utils/conversations/process_conversation.py | 3608 -> 3612 | Preserve typed admission failures and scope suppressed telemetry to backfilled copies.
Line-Count-Exception: backend/utils/conversations/v3/service.py | 1652 -> 1678 | Check deletion during the paged drain and preserve the processing state when admission is blocked.
Test plan
November 26 verification after merging current main
tests/unit/test_conversations_v3_backfill.pypassed all 81 tests on the rebased PR head, including the regression that starts deletion after the drain checks and before model admission. Existing coverage includes:test_undo_never_resurrects_a_donor_whose_copy_the_owner_deletedtest_a_deletion_racing_undo_keeps_the_group_and_hands_owed_notes_to_livetest_an_interrupted_conversion_with_no_claim_is_restoredundo_backfill_group.test_undo_groups_link_donors_and_copies_including_deleted_copiestest_only_a_post_run_deleted_span_counts_as_the_owners_deletiontest_undo_holds_both_builder_leases_before_it_enumerates_the_runtest_undo_works_one_group_per_call_and_refuses_while_notes_are_in_flighttest_the_drain_stops_once_account_deletion_startstest_a_step_blocks_the_run_when_the_drain_stops_for_account_deletiontest_a_converted_donor_no_rebuilt_window_claims_blocks_the_partitiontest_one_owners_blocked_plan_never_stops_the_others.test_a_gap_free_run_over_the_cap_is_a_counted_forced_cut.Updated pins:
test_owner_recognition_telemetryand thetest_capture_loss_accountingharness.The local Firestore emulator verified both admission orders with absent and cancelled markers, for immediate and grace-period deletion. Production was outside this verification.
🤖 Generated with Claude Code