The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): skip the missing-allowlist warning when no messaging platform is enabled
teknium1ac91b9f385e9
diff --git a/gateway/run_startup.py b/gateway/run_startup.pyindex cbd278fe86d..46c0407251b 100644--- a/gateway/run_startup.py+++ b/gateway/run_startup.py@@ -894,7 +894,13 @@ class GatewayStartupMixin:entries = platform_registry.plugin_entries()allowed_vars += [e.allowed_users_env for e in entries if e.allowed_users_env]allow_all_vars += [e.allow_all_env for e in entries if e.allow_all_env]- if not any(os.getenv(v) for v in allowed_vars) and not any(+ # An API-server/webhook/local-only gateway has no messaging sender to gate, so the+ # reminder would be unactionable monitoring noise (#115439).+ non_messaging = {Platform.LOCAL, Platform.API_SERVER, Platform.WEBHOOK}+ has_messaging = any(+ cfg.enabled and platform not in non_messaging for platform, cfg in self.config.platforms.items()+ )+ if has_messaging and not any(os.getenv(v) for v in allowed_vars) and not any(os.getenv(v, "").lower() in {"true", "1", "yes"} for v in allow_all_vars):logger.warning(diff --git a/tests/gateway/test_allowlist_warning_platform_gate.py b/tests/gateway/test_allowlist_warning_platform_gate.pynew file mode 100644index 00000000000..dbe6c568804--- /dev/null+++ b/tests/gateway/test_allowlist_warning_platform_gate.py@@ -0,0 +1,41 @@+"""The startup "No env user allowlists configured" reminder fires only when a messaging+platform is enabled — an API-server-only gateway has no sender to gate (#115439)."""++import logging++import pytest++from gateway.config import GatewayConfig, Platform, PlatformConfig+from gateway.run import GatewayRunner++_WARNING = "No env user allowlists configured"+++def _runner(platforms, tmp_path):+ config = GatewayConfig(platforms=platforms, sessions_dir=tmp_path / "sessions")+ return GatewayRunner(config)+++ ("platforms", "expect_warning"),+ [+ ({Platform.API_SERVER: PlatformConfig(enabled=True, extra={"key": "k" * 40})}, False),+ ({Platform.API_SERVER: PlatformConfig(enabled=True), Platform.TELEGRAM: PlatformConfig(enabled=True)}, True),+ ({Platform.TELEGRAM: PlatformConfig(enabled=False)}, False),+ ],+ ids=["api_server_only", "api_server_plus_telegram", "telegram_disabled"],+)+def test_allowlist_warning_requires_an_enabled_messaging_platform(+ monkeypatch, tmp_path, caplog, platforms, expect_warning,+):+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))+ for var in list(GatewayRunner._BUILTIN_ALLOWED_USERS_VARS) + list(GatewayRunner._BUILTIN_ALLOW_ALL_VARS):+ monkeypatch.delenv(var, raising=False)+ monkeypatch.delenv("GATEWAY_ALLOW_ALL_USERS", raising=False)+ runner = _runner(platforms, tmp_path)++ with caplog.at_level(logging.WARNING, logger="gateway.run"):+ refused = runner._start_check_access_policy()++ assert refused is False+ assert (_WARNING in caplog.text) is expect_warning