From 5e9c4ece77ec7ec4895ae0fa342cc80584b24530 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Sat, 6 Jun 2026 20:43:36 +0200 Subject: [PATCH] fix(adapter): button clicks bypass Archivar routing Button responses (`is_button_response`) are ALWAYS direct replies to an agent question and carry a `question_id::choice` payload. Routing them through the Archivar risked landing a one-character "A" in the catch-all room where the agent would see it without the original question context. Now button clicks skip `classify_and_route()` entirely and stay in whatever room they originated from. --- plugin/adapter.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugin/adapter.py b/plugin/adapter.py index 24ca1cc..386631f 100644 --- a/plugin/adapter.py +++ b/plugin/adapter.py @@ -597,9 +597,17 @@ class RocketChatAdapter(BasePlatformAdapter): category = "" decision = None try: - decision = await self.archivar.handle_and_forward(text, origin_room_id=room_id, message_id=msg_id) - if decision and decision.category: - category = decision.category + # Button clicks and button responses are ALWAYS direct replies + # to an agent question — they carry a question_id::choice payload + # and must never be routed through the Archivar. Routing them + # risks landing a one-character "A" in the catch-all room where + # the agent sees it without the question context. + if not is_button_response: + decision = await self.archivar.handle_and_forward(text, origin_room_id=room_id, message_id=msg_id) + if decision and decision.category: + category = decision.category + else: + logger.debug("[rocketchat] Button response — Archivar bypassed for %s", text[:40]) except Exception as e: logger.debug("[rocketchat] Archivar classification skipped: %s", e)