export async function retryTransfer(attempt: TransferAttempt) { return bank.submitTransfer({ amount: attempt.amount, key: crypto.randomUUID(), timeoutMs: 8_000, })for (let i = 0; i < 3; i++) { try { return await retryTransfer(attempt) } catch (err) { if (!isTimeout(err)) throw err }}PR review
Cody reviews each pull request against your team's rules and comments on the lines that break them.
rules/payments.mdPAY-014Retries must reuse the original idempotency key.This line creates a new key for each attempt. The caller retries up to three times on a timeout, so a slow bank call can send the transfer twice.
- key: crypto.randomUUID(),+ key: attempt.idempotencyKey,