fix(email): suppress ui notifications for incoming emails

linuztx committed Mar 23, 2026 at 13:24 UTC bdb0ed042bb943995b1d584c07706016d882982c
1 file changed -34
plugins/_email_integration/helpers/handler.py
-34
@@ -184,8 +184,6 @@ async def _dispatch_message(agent: Agent, handler_cfg: dict, msg: InboundMessage
184 await _route_to_chat(
185 agent, handler_cfg, msg, chat["context_id"],
186 )
187 - _send_notification(msg, "continue_chat", chat["context_id"],
188 - reason="thread ID match")
187 return
188
189 # Dispatcher AI decides
@@ -196,15 +194,12 @@ async def _dispatch_message(agent: Agent, handler_cfg: dict, msg: InboundMessage
194 ctx = AgentContext.get(decision.context_id)
195 if ctx:
196 await _route_to_chat(agent, handler_cfg, msg, decision.context_id)
199 - _send_notification(msg, "continue_chat", decision.context_id,
200 - reason=reason)
197 return
198 PrintStyle.warning(
199 f"Dispatcher referenced unknown context {decision.context_id}, starting new chat"
200 )
201
202 await _start_new_chat(agent, handler_cfg, msg)
207 - _send_notification(msg, "new_chat", reason=reason)
203
204
205 async def _call_model(
@@ -494,32 +489,3 @@ def _get_handler_config(handler_name: str) -> dict | None:
489 if h.get("name") == handler_name:
490 return h
491 return None
497 -
498 -
499 -# ------------------------------------------------------------------
500 -# Notifications
501 -# ------------------------------------------------------------------
502 -
503 -def _send_notification(
504 - msg: InboundMessage,
505 - action: str,
506 - context_id: str = "",
507 - reason: str = "",
508 -):
509 - subject = msg.subject[:80] if msg.subject else "(no subject)"
510 - if action == "new_chat":
511 - title = "Email: new chat"
512 - message = f"From {msg.sender}: {subject}"
513 - else:
514 - title = "Email: continuing chat"
515 - message = f"From {msg.sender}: {subject} → {context_id}"
516 - if reason:
517 - message += f" ({reason})"
518 - NotificationManager.send_notification(
519 - type=NotificationType.INFO,
520 - priority=NotificationPriority.HIGH,
521 - title=title,
522 - message=message,
523 - display_time=10,
524 - group="email",
525 - )