feat(archivar): Telemetrie um STAY/UNSICHER/TIMEOUT-Unterscheidung erweitern

Auftrag t_5e4863c6 — Routing-Telemetrie differenziert jetzt:
- llm_stay_sicher  — LLM sagte STAY (sicher), kein Red Flag, kein Cloud-Call
- llm_unsicher     — LLM sagte UNSICHER, Red Flag (Cloud-Call)
- llm_timeout      — LLM timeoutete (separat von llm_unavailable)
- cloud_call_stay  — Cloud-Agent endete mit STAY (Cloud-Call ohne Routing-Effekt)
- cloud_call_route — Cloud-Agent entschied ROUTE (Cloud-Call mit Wirkung)
- no_llm_needed    — Nachricht vor Stufe 4 entschieden (FAISS/Keyword/Smalltalk)

Abwärtskompatibel: llm_stay und llm_unavailable bleiben unverändert.
::status zeigt die neuen Zähler in einer Routing-Telemetrie-Sektion.
10 neue Tests (test_telemetry_stay_unsicher_timeout.py).
This commit is contained in:
Bernd (Hermes)
2026-09-02 15:36:05 +02:00
parent 21b1fd4e13
commit 00aecfaa7b
5 changed files with 355 additions and 2 deletions
+13
View File
@@ -5459,6 +5459,14 @@ class RocketChatAdapter(BasePlatformAdapter):
current_status = getattr(self._presence_engine, '_last_sent_status', 'online') or 'online'
pulse_active = self._presence_engine.is_pulse_active()
# Routing-Telemetrie (STAY/UNSICHER/TIMEOUT, Auftrag t_5e4863c6)
routing_counts = None
try:
from archivar.routing_counter import routing_counter
routing_counts = routing_counter.get_counts()
except Exception:
routing_counts = None
return build_status_text(
room_count=room_count,
archivar_active=archivar_active,
@@ -5469,6 +5477,7 @@ class RocketChatAdapter(BasePlatformAdapter):
current_status=current_status,
pulse_active=pulse_active,
plugin_version=PLUGIN_VERSION,
routing_counts=routing_counts,
)
async def _cmd_reset(self, room_id: str, args: str) -> str:
@@ -8957,6 +8966,7 @@ class RocketChatAdapter(BasePlatformAdapter):
"(Agent-Antwort verworfen für Routing)",
RED_FLAG_TIMEOUT,
)
routing_counter.increment('cloud_call_stay')
# Antwort bleibt im Ursprungsraum (kein ROOM:-Parsing).
else:
_RED_FLAG_SET_TIME.set(0.0)
@@ -8974,6 +8984,7 @@ class RocketChatAdapter(BasePlatformAdapter):
target_room_id[:8], origin_room[:8] if origin_room else "?",
)
routing_counter.increment('red_flag_agent_routed')
routing_counter.increment('cloud_call_route')
# Route: Antwort geht in den Zielraum
_CURRENT_ORIGIN_ROOM.set(target_room_id)
_THEMATIC_TARGET_ROOM.set(target_room_id)
@@ -9008,6 +9019,7 @@ class RocketChatAdapter(BasePlatformAdapter):
"STAY-Fallback (Ursprungsraum)"
)
routing_counter.increment('red_flag_fallback_stay')
routing_counter.increment('cloud_call_stay')
# ── Stufe 5: Butler-Rückfrage vorbereiten ──────────────
# Bei Red Flag (Unsicherheit) fragt der Archivar den User,
# ob das Routing gemerkt werden soll. Die Rückfrage wird
@@ -9080,6 +9092,7 @@ class RocketChatAdapter(BasePlatformAdapter):
"[rocketchat] V8.4 Red Flag: Response-Interception failed: %s", e
)
routing_counter.increment('red_flag_fallback_stay')
routing_counter.increment('cloud_call_stay')
# ── P1-6: ::-Prefix für Dangerous-Command-Meldungen ──────────
# Hermes Core sendet Meldungen mit /approve, /deny etc.