hotfix: CLARIFY-Button ::-Format — resolve_gateway_clarify() wurde nie aufgerufen
ROOT CAUSE: Der ::-Format-Branch (CLARIFY:<id>::<choice>) extrahierte clarify_id und choice, machte dann aber NICHTS. Die gesamte Verarbeitungslogik (resolve_gateway_clarify, Cleanup, return) lag im else:-Block und wurde für ::-Format-Nachrichten nie erreicht. FIX: - Format-Extraktion (:: vs :) von der Verarbeitung getrennt - Beide Formate münden in gemeinsame if/elif/else-Verarbeitung - resolve_gateway_clarify() wird jetzt für BEIDE Formate aufgerufen - _rooms_with_pending_questions wird nach Clarify-Auflösung geleert (sowohl im Button-Handler als auch im Plain-Digit-Intercept) SYMPTOM: CLARIFY:d4bddd91dc::2 kam um 12:07:52 an, wurde als clarify_answer_bypass erkannt, aber resolve_gateway_clarify() wurde nie aufgerufen. Der Raum blieb 3+ Stunden in pending_questions. Jede weitere Nachricht wurde mit pending_questions_bypass übersprungen. PITFALLS: - P-013: CLARIFY-Antworten triggern False-Positive BUTTON_CLICK (nicht betroffen) - Plain-Digit-Intercept (2407-2448) blockiert CLARIFY-Button-Handler NICHT (is_clarify_response=True → wird korrekt übersprungen)
This commit is contained in:
+8
-1
@@ -2429,6 +2429,8 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
# Resolve via gateway and clean up
|
# Resolve via gateway and clean up
|
||||||
self._clarify_state.pop(clarify_id, None)
|
self._clarify_state.pop(clarify_id, None)
|
||||||
self._room_clarify.pop(room_id, None)
|
self._room_clarify.pop(room_id, None)
|
||||||
|
# Clean up pending_questions — Clarify is resolved
|
||||||
|
self._rooms_with_pending_questions.discard(room_id)
|
||||||
try:
|
try:
|
||||||
from tools.clarify_gateway import resolve_gateway_clarify
|
from tools.clarify_gateway import resolve_gateway_clarify
|
||||||
resolved = resolve_gateway_clarify(clarify_id, resolved_text)
|
resolved = resolve_gateway_clarify(clarify_id, resolved_text)
|
||||||
@@ -2454,18 +2456,21 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
routing_counter.increment('clarify_answer_bypass')
|
routing_counter.increment('clarify_answer_bypass')
|
||||||
logger.info("ROUTING BYPASS: reason=clarify_answer_bypass, origin_room=%s", room_id)
|
logger.info("ROUTING BYPASS: reason=clarify_answer_bypass, origin_room=%s", room_id)
|
||||||
try:
|
try:
|
||||||
|
# ── Format-Extraktion (gemeinsam für alt und neu) ──
|
||||||
if "::" in text:
|
if "::" in text:
|
||||||
# Neues Format: CLARIFY:<id>::<choice> (via _build_custom_buttons)
|
# Neues Format: CLARIFY:<id>::<choice> (via _build_custom_buttons)
|
||||||
prefix_part, choice = text.split("::", 1)
|
prefix_part, choice = text.split("::", 1)
|
||||||
clarify_id = prefix_part.split(":", 1)[1]
|
clarify_id = prefix_part.split(":", 1)[1]
|
||||||
else:
|
else:
|
||||||
# Altes Format: CLARIFY:<id>:other (Other-Button)
|
# Altes Format: CLARIFY:<id>:<token>
|
||||||
parts = text.split(":", 2)
|
parts = text.split(":", 2)
|
||||||
if len(parts) != 3:
|
if len(parts) != 3:
|
||||||
logger.debug("[rocketchat] Unrecognized CLARIFY format: %s", text)
|
logger.debug("[rocketchat] Unrecognized CLARIFY format: %s", text)
|
||||||
logger.debug("[rocketchat] ARCHIVAR-DEBUG: CLARIFY unrecognized format — skipping")
|
logger.debug("[rocketchat] ARCHIVAR-DEBUG: CLARIFY unrecognized format — skipping")
|
||||||
return
|
return
|
||||||
_, clarify_id, choice = parts
|
_, clarify_id, choice = parts
|
||||||
|
|
||||||
|
# ── Gemeinsame Verarbeitung (beide Formate) ──
|
||||||
if choice == "other":
|
if choice == "other":
|
||||||
# For "Other" button, enable text capture mode
|
# For "Other" button, enable text capture mode
|
||||||
from tools.clarify_gateway import mark_awaiting_text
|
from tools.clarify_gateway import mark_awaiting_text
|
||||||
@@ -2494,6 +2499,8 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
for rid, cid in list(self._room_clarify.items()):
|
for rid, cid in list(self._room_clarify.items()):
|
||||||
if cid == clarify_id:
|
if cid == clarify_id:
|
||||||
self._room_clarify.pop(rid, None)
|
self._room_clarify.pop(rid, None)
|
||||||
|
# Clean up pending_questions — Clarify is resolved
|
||||||
|
self._rooms_with_pending_questions.discard(room_id)
|
||||||
try:
|
try:
|
||||||
from tools.clarify_gateway import resolve_gateway_clarify
|
from tools.clarify_gateway import resolve_gateway_clarify
|
||||||
resolved = resolve_gateway_clarify(clarify_id, resolved_text)
|
resolved = resolve_gateway_clarify(clarify_id, resolved_text)
|
||||||
|
|||||||
Reference in New Issue
Block a user