fix(gateway): preserve Telegram DM topic routing metadata in synthetic notifications

This commit is contained in:
Dusk1e
2026-05-31 12:13:46 -07:00
committed by kshitij
parent 59cc7c305d
commit 4259bab7d4
3 changed files with 121 additions and 25 deletions
+7 -1
View File
@@ -210,6 +210,7 @@ class TestHandleUpdateCommand:
data = json.loads(pending_path.read_text())
assert data["platform"] == "telegram"
assert data["chat_id"] == "99999"
assert data["chat_type"] == "dm"
assert "timestamp" in data
assert not (hermes_home / ".update_exit_code").exists()
@@ -469,6 +470,7 @@ class TestSendUpdateNotification:
pending = {
"platform": "telegram",
"chat_id": "67890",
"chat_type": "dm",
"thread_id": "777",
"user_id": "12345",
}
@@ -482,7 +484,11 @@ class TestSendUpdateNotification:
with patch("gateway.run._hermes_home", hermes_home):
await runner._send_update_notification()
assert mock_adapter.send.call_args.kwargs["metadata"] == {"thread_id": "777"}
assert mock_adapter.send.call_args.kwargs["metadata"] == {
"thread_id": "777",
"telegram_dm_topic_reply_fallback": True,
"direct_messages_topic_id": "777",
}
@pytest.mark.asyncio
async def test_strips_ansi_codes(self, tmp_path):