Repository navigation
fix(sync): surface destructive-op fence as retryable sync failure - #15442
Merged
Merged
Conversation
Retention cleanup raised DestructiveOperationInProgress during action-item vector upsert, but the sync reprocess path collapsed it into a generic Failed state so clients hammered Retry. Map the fence to a bounded retryable error_code and fail closed on the reprocess path. Failure-Class: new
The inline action-item write is the fail-closed guard; naming the memory extractor in the comment inflated the Gate F eager-extraction inventory. Failure-Class: FC-transient-fence-collapsed-to-generic-sync-failure Co-authored-by: Cursor <[email protected]>
Pyright treats DestructiveOperationInProgress as always a BaseException subclass, so the issubclass guard failed the pre-push typecheck. Identify the fence by type name, which also stays valid when tests stub database. Failure-Class: FC-transient-fence-collapsed-to-generic-sync-failure Co-authored-by: Cursor <[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.
What changed and why
Sync reprocess treated a transient
DestructiveOperationInProgressfence (retention cleanup) as a generic app-level Failed outcome, so users hammered Retry. The fence is now a bounded, retryable sync state (destructive_operation_in_progress) and the reprocess path is fail-closed.Evidence: backend-sync-backfill crashed in
_save_action_items->upsert_action_item_vectors_batch->external_write_fenceraisingDestructiveOperationInProgress(legal_hold_deletion_gates, kind=retention_cleanup). The gate is transient.Product invariants affected
Line-Count-Exception: backend/utils/conversations/process_conversation.py | 3213 -> 3219 | Fail-closed inline
_save_action_itemson sync reprocess so a transient destructive-op fence cannot hide in a postprocess future.Line-Count-Exception: backend/utils/sync/pipeline.py | 2506 -> 2512 | Re-raise
DestructiveOperationInProgresson enrichment write/reprocess instead of collapsing it to a generic Failed.How it was verified
Focused files:
tests/unit/test_sync_cloud_tasks.py,tests/unit/test_sync_v2.py,tests/unit/test_upstream_boundary.py,tests/unit/test_transcription_outcomes.py.Tests
retrywithfenced_mark_job_queued_for_retry(..., 'destructive_operation_in_progress');_finalize_sync_job_failureis not awaited.TimeoutErrorretryablestt_timeout;CONFIG_ERRORfailed_final)._reprocess_merged_conversationsre-raisesDestructiveOperationInProgressinstead of logging-and-continuing;SyncConversationPersistenceFencedisolation still holds.is_reprocess=Trueruns_save_action_itemsinline (same fail-closed idea as_extract_memories).Failure class (fixes)
Failure-Class: new
Failure-class transition narrative (only when needed)
Violated contract: a transient account-level destructive-operation fence must surface as a bounded, retryable sync failure rather than a generic Failed. Canonical guard: re-raise the fence on the sync reprocess path, run
_save_action_itemsinline whenis_reprocess=True, and map it at the Cloud Tasks handler todestructive_operation_in_progressbeforefailure_from_exception. This PR adds.github/failure-classes/FC-transient-fence-collapsed-to-generic-sync-failure.json(evidence_prsis[]because this PR is the evidence). Existing candidatesFC-typed-failure-collapsed-to-generic(desktop-scoped),FC-recoverable-provider-failure-terminal, andFC-offline-merge-clock-offset-dupdo not describe this sync-handler collapse.