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 <noreply@anthropic.com>
This commit is contained in:
nickviljoen 2026-03-12 08:46:10 +02:00
parent d609abe606
commit a979b32193

View file

@ -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]