GLM-5.3 Flash · 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 Opus 5.5.
- Gold bugs found
- 2 of 6
- Comments published
- 3
- Comments matching a bug
- 2
- Comments not matching
- 1
- Cost of this PR
- $0.038
Published comments (3)
SMS sending lock inflates retryCount and permanently deletes reminders — Attendees silently lose reminders: the transient monthly-limit lock in twilioProvider.ts makes `scheduleSMS` return undefined, so two locked cron runs push `retryCount` past 1 and the next `deleteMany` permanently deletes the reminder. Don't treat a locked send as a scheduling failure.
Unguarded update in catch block can throw and skip remaining reminders — If the update throws (e.g. `P2025` when an overlapping cron run already deleted the reminder), the error escapes the handler and skips all remaining reminders. Wrap `prisma.workflowReminder.update` in its own try/catch so the loop continues.
retryCount added without an index for the cleanup query predicate — The cron's `deleteMany` in scheduleSMSReminders.ts filters on `retryCount > 1` every run, and the existing `[method, scheduled, scheduledDate]` index doesn't cover it, so each invocation scans the table. Add an index on `retryCount` (or a partial one).