From baddb6f7174cce578c403dc356f6f76c1f4c8bea Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Fri, 10 Apr 2026 17:27:32 -0700 Subject: [PATCH] fix(gateway): derive channel directory platforms from enum instead of hardcoded list (#7450) Six platforms (matrix, mattermost, dingtalk, feishu, wecom, homeassistant) were missing from the session-based discovery loop, causing /channels and send_message to return empty results on those platforms. Instead of adding them to the hardcoded tuple (which would break again when new platforms are added), derive the list dynamically from the Platform enum. Only infrastructure entries (local, api_server, webhook) are excluded; Discord and Slack are skipped automatically because their direct builders already populate the platforms dict. Reported by sprmn24 in PR #7416. --- gateway/channel_directory.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gateway/channel_directory.py b/gateway/channel_directory.py index f873414e..ae2beda9 100644 --- a/gateway/channel_directory.py +++ b/gateway/channel_directory.py @@ -76,10 +76,15 @@ def build_channel_directory(adapters: Dict[Any, Any]) -> Dict[str, Any]: except Exception as e: logger.warning("Channel directory: failed to build %s: %s", platform.value, e) - # Telegram, WhatsApp & Signal can't enumerate chats -- pull from session history - for plat_name in ("telegram", "whatsapp", "signal", "weixin", "email", "sms", "bluebubbles"): - if plat_name not in platforms: - platforms[plat_name] = _build_from_sessions(plat_name) + # Platforms that don't support direct channel enumeration get session-based + # discovery automatically. Skip infrastructure entries that aren't messaging + # platforms — everything else falls through to _build_from_sessions(). + _SKIP_SESSION_DISCOVERY = frozenset({"local", "api_server", "webhook"}) + for plat in Platform: + plat_name = plat.value + if plat_name in _SKIP_SESSION_DISCOVERY or plat_name in platforms: + continue + platforms[plat_name] = _build_from_sessions(plat_name) directory = { "updated_at": datetime.now().isoformat(),