MiniMax M3 · Balanced
sms-workflow-reminder-retry-count-tracking-cal-com
cal.com · TypeScript · S · 30–99 lines · 3 files
The normal review, with one generalist agent. Judge: Claude Haiku 5.5.
- Gold bugs found
- 1 of 5
- Comments published
- 1
- Comments matching a bug
- 1
- Comments not matching
- 0
- Cost of this PR
- $0.093
Published comments (1)
highbugpackages/features/ee/workflows/api/scheduleSMSReminders.ts:178-198
Non-atomic retryCount increment risks under concurrent cron workers — Concurrent cron workers can both read the same snapshot and overwrite each other's `retryCount` write, leaving retries stuck at 1. Use Prisma's atomic `increment: 1` in both `prisma.workflowReminder.update` calls instead of `reminder.retryCount + 1`.
Gold bugs found (1)
mediumretryCount is set to reminder.retryCount + 1 from a value read at the start of the run instead of an atomic increment, so overlapping runs can lose increments.
Gold bugs missed (4)
highThe deleteMany OR clause applies retryCount > 1 without the SMS method filter, so the SMS cron deletes any workflow reminder (email, WhatsApp) with retryCount above 1.
mediumThe retry-count update inside the catch block is not guarded, so if it throws (for example the reminder was deleted concurrently) the error escapes the loop and the cron run fails, skipping the remaining reminders.
criticalClaims transient errors increment retryCount, so two runs during an outage delete the whole pending SMS reminder queue.
highSMS-sending locks are counted as failed scheduling attempts: scheduleSMS returns undefined for locked users/teams, retryCount is incremented, and after two cron runs the retryCount > 1 cleanup deletes future reminders even if sending is later unlocked.