Skip to content

fix(jobs): webhookSweeperJob and monthlyReportCron missing explicit maxAttempts — may double-deliver on retry #218

Description

@walidboulanouar

Problem

Two schedules.task jobs have no explicit retry.maxAttempts and default to Trigger.dev's system default (3):

  • webhookSweeperJob (packages/jobs/src/webhook-sweeper.ts:86) — sweeps and dispatches webhooks; a transient DB error on the sweep query retries up to 3×, potentially re-selecting already-dispatched items if delivered_at update hasn't committed.
  • monthlyReportCron (packages/jobs/src/monthly-report.ts:249) — the cron wrapper that fans out per-org monthlyReportJob tasks; 3 retries of the wrapper could enqueue duplicate per-org jobs.

Fix

Add explicit retry config:

// webhookSweeperJob — idempotent sweep, 1 attempt is correct
retry: { maxAttempts: 1 },

// monthlyReportCron — fan-out wrapper; child jobs are idempotent, wrapper retry is safe but noisy
retry: { maxAttempts: 2 },

Severity

LOW — mitigated by per-delivery CAS guards, but explicit maxAttempts should be set on all jobs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions