From 6c8d130a7b016fb04a7c38bbd3decd3cfebd7c69 Mon Sep 17 00:00:00 2001 From: rudidev08 Date: Thu, 6 Aug 2026 19:55:54 -0700 Subject: [PATCH] fix: classify Matrix gateway sessions as messaging --- api/agent_sessions.py | 2 ++ static/sessions.js | 3 ++- tests/test_gateway_sync.py | 9 ++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/api/agent_sessions.py b/api/agent_sessions.py index c2b122d9..c8fe0aec 100644 --- a/api/agent_sessions.py +++ b/api/agent_sessions.py @@ -47,6 +47,7 @@ MESSAGING_SOURCES = { 'slack', 'telegram', 'weixin', + 'matrix', } CLI_MIN_UNTITLED_MESSAGE_COUNT = 6 @@ -68,6 +69,7 @@ SOURCE_LABELS = { 'webhook': 'Webhook', 'webui': 'WebUI', 'weixin': 'Weixin', + 'matrix': 'Matrix', } diff --git a/static/sessions.js b/static/sessions.js index f2f6ed31..d6b4a7d7 100644 --- a/static/sessions.js +++ b/static/sessions.js @@ -2390,7 +2390,7 @@ const _HANDOFF_THRESHOLD = 10; // conversation rounds const _HANDOFF_STORAGE_PREFIX = 'handoff:'; const _HANDOFF_SUFFIX_DISMISSED_AT = 'dismissed_at'; const _HANDOFF_SUFFIX_SUMMARY_HANDLED_AT = 'summary_handled_at'; -const _MESSAGING_RAW_SOURCES = new Set(['weixin', 'telegram', 'discord', 'slack', 'email', 'wecom', 'wecom_callback']); +const _MESSAGING_RAW_SOURCES = new Set(['weixin', 'telegram', 'discord', 'slack', 'email', 'wecom', 'wecom_callback', 'matrix']); const _MESSAGING_SOURCE_LABELS = { weixin: 'WeChat', telegram: 'Telegram', @@ -2399,6 +2399,7 @@ const _MESSAGING_SOURCE_LABELS = { email: 'Email', wecom: 'WeCom', wecom_callback: 'WeCom Callback', + matrix: 'Matrix', }; function _isMessagingSession(session) { diff --git a/tests/test_gateway_sync.py b/tests/test_gateway_sync.py index 9af91012..131e8b9a 100644 --- a/tests/test_gateway_sync.py +++ b/tests/test_gateway_sync.py @@ -1019,6 +1019,7 @@ def test_agent_session_source_normalization_contract(): 'telegram': ('messaging', 'Telegram'), 'discord': ('messaging', 'Discord'), 'slack': ('messaging', 'Slack'), + 'matrix': ('messaging', 'Matrix'), 'cron': ('cron', 'Cron'), 'webhook': ('webhook', 'Webhook'), 'tool': ('tool', 'Tool'), @@ -1044,16 +1045,17 @@ def test_sessions_js_treats_email_as_messaging_source(): raw_section = src[src.find("_MESSAGING_RAW_SOURCES"):src.find("function _isMessagingSession")] label_section = src[src.find("_MESSAGING_SOURCE_LABELS"):src.find("function _isMessagingSession")] - for raw_source in ("email", "wecom", "wecom_callback"): + for raw_source in ("email", "wecom", "wecom_callback", "matrix"): assert f"'{raw_source}'" in raw_section, f"Missing raw source {raw_source!r} in _MESSAGING_RAW_SOURCES" assert "email: 'Email'" in label_section assert "wecom: 'WeCom'" in label_section assert "wecom_callback: 'WeCom Callback'" in label_section + assert "matrix: 'Matrix'" in label_section -def test_sessions_js_treats_wecom_sidecars_as_messaging_behaviorally(): - """Stale WeCom sidecars with session_source=other should still route as messaging.""" +def test_sessions_js_treats_messaging_sidecars_behaviorally(): + """Stale messaging sidecars with session_source=other should still route as messaging.""" src = (REPO_ROOT / "static" / "sessions.js").read_text(encoding="utf-8") start = src.index("const _MESSAGING_RAW_SOURCES") end = src.index("/**", start) @@ -1064,6 +1066,7 @@ const cases = [ {{ session_source: 'other', source: 'wecom' }}, {{ session_source: 'other', raw_source: 'wecom_callback' }}, {{ session_source: 'other', source_tag: 'wecom' }}, + {{ session_source: 'other', source: 'matrix' }}, {{ session_source: 'messaging', source: 'anything' }}, ]; for (const c of cases) {{