fix: V8.2.1 — 7 Befunde (A2 Caller, A3 Persistenz, A4 Strategie-Block, Tests, Feature-Flag, conftest, runbook)
Befund 1 (P0): A2 Dead-Code — _should_trigger_nachklaerung() in adapter.py Button-Response-Handler angebunden. stay_once (Button 3) triggert jetzt Nachklärung mit Strategie-Buttons. ARCHIVAR_CLARIFY-Responses werden verarbeitet (Strategie-Thema → Ring-Zustand "jetzt", ANDERER GRUND → normales Lernen). Befund 2 (P0): A3 Persistenz-Bug — _stay_counts und _keyword_last_matched in RoomMap.save() und _from_dict() serialisiert. Tracking-Felder überleben Gateway-Restart. Befund 3 (P1): A4 Strategie-Block — _is_strategie_topic() im DM-Pfad des Routers. Strategie-Themen im DM → stay_in_room (kein Routing, kein Lernen). Befund 4 (P1): Tests — 8 neue echte Integrationstests (TestV821A2, TestV821A3, TestV821A4). 27/27 grün. Befund 5 (P2): ARCHIVAR_STRATEGY_AUTO_DETECT env var in config.py, Default false (Rainer Auflage P1). Befund 6 (P2): conftest.py mit temp_room_map_path und temp_state_path Fixtures für saubere Pfad-Tests. Befund 7 (P2): docs/deployment-runbook.md mit .45 Bare-VM Schritten inkl. room-map.json Pfad-Korrektur.
This commit is contained in:
@@ -380,6 +380,19 @@ class BidirectionalRouter:
|
||||
# → Strategie-Modus, KEIN Lernen.
|
||||
if not origin_room_id:
|
||||
# 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):
|
||||
logger.info(
|
||||
"DM-Guard V8.2.1 A4: Strategie-Thema im DM erkannt → stay_in_room"
|
||||
)
|
||||
routing_counter.increment('dm_strategie_stay')
|
||||
logger.info("ROUTING DECISION: reason=dm_strategie_stay, origin_room=%s, target_room=, stay=True, butler_mode=False", origin_room_id)
|
||||
return RoutingDecision(
|
||||
category="direct_question",
|
||||
target_room="",
|
||||
confidence=1.0,
|
||||
stay_in_room=True,
|
||||
)
|
||||
logger.debug("DM-Guard V8.2: origin_room_id leer → DM-Routing erlaubt (A4)")
|
||||
# Kein sofortiges stay_in_room — normaler Flow mit Butler
|
||||
|
||||
@@ -1070,6 +1083,25 @@ class BidirectionalRouter:
|
||||
return True
|
||||
return False
|
||||
|
||||
# ── V8.2.1 A4: Strategie-Themen-Erkennung ──────────────────────────
|
||||
|
||||
@staticmethod
|
||||
def _is_strategie_topic(text: str) -> bool:
|
||||
"""Prüft ob der Text ein Strategie-Thema enthält.
|
||||
|
||||
Strategie-Themen: absprache, planung, strategie, entscheidung.
|
||||
Bei diesen Themen → Strategie-Modus, KEIN Lernen, KEIN Routing.
|
||||
|
||||
Args:
|
||||
text: Der Nachrichtentext.
|
||||
|
||||
Returns:
|
||||
True wenn Strategie-Thema erkannt.
|
||||
"""
|
||||
strategie_keywords = {"absprache", "planung", "strategie", "entscheidung"}
|
||||
text_lower = text.lower()
|
||||
return any(kw in text_lower for kw in strategie_keywords)
|
||||
|
||||
# ── Fallback: Keyword-Heuristik ────────────────────────────────────
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user