CedarCopilot wants to merge 1 commit into staging from fix/slack-lapse-claim-exclusive
Live on prod, no production signal yet
Libra has verdicts on 0 of 1 tracked behaviors on prod; 1 is still being checked. Libra checks hourly for 3 days after each deploy.
Follow-up to #2633, which merged before this last Greptile finding was addressed.
That PR made an undelivered lapse claim reclaimable so a failed send could not silently consume the rep's only notice. Greptile correctly pointed out that this cost the claim its exclusivity: a broken Slack token fails every channel in the same drain tick, so simultaneous reports for one user are the normal shape of a break rather than a rare interleaving , and a predicate admitting any lapse not yet marked delivered admits every one of them. The rep gets one mail per failing channel.
The claim now readmits a lapse only once it is undelivered and older than the abandoned-claim window:
notified stamp, or a dead process is retried once the window passes β the rep still gets told.The window only has to outlast an in-flight send, so it is set to 15 minutes.
The delivered-stamp is also scoped to the exact lapse the claim returned, rather than to "there is a lapse". Without that, a slow sender could mark a newer, still-undelivered lapse as notified , the one case where the rep is silently owed a mail that never arrives.
Two new tests, both of which fail without the change:
The existing retry test now asserts the fuller shape: undelivered β not immediately reclaimable β reclaimable once the window passes.
Validated as part of the full gate before #2633 merged (pnpm run autofix:local: oxlint --deny-warnings, deps:check, 313 mail suites / 2,946 tests, 764 server files / 8,375 tests). The cherry-pick onto current staging is byte-identical to that validated version and is the only delta.
π€ Generated with Claude Code
The PR restores exclusivity for Slack lapse-notification claims while keeping abandoned claims reclaimable after a 15-minute window.
The PR appears safe to merge, with no actionable correctness or security defects identified in the changed behavior.
The conditional update keeps fresh claims exclusive, stale undelivered claims reclaimable, and successful delivery scoped to the exact claimed lapse; the added real-SQL tests cover the principal concurrency and replacement-generation cases.
| Filename | Overview |
|---|---|
| apps/server/src/services/integrations/slack/slack-connection-health.ts | Adds a stale-claim lease and generation-specific delivery stamp to preserve exclusive, recoverable Slack lapse notifications. |
| apps/server/src/services/integrations/slack/tests/slack-connection-health.test.ts | Expands real-SQL coverage for immediate exclusion, delayed reclamation, concurrent channel failures, and exact lapse closure. |
Reviews (1): Last reviewed commit: ["fix(slack): keep the lapse claim exclusi..
Libra has not measured any production surfaces for this change yet.