Claude Opus 5.5 · 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 Haiku 5.5.

Gold bugs found
2 of 5
Comments published
3
Comments matching a bug
2
Comments not matching
1
Cost of this PR
$1.203

Published comments (3)

highbugpackages/features/ee/workflows/api/scheduleSMSReminders.ts:178-197

Temporary SMS failures consume retry budget and get reminders deleted — The temporary SMS lock (undefined return), `checkSMSRateLimit` rejections and brief Twilio outages all bump `retryCount`, so the `retryCount > 1` delete drops valid reminders after two cron runs. Increment `retryCount` only for permanent Twilio errors like invalid-number codes, and let transient failures retry freely.

mediumbugpackages/features/ee/workflows/api/scheduleSMSReminders.ts:175-188

Reminders with no phone number or empty message never increment retryCount — Reminders missing `sendTo` or `message` skip the `if (message?.length && sendTo)` branch, so they're re-selected every cron run until the scheduled date, which this PR aims to stop. Add an else branch that increments `retryCount` or deletes the reminder.

mediumbugpackages/features/ee/workflows/api/scheduleSMSReminders.ts:189-198

Unguarded retryCount update in catch block can abort the reminder loop — If the reminder was deleted concurrently (e.g., a cancellation or a P2025), `prisma.workflowReminder.update` throws uncaught, aborting the loop and failing the cron handler where it previously only logged. Wrap the update in its own try/catch, or use `updateMany`.

Gold bugs found (2)

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.
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.

Gold bugs missed (3)

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.
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.
criticalClaims transient errors increment retryCount, so two runs during an outage delete the whole pending SMS reminder queue.