Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(google): treat separator and localized no-reply senders as noise (#7856)

garrytanbca6265f5da6
diff --git a/recipes/email-to-brain.md b/recipes/email-to-brain.md
index 01b7866104..3f08498d6f 100644
--- a/recipes/email-to-brain.md
+++ b/recipes/email-to-brain.md
@@ -95,7 +95,8 @@ you know what the connector does, not so you re-build it:
- **Noise filtering (deterministic):** noreply/no-reply/notifications@/
calendar-notification/mailer-daemon/postmaster/donotreply senders never open
- loops. List mail (`List-Unsubscribe`) is excluded too.
+ loops, nor do local parts spelled no_reply/no.reply/do_not_reply,
+ noresponder, notificaciones@/notificacoes@, ne-pas-repondre or keine-antwort. List mail (`List-Unsubscribe`) is excluded too.
- **Gmail deep links are generated by CODE, never by the LLM** — every thread
page carries an account-correct `authuser` deep link, so links are always
right.
diff --git a/src/core/google/google-render.ts b/src/core/google/google-render.ts
index bc546666e1..b3118b0688 100644
--- a/src/core/google/google-render.ts
+++ b/src/core/google/google-render.ts
@@ -31,6 +31,13 @@ const NOISE_SENDER_SUBSTRINGS = [
'do-not-reply',
];
+/**
+ * #7856: separator and localized no-reply spellings, matched against the
+ * local part only (from its start or after a separator), so a person whose
+ * name or domain merely contains a fragment stays a person.
+ */
+const NOISE_LOCAL_PART = /(?:^|[-._+])(?:no[._]reply|do[-._]not[-._]reply|no[-._]?responder|ne[-._]?pas[-._]?repondre|keine[-._]?antwort)|notifica(?:ciones|coes)$/;
+
/**
* Fixed Google system addresses that carry no human obligation (#5103: the
* Meet notes digest). Matched by EQUALITY, never as a substring, so a
@@ -40,7 +47,8 @@ const GOOGLE_SYSTEM_SENDERS: ReadonlySet<string> = new Set(['gemini-notes@google
export function isNoiseSender(fromAddress: string): boolean {
const f = fromAddress.toLowerCase();
- return GOOGLE_SYSTEM_SENDERS.has(f) || NOISE_SENDER_SUBSTRINGS.some((p) => f.includes(p));
+ return GOOGLE_SYSTEM_SENDERS.has(f) || NOISE_SENDER_SUBSTRINGS.some((p) => f.includes(p))
+ || NOISE_LOCAL_PART.test(f.replace(/@[^@]*$/, ''));
}
const BULK_PRECEDENCE = new Set(['bulk', 'list', 'junk']);
diff --git a/test/google-render.test.ts b/test/google-render.test.ts
index af0ccc57f4..a548a9ed59 100644
--- a/test/google-render.test.ts
+++ b/test/google-render.test.ts
@@ -158,6 +158,28 @@ describe('isNoiseSender', () => {
expect(isNoiseSender('[email protected]')).toBe(false);
});
+ test('#7856: separator and localized no-reply local parts are noise', () => {
+ for (const address of [
+ ]) {
+ expect([address, isNoiseSender(address)]).toEqual([address, true]);
+ }
+ });
+
+ test('#7856: a person whose name or domain merely contains a fragment stays a person', () => {
+ for (const address of [
+ ]) {
+ expect([address, isNoiseSender(address)]).toEqual([address, false]);
+ }
+ });
+
test('#5103: Google system senders match by exact address, never by substring', () => {
expect(isNoiseSender('[email protected]')).toBe(true);
expect(isNoiseSender('[email protected]')).toBe(true);