Skip to content

[Feature]: send startup notification to home channels when gateway first comes online #27870

Description

@lordrebel

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

  • I'd like to implement this myself and submit a PR

Debug Report (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/gatewayGateway runner, session dispatch, deliverytype/featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions