Amazon Ergo 1.0 · Heavy
sms-workflow-reminder-retry-count-tracking-cal-com
cal.com · TypeScript · S · 30–99 lines · 3 files
The generalist plus 9 specialist lens agents in parallel, then the same verify and dedup steps. Judge: Claude Opus 5.5.
- Gold bugs found
- 3 of 6
- Comments published
- 4
- Comments matching a bug
- 3
- Comments not matching
- 1
- Cost of this PR
- $1.129
Published comments (4)
SMS-locked cron runs count as failed retries, deleting valid reminders — SMS-locked accounts can permanently lose valid booking reminders: this `else` branch increments `retryCount` without any delivery attempt, triggering the `retryCount > 1` deletion. Skip the increment when `twilio.scheduleSMS` returns `undefined` because `isLockedForSMSSending` is set; count only attempted sends that fail.
retryCount cleanup can delete successfully scheduled SMS reminders — Overlapping runs can leave a scheduled reminder with `retryCount > 1`; deleting it strands the live Twilio message where cancellation flows cannot find it. Add `scheduled: false` to the cleanup filter so only unsent reminders are purged.
Concurrent cron runs can lose retryCount increments — Overlapping cron runs can both write the same stale `reminder.retryCount + 1`, losing a failure and allowing attempts beyond the intended limit. Use atomic `retryCount: { increment: 1 }` updates in both failure paths.
Unguarded retry-count update in catch aborts remaining reminders — A deleted reminder (`P2025`) or transient DB error can make this `prisma.workflowReminder.update(...)` throw, aborting the loop and skipping every remaining reminder. Wrap both retry-count updates in their own try/catch, or use `updateMany` so missing rows are a no-op.