Skip to content

fix(backend): isolate per-item failures in cloud action-item auto-sync batch (#19459) - #19468

Merged
kodjima33 merged 1 commit into
mainfrom
watchdog/issue-19459-task-sync-batch-isolation
Sep 27, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
watchdog/issue-19459-task-sync-batch-isolation

Conversation

@kodjima33

@kodjima33 kodjima33 commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Bug

auto_sync_action_items_batch (backend/utils/task_sync.py) wraps its entire cloud-export
loop in one try/except. A transient failure syncing a single action item — e.g. an OAuth
preflight error raised inside create_task_internal for google_tasks/asana — aborts the
loop immediately. The except then returns [{"synced": False, "error": ...}] * len(action_items),
which:

  • skips every item after the failing one (never attempted), and
  • overwrites the result for items before the failure that already synced successfully.

Filed as #19459.

Root cause

The per-item for loop over cloud services has no per-item error boundary; one raised
exception propagates out of the whole batch.

Fix

Wrap each item's _sync_to_cloud_service call in its own try/except inside the loop, so a
single item's failure produces only that item's error result. The outer try/except still
covers the shared-configuration lookups before the loop (get_default_task_integration,
get_task_integration, connected check), so a genuinely shared failure still short-circuits
the whole batch, as the issue's "Expected" section asks for.

Tested

  • Added test_batch_cloud_sync_isolates_a_failing_item_from_the_rest to
    backend/tests/unit/test_task_sync_cloud_export_dedup.py: three items, the middle one's
    create_task_internal raises; asserts items 0 and 2 still sync successfully and only item 1
    reports an error.
  • Ran the full test_task_sync_cloud_export_dedup.py, test_task_sync_async.py,
    test_task_sync_apple_async_boundary.py, and test_process_conversation_usage_context.py
    suites — all pass (10 + 55 tests).

Diff: 10 insertions/3 deletions in task_sync.py, +38 lines of test.

Failure-Class: none

🤖 automated by hourly watchdog — tested and merged

Review in cubic

…c batch

auto_sync_action_items_batch wrapped its whole cloud-sync loop in one
try/except. A transient failure on one item (e.g. an OAuth preflight
error in create_task_internal) aborted every remaining item and
overwrote earlier successful results with a blanket error for the
entire batch.

Wrap each item's sync call individually so one failure no longer erases
already-succeeded exports or skips items after it. Shared-configuration
failures (no default integration, integration not found/connected)
still short-circuit the whole batch as before.
@kodjima33
kodjima33 merged commit 6d7739d into main Sep 27, 2026
59 of 63 checks passed
@kodjima33
kodjima33 deleted the watchdog/issue-19459-task-sync-batch-isolation branch September 27, 2026 19:04
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