feat(gateway): per-platform gateway_restart_notification flag

Adds an opt-out toggle on PlatformConfig that gates both restart
lifecycle pings: the "♻ Gateway restarted" message sent to the chat
that issued /restart, and the "♻️ Gateway online" home-channel
startup notification. Defaults to True so existing deployments are
unaffected.

The motivating split is operator vs. end-user surfaces: a back-channel
like Telegram should keep these pings, while a Slack workspace shared
with end users should not surface gateway lifecycle noise.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Guillaume Meyer 2026-05-06 15:37:04 +00:00 committed by Teknium
parent 33bf5f6292
commit b71f80e6ce
4 changed files with 120 additions and 4 deletions

View file

@ -57,6 +57,19 @@ class TestPlatformConfigRoundtrip:
restored = PlatformConfig.from_dict({"enabled": "false"})
assert restored.enabled is False
def test_gateway_restart_notification_defaults_true(self):
assert PlatformConfig().gateway_restart_notification is True
assert PlatformConfig.from_dict({}).gateway_restart_notification is True
def test_gateway_restart_notification_roundtrip_false(self):
pc = PlatformConfig(enabled=True, gateway_restart_notification=False)
restored = PlatformConfig.from_dict(pc.to_dict())
assert restored.gateway_restart_notification is False
def test_gateway_restart_notification_coerces_quoted_false(self):
restored = PlatformConfig.from_dict({"gateway_restart_notification": "false"})
assert restored.gateway_restart_notification is False
class TestGetConnectedPlatforms:
def test_returns_enabled_with_token(self):