Repository navigation
feat: alert when a connector sync unit is dead-lettered - #5533
Conversation
A sync unit that dead-letters (for example after repeated auth failures) stopped silently. An hourly cron job lists dead-lettered units of live integrations and sends one Slack alert per dead-letter episode, with a weekly reminder while a unit stays dead. Refs linuxfoundation/lfx-cdp-insights-ops#1238 Signed-off-by: Uroš Marolt <uros@marolt.me>
…unit-dead-letter-alert Signed-off-by: Uroš Marolt <uros@marolt.me> # Conflicts: # services/libs/data-access-layer/src/connectors/syncUnits.test.ts
PR SummaryLow Risk Overview A new DAL query A production-only cron job Unit tests cover the check logic (dedupe, reminders, failed sends) and the DAL listing (excludes deleted integrations). Reviewed by Cursor Bugbot for commit f25bb5a. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
@themarolt I'm starting review 1 of this pull request now (started 2026-12-06 19:16 UTC using review agent v0.1.37). This usually takes a few minutes. I'll update this comment with the summary when I'm done. If there's no summary here after about 45 minutes, the review stopped: push a new commit, or post a comment that begins with a mention of me followed by Hi @themarolt, thanks for the PR. SummaryThis PR adds an hourly cron job that posts dead-lettered connector sync units to the CDP integrations alerts Slack channel. It also adds the DAL query behind it. The code is well structured and tested, and I found one minor edge case. Decision✅ Approved with minor comments 🟡 1 minor DetailsOverall impression: The change is small and well scoped. The new job reuses the Octolens health-check helpers ( 🟡 Minor: 1 issue: Units not shown in the alert are still marked as alerted Other reviewers and CI checks: Cursor Bugbot had only posted a "generating summary" placeholder, so there was nothing to reconcile. The required Documentation reminder: changed Rule files: read Questions, problems, or feedback: https://github.com/linuxfoundation/lfx-review-agent/issues |
lfx-one
left a comment
There was a problem hiding this comment.
The dead-letter alert job is a clean, well-tested addition that follows the existing Octolens health-check pattern. I found one minor edge case, listed below, which doesn't block approval.
Documentation
This pull request changes behavior that may also be described outside this repository, such as product pages or an external docs site. I can't read those, so please check them; the author and maintainers own those updates. Changed here:
sync-unit-dead-letter-check(new hourly cron job that alerts on dead-lettered sync units)sync-unit-dead-letter:alerted:(new Redis key prefix for the per-episode alert state)
Confidence Score: 4/5
[Medium impact] The alerts cover dead-lettered units across live integrations, while their effects stay in the operations notification workflow. Not ready to merge: units omitted from Slack are still marked as alerted, and the comment rule remains unmet. Findings
Fix with agent prompt### Issue 1
services/apps/cron_service/src/jobs/syncUnitDeadLetter.ts:99-104
`buildAlert` drops units beyond the line or character limit, but this loop marks every fresh unit as alerted for seven days. With 21 short entries, Slack never names the last unit. If the units stay dead, weekly reminders repeat the same first entries and hide the rest again. Send separate batches and remember only units included in successful messages.
### Issue 2
services/apps/cron_service/src/jobs/syncUnitDeadLetter.ts:undefined-8
This comment repeats `REMINDER_DAYS`. The comment above `listDeadLetteredSyncUnits` also repeats the function and query. `AGENTS.md` explicitly forbids comments that only describe what the code does, so remove these before merging. Keep the separate comments explaining why `lastRunAt` identifies an episode; those explain a non-obvious invariant.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryAdds hourly, production-only Slack alerts for dead-lettered connector sync units.
Reviews (2) · Last reviewed commit: "Merge branch 'main' into feat/issue-1238..." · Reviewed by Greptile |
There was a problem hiding this comment.
🟡 Changes recommended
The alert loop marks omitted units as alerted for seven days, suppressing notifications for units excluded by the message limits.
1 open issue
What changed in this PR
Adds Slack monitoring for dead-lettered connector sync units, making stopped ingestion visible to operators.
Changes:
- Queries dead-lettered units belonging to live integrations.
- Adds a production-only hourly alert with Redis deduplication and weekly reminders.
- Tests query filtering, alert suppression, repeat episodes, and failed sends.
| File | Description |
|---|---|
| services/libs/data-access-layer/src/connectors/syncUnits.ts | Adds the dead-letter query and result type. |
| services/libs/data-access-layer/src/connectors/syncUnits.test.ts | Tests filtering and timestamp conversion. |
| services/apps/cron_service/src/jobs/syncUnitDeadLetterCheck.job.ts | Connects the hourly job to PostgreSQL, Redis, and Slack. |
| services/apps/cron_service/src/jobs/syncUnitDeadLetter.ts | Formats alerts and tracks notified episodes. |
| services/apps/cron_service/src/jobs/syncUnitDeadLetter.test.ts | Tests alert delivery and deduplication behavior. |
Review effort: Balanced
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f25bb5a. Configure here.


Summary
A connector sync unit that fails too often in a row is dead-lettered and never runs again until someone acts, and today nothing tells anyone. A new hourly cron job posts dead-lettered units to the CDP integrations alerts Slack channel. With one Octolens poll unit per workspace, a rejected workspace key now shows up there instead of silently stopping that workspace's mentions.
Changes
listDeadLetteredSyncUnits(DAL): dead-lettered sync units of live integrations, with their segment, failure count and last error.sync-unit-dead-letter-checkcron job (hourly at :45, production only): alerts once per dead-letter episode, keyed in Redis by the unit and the time of the run that dead-lettered it, so a unit revived and dead-lettered again alerts again. A unit still dead after 7 days is listed again as a reminder. A failed Slack send is retried on the next run.Type of change
Related issue
Refs linuxfoundation/lfx-cdp-insights-ops#1238