Skip to content

fix(sync): surface destructive-op fence as retryable sync failure - #15442

Merged
Git-on-my-level merged 3 commits into
mainfrom
fix/sync-destructive-op-fence-outcome
Sep 22, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
fix/sync-destructive-op-fence-outcome

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

What changed and why

Sync reprocess treated a transient DestructiveOperationInProgress fence (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_fence raising DestructiveOperationInProgress (legal_hold_deletion_gates, kind=retention_cleanup). The gate is transient.

Product invariants affected

  • INV-MEM-4
  • INV-TASK-2

Line-Count-Exception: backend/utils/conversations/process_conversation.py | 3213 -> 3219 | Fail-closed inline _save_action_items on 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 DestructiveOperationInProgress on enrichment write/reprocess instead of collapsing it to a generic Failed.

How it was verified

BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-pr1-tests.txt bash backend/test.sh

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

  • Cloud Tasks handler: fence maps to HTTP 500 / retry with fenced_mark_job_queued_for_retry(..., 'destructive_operation_in_progress'); _finalize_sync_job_failure is not awaited.
  • Non-fence exceptions keep existing mapping (TimeoutError retryable stt_timeout; CONFIG_ERROR failed_final).
  • _reprocess_merged_conversations re-raises DestructiveOperationInProgress instead of logging-and-continuing; SyncConversationPersistenceFenced isolation still holds.
  • is_reprocess=True runs _save_action_items inline (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_items inline when is_reprocess=True, and map it at the Cloud Tasks handler to destructive_operation_in_progress before failure_from_exception. This PR adds .github/failure-classes/FC-transient-fence-collapsed-to-generic-sync-failure.json (evidence_prs is [] because this PR is the evidence). Existing candidates FC-typed-failure-collapsed-to-generic (desktop-scoped), FC-recoverable-provider-failure-terminal, and FC-offline-merge-clock-offset-dup do not describe this sync-handler collapse.

Review in cubic

Git-on-my-level and others added 3 commits September 21, 2026 07:56
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]>
@Git-on-my-level
Git-on-my-level merged commit dbf4a9f into main Sep 22, 2026
64 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/sync-destructive-op-fence-outcome branch September 22, 2026 01:08
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