mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-24 05:41:40 +00:00
fix(telegram): default notifications to 'important' (silence intermediate)
Per-tool-call push notifications on Telegram are noisy enough that
'all' is the wrong default — long agent runs spam the user's notification
shade with status messages they didn't ask to be pinged about. Final
responses, approval prompts, and slash confirmations still notify;
intermediate progress, streaming, and tool-progress messages now
deliver silently via disable_notification.
Users who want the legacy behavior can opt back in with:
display:
platforms:
telegram:
notifications: all
or HERMES_TELEGRAM_NOTIFICATIONS=all.
This commit is contained in:
parent
b4d3092f69
commit
448c11f16d
2 changed files with 9 additions and 6 deletions
|
|
@ -320,11 +320,14 @@ class TelegramAdapter(BasePlatformAdapter):
|
||||||
# and any other slash-confirm prompts; see GatewayRunner._request_slash_confirm).
|
# and any other slash-confirm prompts; see GatewayRunner._request_slash_confirm).
|
||||||
self._slash_confirm_state: Dict[str, str] = {}
|
self._slash_confirm_state: Dict[str, str] = {}
|
||||||
# Notification mode for message sends.
|
# Notification mode for message sends.
|
||||||
# "all" — every message triggers a push notification (default).
|
|
||||||
# "important" — only final responses, approvals, and slash confirmations
|
# "important" — only final responses, approvals, and slash confirmations
|
||||||
# trigger notifications; tool progress, streaming, status
|
# trigger notifications; tool progress, streaming, status
|
||||||
# messages are delivered silently via disable_notification.
|
# messages are delivered silently via disable_notification.
|
||||||
self._notifications_mode: str = "all"
|
# This is the default — Telegram users found per-tool-call
|
||||||
|
# push notifications too noisy.
|
||||||
|
# "all" — every message triggers a push notification (legacy
|
||||||
|
# behavior; opt-in via display.platforms.telegram.notifications).
|
||||||
|
self._notifications_mode: str = "important"
|
||||||
|
|
||||||
def _notification_kwargs(
|
def _notification_kwargs(
|
||||||
self, metadata: Optional[Dict[str, Any]]
|
self, metadata: Optional[Dict[str, Any]]
|
||||||
|
|
@ -335,7 +338,7 @@ class TelegramAdapter(BasePlatformAdapter):
|
||||||
(disable_notification=True) unless the caller explicitly requests a
|
(disable_notification=True) unless the caller explicitly requests a
|
||||||
notification by setting ``metadata["notify"] = True``.
|
notification by setting ``metadata["notify"] = True``.
|
||||||
"""
|
"""
|
||||||
if getattr(self, "_notifications_mode", "all") != "important":
|
if getattr(self, "_notifications_mode", "important") != "important":
|
||||||
return {}
|
return {}
|
||||||
if (metadata or {}).get("notify"):
|
if (metadata or {}).get("notify"):
|
||||||
return {}
|
return {}
|
||||||
|
|
|
||||||
|
|
@ -4662,14 +4662,14 @@ class GatewayRunner:
|
||||||
_notify_mode = str(_raw).strip().lower()
|
_notify_mode = str(_raw).strip().lower()
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
_notify_mode = _notify_mode or "all"
|
_notify_mode = _notify_mode or "important"
|
||||||
if _notify_mode not in ("all", "important"):
|
if _notify_mode not in ("all", "important"):
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Unknown telegram notifications mode '%s', "
|
"Unknown telegram notifications mode '%s', "
|
||||||
"defaulting to 'all' (valid: all, important)",
|
"defaulting to 'important' (valid: all, important)",
|
||||||
_notify_mode,
|
_notify_mode,
|
||||||
)
|
)
|
||||||
_notify_mode = "all"
|
_notify_mode = "important"
|
||||||
adapter._notifications_mode = _notify_mode
|
adapter._notifications_mode = _notify_mode
|
||||||
return adapter
|
return adapter
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue