{"repo":"NousResearch/hermes-agent","public_id":"6033","display_label":"Telegram slash commands and require_mention in group chats","summary":"The members concern Telegram slash commands apparently bypassing the require_mention setting in groups, reportedly leading to duplicate responses when multiple bots are present. One item reports the problem, and the other two are pull requests that propose making slash commands respect require_mention; one of them is described as a salvage of #6036.","subsystem":null,"counts":{"members":3,"open_issues":0,"open_issues_distinct":0,"open_prs":0,"closed_issues":1,"merged_prs":1,"attempt_prs":1},"landed_fix":{"status":"merged_to_main","basis":"structural","pr":13438,"merged_at":"2026-04-21T10:06:57+00:00"},"resolution":{"state":"resolved","by":"pr-13438"},"freshness":{"state":"stale","last_verified_at":"2026-04-21T10:06:57+00:00","is_stale":true},"grouping":{"backbone":"STRUCTURAL_SPANNING","link_density":0.6666666666666666},"fix_edges":[{"issue_number":6033,"pr_number":13438,"tier":"verified","basis":"closing_ref","confidence":0.95,"recoverable_from_timeline":true,"pr_merged_at":"2026-04-21T10:06:57+00:00"}],"members":[{"kind":"issue","number":6033,"title":"Telegram: slash commands bypass require_mention causing duplicate responses in multi-bot groups","url":null,"state":"closed"},{"kind":"pr","number":6036,"title":"fix: slash commands now respect require_mention in Telegram groups","url":null,"state":"closed","close_reason":{"category":"silent_close","implication":"active"},"merged":false},{"kind":"pr","number":13438,"title":"fix(telegram): slash commands respect require_mention in groups (salvage of #6036)","url":null,"state":"merged","close_reason":{"category":"merged"},"merged":true,"is_fix_pr":true,"fix_tier":"verified","files_changed":["gateway/platforms/telegram.py","scripts/release.py","tests/gateway/test_telegram_group_gating.py"],"fix_hunks":[{"file":"gateway/platforms/telegram.py","hunks":["@@ -2333,10 +2333,16 @@ def _should_process_message(self, message: Message, *, is_command: bool = False)\n         DMs remain unrestricted. Group/supergroup messages are accepted when:\n         - the chat is explicitly allowlisted in ``free_response_chats``\n         - ``require_mention`` is disabled\n-        - the message is a command\n         - the message replies to the bot\n         - the bot is @mentioned\n         - the text/caption matches a configured regex wake-word pattern\n+\n+        When ``require_mention`` is enabled, slash commands are not given\n+        special treatment — they must pass the same mention/reply checks\n+        as any other group message.  Users can still trigger commands via\n+        the Telegram bot menu (``/command@botname``) or by explicitly\n+        mentioning the bot (``@botname /command``), both of which are\n+        recognised as mentions by :meth:`_message_mentions_bot`.\n         \"\"\"\n         if not self._is_group_chat(message):\n             return True","@@ -2351,8 +2357,6 @@ def _should_process_message(self, message: Message, *, is_command: bool = False)\n             return True\n         if not self._telegram_require_mention():\n             return True\n-        if is_command:\n-            return True\n         if self._is_reply_to_bot(message):\n             return True\n         if self._message_mentions_bot(message):"]},{"file":"scripts/release.py","hunks":["@@ -326,6 +326,7 @@\n     \"aniruddhaadak80@users.noreply.github.com\": \"aniruddhaadak80\",\n     \"[redacted:email]\": \"jerilynzheng\",\n     \"[redacted:email]\": \"Aslaaen\",\n+    \"[redacted:email]\": \"pinion05\",\n }\n \n "]},{"file":"tests/gateway/test_telegram_group_gating.py","hunks":["@@ -71,7 +71,17 @@ def test_group_messages_can_require_direct_trigger_via_config():\n     assert adapter._should_process_message(_group_message(\"hello everyone\")) is False\n     assert adapter._should_process_message(_group_message(\"hi @hermes_bot\", entities=[_mention_entity(\"hi @hermes_bot\")])) is True\n     assert adapter._should_process_message(_group_message(\"replying\", reply_to_bot=True)) is True\n-    assert adapter._should_process_message(_group_message(\"/status\"), is_command=True) is True\n+    # Commands must also respect require_mention when it is enabled\n+    assert adapter._should_process_message(_group_message(\"/status\"), is_command=True) is False\n+    # But commands with @mention still pass (Telegram emits a MENTION entity\n+    # for /cmd@botname — the bot menu and python-telegram-bot's CommandHandler\n+    # rely on this same mechanism)\n+    assert adapter._should_process_message(\n+        _group_message(\"/status@hermes_bot\", entities=[_mention_entity(\"/status@hermes_bot\")])\n+    ) is True\n+    # And commands still pass unconditionally when require_mention is disabled\n+    adapter_no_mention = _make_adapter(require_mention=False)\n+    assert adapter_no_mention._should_process_message(_group_message(\"/status\"), is_command=True) is True\n \n \n def test_free_response_chats_bypass_mention_requirement():\n"]}]}],"trust":{"default_tier":"verified","includes_suggested":false}}