feat(P1): Auto-Route-Widerspruch-Flow — detect_routing_contradiction + Clarify

- feedback_detector.py: HIER_HER-Muster ergänzt (positive Formulierung
  'Nein, es passt hier her' → routing_rejection)
- router.py: RoutingDecision um is_contradiction/contradiction_result
  erweitert; should_route() blockt bei Widerspruch
- adapter_integration.py: detect_routing_contradiction als Pre-Check in
  classify_and_route() eingebunden (Clarify statt Auto-Route)
- adapter.py: _send_widerspruch_clarify() mit 2 Buttons
  ('generell hier her' → set_never_route, 'nur jetzt hier her' → stay_once),
  WIDERSPRUCH:-Button-Handler, _widerspruch_state; alte V8.3-3
  Auto-Retrieve-Routine durch Clarify-Flow ersetzt
- tests: test_auto_route_contradiction_persists.py (14 Tests, 4 Szenarien)

Pitfalls beachtet: P-028, P-040, P-056, P-057, P-066, P-067
This commit is contained in:
Bernd (Hermes)
2026-08-20 07:26:38 +02:00
parent 92455d70f4
commit 43a02c7884
5 changed files with 540 additions and 131 deletions
+12
View File
@@ -314,6 +314,17 @@ class RoutingDecision:
"""Strukturierter Prompt für den Agenten: 'Router unsicher. Räume: ...'
Leer wenn kein Red Flag."""
# ── V8.5: Routing-Widerspruch (Auto-Route-Widerspruch-Flow) ─────────
is_contradiction: bool = False
"""True wenn die Nachricht einen Routing-Widerspruch enthält
(detect_routing_contradiction hat getroffen). Der Adapter soll dann
einen Clarify mit zwei Buttons auslösen statt zu routen."""
contradiction_result: Optional[Any] = None
"""Das ContradictionResult-Objekt (feedback_detector) bei Treffer,
sonst None. Enthält contradiction_type, rejected_room, target_room etc."""
def should_route(self) -> bool:
"""True wenn die Nachricht geroutet werden sollte.
@@ -329,6 +340,7 @@ class RoutingDecision:
not self.is_catch_all and
not self.is_unrouteable and
not self.move_request_sent and
not self.is_contradiction and
bool(self.target_room)
)