Gating the outbox insert on the inbox CTE's RETURNING is a neat way to get both rows or neither. One small addition for the handler: on the duplicate path, return a 2xx to the sender, not a 409. Many providers treat any non-2xx as a failed delivery and keep retrying, so a correct duplicate check can still produce a retry storm.
