perf(slack): defer full queue views until notification selection (#642)
The Slack outbound sweep built the full queue view (pickup, waiting and recovery state, activity and delivery ledger) for every active row before checking whether that row's owner notification had already been delivered. Selection now reads active row IDs with the same filter, order and million-row cap, keeps the existing latest-notification and exact-receipt checks, and builds the full view only for rows that still need delivery. Slack projection, human-alert filtering, receipts, seen state and dispatch are unchanged; a row that is gone or no longer active is not posted, and a failed read still fails the sweep rather than counting as delivered. In a synthetic 200-row queue with 2 undelivered notifications, full views fall from 200 to 2 and the median sweep from about 335 ms to about 27 ms. When every active row carries an undelivered notification the extra point reads make the sweep roughly 9-11% slower. It is still a scan of all active rows, delivery remains at-least-once, and no live CPU or health improvement is claimed. Enable-time seeding and the delivery digest use the same selection and keep their behavior. Refs #161 Based on korallis/agent-stack#139 by korallis and Lee.
M
Mike Schwarz committed
67e81ec9bb993f8abfac71e7b7205b06e7a92381
Parent: 7748b87
Committed by GitHub <noreply@github.com>
on 10/3/2026, 9:35:23 PM