#19812·saleor

Prevent duplicate automatic transaction release requests

Author: NyanKiyoshiCreated Sep 21, 2026Updated Sep 28, 2026

The automatic fund-release task selects candidates from a read replica, then fetches them from the writer without rechecking last_refund_success nor locking rows.

Replica lag and concurrent executions can process the same transaction twice. Each invocation generates a idempotency_key value for cancellations or refunds, thus downstream idempotency checks cannot prevent duplicate operations.

Acceptance criteria:

  • Re-validate refund eligibility against the writer
  • Use (ordered) row locking for each TransactionItem before issuing any refund or cancellation

The actual issue is unlikely to occur, and would lead to the PSP rejecting the request. This is only a correctness issue.