fix: V8.3.2 — Archivar-Sticky entfernt, Same-Room-STAY, Move-Fallback, Log-Texte
F1 (KRITISCH): Archivar-Routing setzt KEINEN Session-Sticky mehr. Nur 100%-Keyword-Match (Auto-Route) und expliziter Wechsel setzen Sticky. RoutingDecision.set_sticky=True nur bei 100%-Match; FAISS/LLM → False. adapter.py prüft decision.set_sticky vor _session_room_preferences-Setzung. F2 (KRITISCH): target_room == origin_room → STAY. Router prüft Self-Match in allen Stufen (Keyword, FAISS, LLM). Adapter prüft target_room == origin_room vor Auto-Route. F3 (MITTEL): Move-Fallback-Kette mit Logging. delete_message → update_message → announcement-only. Jeder Schritt wird geloggt. origin_message_id getrackt. F4 (NIEDRIG): Log-Texte von "Session-Sticky" auf "Topic-Scoped Sticky" aktualisiert. Kommentare, Log-Zeilen, Auftrag-Präfix — alle konsistent. Tests: 27 neue Tests in test_v8_3_2.py, alle grün. 509/510 tests passed (1 pre-existing env-var migration fail).
This commit is contained in:
+23
-20
@@ -1569,7 +1569,7 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
"target_message_id": "",
|
||||
}
|
||||
logger.info(
|
||||
"[rocketchat] V8.3-5: Session-Sticky gesetzt — "
|
||||
"[rocketchat] V8.3-5: Topic-Scoped Sticky gesetzt — "
|
||||
"room=%s → target=%s, topic='%s' (30 Min, confirm_move)",
|
||||
room_id[:8], move_req.get("target_name", "?")[:20], move_sticky_topic,
|
||||
)
|
||||
@@ -1908,7 +1908,7 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
routing_counter.increment('dm_routing_skipped')
|
||||
logger.info("ROUTING BYPASS: reason=dm_routing_skipped, origin_room=%s", room_id)
|
||||
elif room_id in self._session_room_preferences:
|
||||
# V8.3-5: Topic-Scoped Session-Sticky — Auto-Route nur bei gleichem Thema
|
||||
# V8.3-5: Topic-Scoped Sticky — Auto-Route nur bei gleichem Thema
|
||||
pref = self._session_room_preferences[room_id]
|
||||
if time.time() < pref["expires_at"]:
|
||||
target_room_id = pref["target_room"]
|
||||
@@ -1940,7 +1940,7 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
target_entry = self.archivar._room_map.get_room_by_id(target_room_id)
|
||||
if target_entry and target_entry.catch_all:
|
||||
logger.debug(
|
||||
"[rocketchat] V8.1.1 R1: Session-Sticky target %s is catch_all — "
|
||||
"[rocketchat] V8.1.1 R1: Topic-Scoped Sticky target %s is catch_all — "
|
||||
"skipping auto-route, falling through to Archivar",
|
||||
target_name[:20],
|
||||
)
|
||||
@@ -1952,7 +1952,7 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
origin_state = self.archivar._state.should_stay_in_room(room_id)
|
||||
if origin_state in ("always", "never_route"):
|
||||
logger.debug(
|
||||
"[rocketchat] V8.1.1 R1: Session-Sticky origin room %s has "
|
||||
"[rocketchat] V8.1.1 R1: Topic-Scoped Sticky origin room %s has "
|
||||
"stay_in_room=%s — skipping auto-route, falling through to Archivar",
|
||||
room_id[:8], origin_state,
|
||||
)
|
||||
@@ -1961,13 +1961,13 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
else:
|
||||
# Guards passed — auto-route
|
||||
# Kopiere Nachricht in den Zielraum
|
||||
target_txt = f"*(Auftrag von @{username}, Session-Sticky)*\n{text}"
|
||||
target_txt = f"*(Auftrag von @{username}, Topic-Sticky)*\n{text}"
|
||||
await self._post_message_with_retry(target_room_id, target_txt)
|
||||
_CURRENT_ORIGIN_ROOM.set(target_room_id)
|
||||
_THEMATIC_TARGET_ROOM.set(target_room_id)
|
||||
routing_counter.increment('session_sticky_auto_route')
|
||||
logger.info(
|
||||
"[rocketchat] V8.3-5: Session-Sticky active — "
|
||||
"[rocketchat] V8.3-5: Topic-Scoped Sticky active — "
|
||||
"auto-routing '%s' → %s, topic='%s' (%.0fs remaining)",
|
||||
text[:80], target_name, sticky_topic,
|
||||
pref["expires_at"] - time.time(),
|
||||
@@ -1990,13 +1990,13 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
return
|
||||
else:
|
||||
# Kein Archivar/RoomMap — direkt routen (Fallback)
|
||||
target_txt = f"*(Auftrag von @{username}, Session-Sticky)*\n{text}"
|
||||
target_txt = f"*(Auftrag von @{username}, Topic-Sticky)*\n{text}"
|
||||
await self._post_message_with_retry(target_room_id, target_txt)
|
||||
_CURRENT_ORIGIN_ROOM.set(target_room_id)
|
||||
_THEMATIC_TARGET_ROOM.set(target_room_id)
|
||||
routing_counter.increment('session_sticky_auto_route')
|
||||
logger.info(
|
||||
"[rocketchat] V8.3-5: Session-Sticky active — "
|
||||
"[rocketchat] V8.3-5: Topic-Scoped Sticky active — "
|
||||
"auto-routing '%s' → %s, topic='%s' (%.0fs remaining)",
|
||||
text[:80], target_name, sticky_topic,
|
||||
pref["expires_at"] - time.time(),
|
||||
@@ -2021,7 +2021,7 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
# Abgelaufen → aufräumen
|
||||
del self._session_room_preferences[room_id]
|
||||
logger.debug(
|
||||
"[rocketchat] V8.1 P2: Session-Sticky expired for room %s",
|
||||
"[rocketchat] V8.1 P2: Topic-Scoped Sticky expired for room %s",
|
||||
room_id[:8],
|
||||
)
|
||||
else:
|
||||
@@ -2164,17 +2164,20 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
room_name=target_name,
|
||||
)
|
||||
# V8.3-5: Temporäres Sticky mit Topic-Scoping (30 Min TTL)
|
||||
self._session_room_preferences[room_id] = {
|
||||
"target_room": target_room_id,
|
||||
"target_name": target_name,
|
||||
"sticky_topic": sticky_topic,
|
||||
"expires_at": time.time() + 1800,
|
||||
}
|
||||
logger.info(
|
||||
"[rocketchat] V8.3-5: Session-Sticky gesetzt — "
|
||||
"room=%s → target=%s, topic='%s' (30 Min, Auto-Route)",
|
||||
room_id[:8], target_name[:20], sticky_topic,
|
||||
)
|
||||
# V8.3.2 F1: Nur setzen wenn decision.set_sticky=True
|
||||
# (100%-Keyword-Match). FAISS/LLM-Routing setzt KEINEN Sticky.
|
||||
if getattr(decision, 'set_sticky', False):
|
||||
self._session_room_preferences[room_id] = {
|
||||
"target_room": target_room_id,
|
||||
"target_name": target_name,
|
||||
"sticky_topic": sticky_topic,
|
||||
"expires_at": time.time() + 1800,
|
||||
}
|
||||
logger.info(
|
||||
"[rocketchat] V8.3-5: Topic-Scoped Sticky gesetzt — "
|
||||
"room=%s → target=%s, topic='%s' (30 Min, Auto-Route)",
|
||||
room_id[:8], target_name[:20], sticky_topic,
|
||||
)
|
||||
# ── V8.3-3: Auto-Route für Widerspruchs-Routine speichern ──
|
||||
self._recent_auto_routes[room_id] = {
|
||||
"origin_room": room_id,
|
||||
|
||||
Reference in New Issue
Block a user