Skip to content

cycles: transfer_cycle_issues non-atomic - progress_snapshot saved but issues not moved if process killed mid-transfer #9599

Description

@harsh4vardhan

Bug Description

ransfer_cycle_issues performs two DB writes sequentially without wrapping them in 	ransaction.atomic. If the process is killed or a DB error occurs after the first write completes but before the second, the database is left in an inconsistent state with no recovery path.

Affected file

�pps/api/plane/utils/cycle_transfer_issues.py:

`python
current_cycle.save(update_fields=["progress_snapshot"]) # line 432 - committed first

... build updated_cycles list ...

CycleIssue.objects.bulk_update(updated_cycles, ["cycle_id"], batch_size=100) # line 458 - may never run
`

Failure scenario

  1. Admin triggers "Transfer incomplete issues" from cycle A to cycle B.
  2. current_cycle.save(update_fields=["progress_snapshot"]) commits - cycle A now appears complete in the UI.
  3. Worker process is killed (OOM kill, deploy restart, DB connection timeout) before CycleIssue.objects.bulk_update runs.
  4. Cycle A shows as completed with a snapshot, but all its issues still belong to cycle A - they were never moved.
  5. Users see a "completed" cycle full of issues with no way to trigger the transfer again through the UI.

Fix

`python
from django.db import transaction

with transaction.atomic():
current_cycle.save(update_fields=["progress_snapshot"])
CycleIssue.objects.bulk_update(updated_cycles, ["cycle_id"], batch_size=100)
`

Environment

Plane develop branch (2026-08-13).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions