Skip to content

feat: add opt-in gateway startup notifications - #30787

Open
vampyren wants to merge 1 commit into
NousResearch:mainfrom
vampyren:feat/gateway-startup-notification
Open

feat: add opt-in gateway startup notifications#30787
vampyren wants to merge 1 commit into
NousResearch:mainfrom
vampyren:feat/gateway-startup-notification

Conversation

@vampyren

Copy link
Copy Markdown
Contributor

Summary

  • Add per-platform gateway_startup_notification opt-in setting
  • Send the existing home-channel “Gateway online” notice after ordinary gateway startups, not only /restart
  • Keep default false to avoid noisy lifecycle pings for public/end-user bots
  • Add a 5-minute per-target debounce to avoid spam during crash loops

Why

Operators may have gateways restarted externally by systemd, host backup windows, VM maintenance, or process recovery. Today the gateway can notify after Hermes-initiated /restart, but external restarts have no .restart_notify.json marker, so operators may not know when the gateway is back.

Test Plan

  • python -m pytest tests/gateway/test_config.py tests/gateway/test_restart_notification.py -q

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels May 23, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related: #24271 (same opt-in gateway_startup_notification feature, global-level). Also overlaps with #27278 (unconditional approach). This PR adds per-platform granularity and 5-minute debounce on top of the same concept.

@vampyren
vampyren force-pushed the feat/gateway-startup-notification branch from 680478a to 8be7061 Compare May 24, 2026 09:55
@vampyren

Copy link
Copy Markdown
Contributor Author

Updated the commit author to use my GitHub noreply address so contributor attribution should pass once workflows are approved.

This PR intentionally overlaps with #24271/#27278, but takes the conservative operator-focused shape:
- opt-in only, default false
- per-platform configuration instead of a global-only toggle
- 5-minute per-target debounce to avoid crash-loop spam
- preserves the existing /restart notification behavior

Happy to adjust or close this if maintainers prefer one of the earlier approaches. Targeted validation:
python -m pytest tests/gateway/test_config.py tests/gateway/test_restart_notification.py -q

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 13, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the focused opt-in design. The ordinary-start gap is still present on current main: gateway/run.py:7307-7313 sends the home-channel online message only when the planned-restart marker exists.

Problems

  • The new tests call the private sender directly (tests/gateway/test_restart_notification.py:340 in this PR) rather than exercising the changed GatewayRunner.start() path. They do not establish that a no-marker ordinary startup reaches the sender after configuration is loaded.
  • The new persistent setting has no documentation update. Existing lifecycle notification configuration is documented at website/docs/user-guide/messaging/index.md:575-590.
  • Current main now has explicit planned-restart and chat-originated-restart marker handling at gateway/run.py:7292-7313; the salvage needs to preserve those distinct paths while adding the opt-in ordinary-start case.

Suggested changes

  • Add real startup lifecycle coverage for default-quiet and opt-in ordinary starts, plus marker-precedence coverage.
  • Document the finalized configuration surface alongside gateway_restart_notification.

Automated hermes-sweeper review.

adapter.send.assert_called_once()


@pytest.mark.asyncio

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a lifecycle-level regression that drives GatewayRunner.start() with no restart markers. Calling this helper directly does not verify that the ordinary-start branch invokes it after configuration is loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants