fix: P0 — DM-Routing broken: is_dm Parameter statt origin_room_id=None Proxy (Butler Move-Request war toter Code)

This commit is contained in:
Bernd (Hermes)
2026-07-19 20:26:20 +02:00
parent e7b10cd7f9
commit 7298459fc8
7 changed files with 377 additions and 33 deletions
+11 -3
View File
@@ -405,12 +405,12 @@ class BidirectionalRouter:
# 'cognitive' und 'strict': aktuelles Verhalten beibehalten
return move_request_sent
async def route(self, text: str, origin_room_id: str = "") -> RoutingDecision:
async def route(self, text: str, origin_room_id: str = "", is_dm: bool = False) -> RoutingDecision:
"""Klassifiziere und route eine Nachricht (v6 Flow mit Origin-First Guard).
Der neue Routing-Flow (v6):
-0.5 ORIGIN-FIRST GUARD (VOR allen anderen Schritten):
1. origin_room_id leer (echte DM) → normaler Flow
1. is_dm=True (DM-Kontext) → DM-Routing (100%-Keywords → Butler, Rest → Catch-All)
2. origin_room ist Catch-All-Raum → stay_in_room
3. origin_room ist excluded → ignore
0. Excluded rooms check
@@ -430,6 +430,10 @@ class BidirectionalRouter:
Args:
text: Der Nachrichtentext.
origin_room_id: Rocket.Chat Raum-ID des Ursprungsraums.
is_dm: True wenn die Nachricht aus einem DM-Raum stammt.
Erfordert dass der Adapter bei DMs is_dm=True übergibt.
Bei is_dm=True: 100%-Keywords → Butler (Move-Request),
weiche Keywords / kein Match → Catch-All (stay_in_room).
Returns:
RoutingDecision mit Zielraum, Kategorie und Metadaten.
@@ -454,7 +458,11 @@ class BidirectionalRouter:
# der User bestätigt via Move-Request-Button.
# Strategie-Themen (absprache, planung, strategie, entscheidung)
# → Strategie-Modus, KEIN Lernen.
if not origin_room_id:
# P0-FIX: is_dm muss vom Adapter explizit gesetzt werden.
# Erfordert dass der Adapter bei DMs is_dm=True übergibt.
# Der alte Proxy 'if not origin_room_id' war falsch — der Adapter
# übergibt bei DMs die echte DM-Room-ID, nicht None/leer.
if is_dm:
# DM: Erlaube Routing, aber markiere als DM-Kontext
# V8.2.1 A4: Strategie-Themen im DM → stay_in_room (kein Routing, kein Lernen)
if self._is_strategie_topic(text):