From a979b321930a38d9445dcfddfe32a25da85326dc Mon Sep 17 00:00:00 2001 From: nickviljoen Date: Thu, 12 Mar 2026 08:46:10 +0200 Subject: [PATCH] Exclude placeholder @agenthub.com emails from notification recipients The default admin@agenthub.com account is not a real email address, causing delivery failures when notifications are sent. Filter it out from both threshold alerts and weekly digest recipient queries. Co-Authored-By: Claude Opus 4.6 --- notifications.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/notifications.py b/notifications.py index bd3e9e7..b0380ac 100644 --- a/notifications.py +++ b/notifications.py @@ -98,9 +98,9 @@ async def check_and_notify_threshold(agent_name: str): if recent: return - # Get admin user emails + # Get admin user emails (exclude placeholder accounts with no real domain) admin_cursor = users_collection.find( - {"is_admin": True, "is_active": True}, + {"is_admin": True, "is_active": True, "email": {"$not": {"$regex": r"@agenthub\.com$"}}}, {"email": 1}, ) admin_emails = [doc["email"] async for doc in admin_cursor] @@ -264,9 +264,9 @@ async def send_weekly_agent_digest(): except Exception: agent["created_by_email"] = created_by - # Get admin emails + # Get admin emails (exclude placeholder accounts with no real domain) admin_cursor = users_collection.find( - {"is_admin": True, "is_active": True}, + {"is_admin": True, "is_active": True, "email": {"$not": {"$regex": r"@agenthub\.com$"}}}, {"email": 1}, ) admin_emails = [doc["email"] async for doc in admin_cursor]