Feature Description
When the gateway shuts down, a notification is sent to active sessions and home channels (via _notify_active_sessions_of_shutdown). But when the gateway starts up for the first time (not a /restart), there is no equivalent notification to home channels.
Motivation
Users who rely on messaging platforms (WeChat, Telegram, etc.) as their primary interface to Hermes have no way to know whether the gateway is alive after a server reboot, systemd restart, or crash recovery — except by sending a message and waiting for a reply. A startup notification would give immediate confidence that the gateway is operational.
Proposed Solution
Proposed Solution
Two changes in gateway/run.py:
1. _send_home_channel_startup_notifications() — accept a custom message
Add an optional message parameter so callers can differentiate first-time startup from /restart recovery:
async def _send_home_channel_startup_notifications(
self,
*,
skip_targets: Optional[set[...]] = None,
message: str = "♻ Gateway online — Hermes is back and ready.",
) -> set[...]:
And remove the hardcoded message = "♻ …" inside the function body in favor of the parameter.
2. start() method — always call the notification, not just on restart
Currently the call is guarded by:
if restart_notification_pending or delivered_restart_target is not None:
await self._send_home_channel_startup_notifications(...)
Change it to always invoke, with different messages:
Reble Wang(Lord.Rebel) 5/18 16:24:19
skip_home_targets = (
{delivered_restart_target} if delivered_restart_target else None
)
if restart_notification_pending or delivered_restart_target is not None:
await self._send_home_channel_startup_notifications(
skip_targets=skip_home_targets,
)
else:
await self._send_home_channel_startup_notifications(
skip_targets=skip_home_targets,
message="✅ Gateway online — ready to serve.",
)
3. (Optional) Add a config toggle
A notify_on_startup: bool = True field in the platform config (alongside the existing gateway_restart_notification) would let users opt out.
Alternatives Considered
- Hooks system: The gateway already emits
gateway:startup via HookRegistry, but the hook context ({"platforms": [...]}) doesn't include adapter references, so a hook handler cannot send messages without additional code changes in hooks.py.
Affected Files
gateway/run.py — _send_home_channel_startup_notifications() signature + start() caller logic
- (Optional)
gateway/config.py — add notify_on_startup field
Related
- Uses the same delivery path as the existing shutdown notification (
_notify_active_sessions_of_shutdown), including respecting the gateway_restart_notification: false per-platform opt-out.
Alternatives Considered
No response
Feature Type
Gateway / messaging improvement
Scope
None
Contribution
Debug Report (optional)
Feature Description
When the gateway shuts down, a notification is sent to active sessions and home channels (via
_notify_active_sessions_of_shutdown). But when the gateway starts up for the first time (not a/restart), there is no equivalent notification to home channels.Motivation
Users who rely on messaging platforms (WeChat, Telegram, etc.) as their primary interface to Hermes have no way to know whether the gateway is alive after a server reboot, systemd restart, or crash recovery — except by sending a message and waiting for a reply. A startup notification would give immediate confidence that the gateway is operational.
Proposed Solution
Proposed Solution
Two changes in
gateway/run.py:1.
_send_home_channel_startup_notifications()— accept a custom messageAdd an optional
messageparameter so callers can differentiate first-time startup from/restartrecovery:And remove the hardcoded
message = "♻ …"inside the function body in favor of the parameter.2.
start()method — always call the notification, not just on restartCurrently the call is guarded by:
Change it to always invoke, with different messages:
3. (Optional) Add a config toggle
A
notify_on_startup: bool = Truefield in the platform config (alongside the existinggateway_restart_notification) would let users opt out.Alternatives Considered
gateway:startupviaHookRegistry, but the hook context ({"platforms": [...]}) doesn't include adapter references, so a hook handler cannot send messages without additional code changes inhooks.py.Affected Files
gateway/run.py—_send_home_channel_startup_notifications()signature +start()caller logicgateway/config.py— addnotify_on_startupfieldRelated
_notify_active_sessions_of_shutdown), including respecting thegateway_restart_notification: falseper-platform opt-out.Alternatives Considered
No response
Feature Type
Gateway / messaging improvement
Scope
None
Contribution
Debug Report (optional)