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.
This commit is contained in:
Hermes Agent
2026-06-06 20:43:36 +02:00
parent ad852c1642
commit 5e9c4ece77
+8
View File
@@ -597,9 +597,17 @@ class RocketChatAdapter(BasePlatformAdapter):
category = ""
decision = None
try:
# 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)