fix: signature learning never skips support@/info@/admin@ senders (#1773)

This commit is contained in:
Afonso Coutinho
2026-06-03 05:22:52 +01:00
committed by GitHub
parent 694647375c
commit db1596f3b4
2 changed files with 47 additions and 6 deletions
+12 -6
View File
@@ -956,6 +956,17 @@ async def action_mark_email_boundaries(owner: str, **kwargs) -> Tuple[str, bool]
return str(e), False
# Sender local-parts (matched exactly or by prefix) whose mail never carries a
# personal signature worth learning. These compare against the local-part
# (before "@"), so role names must NOT include a trailing "@" — "support@" etc.
# could never match a local-part of "support" and were silently dead.
_SIG_SKIP_PREFIXES = (
"noreply", "no-reply", "donotreply", "do-not-reply",
"mailer-daemon", "notifications", "notification", "bounce",
"newsletter", "support", "info", "admin",
)
async def action_learn_sender_signatures(owner: str, **kwargs) -> Tuple[str, bool]:
"""For each sender with ≥3 recent inbox emails, ask the LLM to extract
the common signature block across their messages. The cached sig is
@@ -1013,16 +1024,11 @@ async def action_learn_sender_signatures(owner: str, **kwargs) -> Tuple[str, boo
return "No emails to scan", True
# 2. Group by sender; drop addresses that don't carry useful sigs.
SKIP_PREFIXES = (
"noreply", "no-reply", "donotreply", "do-not-reply",
"mailer-daemon", "notifications", "notification", "bounce",
"newsletter", "support@", "info@", "admin@",
)
by_sender: dict[str, list[dict]] = {}
for m in mails:
addr = m["from_address"]
local = addr.split("@", 1)[0]
if any(local == p or local.startswith(p) for p in SKIP_PREFIXES):
if any(local == p or local.startswith(p) for p in _SIG_SKIP_PREFIXES):
continue
# Skip plus-aliases / list-style addresses too.
if "+" in local or "-noreply" in addr or "-bounces" in addr: