Booster-Strategie: IMMER aktiv (nicht nur bei Konflikten)
- router.py: Konfliktbedingung entfernt, Booster auf alle FAISS-Treffer
- booster.py: Boost +0.05→+0.10, zusätzlich +0.05 pro weiterem unique Keyword
- config.py: FAISS_AUTO_ROUTE 0.85→0.70
Kombiniert semantische Breite (FAISS) mit präziser Keyword-Diskriminierung.
Ziel: granulare Raum-Entscheidungen bei überlappenden Themen.
Strategie B: _room_to_text() webt kuratierte seed_data-Messages
in den Embedding-Text ein, um FAISS-Similarity zu schärfen.
Änderungen:
- room_index.py: import SEED_DATA, _room_to_text() erweitert
um Seed-Message-Einwebung (nur für Räume mit SEED_DATA-Eintrag)
- test_room_index.py: MockEmbeddingClient auf Keyword-Zählung
umgestellt (statt binär any()) — verhindert Cross-Contamination
durch längere Embedding-Texte mit Seed-Messages
Tests: 35/35 passed (22 booster + 13 room_index)
NEUES MODUL: plugin/archivar/feedback_detector.py
- RoutingWiderspruchDetector mit 4 Regex-Gruppen (Hauptmuster, Umrouting,
Verneinung, Befehle)
- ContradictionResult dataclass: has_contradiction, contradiction_type,
confidence, target_room, rejected_room, matched_pattern
- Edge Cases: 'nicht in X, sondern in Y' → X negativ, Y als Ziel
- Kein LLM-Fallback (nur Regex in v1)
EINHAENGUNG adapter_integration.py:
- ArchivarMessageHandler.__init__(): self._feedback_detector
- detect_routing_contradiction(text, origin_room_id) → ContradictionResult|None
- Bei Treffer: update_keyword_weight(feedback_type='never')
- _resolve_room_name_to_id() für Raum-Name → room_id Auflösung
EINHAENGUNG adapter.py:
- _process_incoming(): VOR classify_and_route() → contradiction-Check
- Bei Treffer: Decision überschreiben (stay_in_room=True)
- [WIDERSPRUCH]-Präfix — Nachricht NICHT schlucken, normal an Agent
- NUR wenn KEIN Button-Feedback aktiv (kein pending move-request)
Tests: 57/58 passed (1 pre-existing env-var failure unverändert)
OllamaLLMClient.generate() is async def — run_in_executor cannot
correctly execute async functions. The coroutine was never awaited.
Also fix Move-Request parser: native button '1️⃣ Rüber' was not
matched against '1️⃣' — fell through to 'stay' instead of 'move'.
- classifier.py: _llm_raw_sync → async _llm_raw, await generate()
- router.py: remove run_in_executor, direct await _llm_raw()
- adapter.py: normalize MOVE_REQ choice (extract leading digit/emoji)
Bei Auto-Route Silent Copy (Typ 1, kein Move-Request) wurde die
Notiz im Ursprungsraum gesendet, aber _CURRENT_ORIGIN_ROOM blieb auf
dem Ursprungsraum — der Agent antwortete dann fälschlich dort.
Fix: Nach der Silent Copy _CURRENT_ORIGIN_ROOM auf decision.target_room
setzen und forwarded=True, damit der Fallback in Zeile 927-928
übersprungen wird. Der Agent antwortet jetzt im Zielraum.
- initialize() now tries load() from disk first
- If load succeeds: log 'Index von Disk geladen' + wire router
- If load fails: build_index() + save() + log 'Index gebaut + gespeichert' + wire router
- Eliminates unnecessary index rebuild on every gateway restart
- All 58 tests pass
setLevel(INFO) alone was not enough — without a handler and with
propagate=True (default), logs were accepted by the root logger
(level WARNING) but silently discarded since root has no handlers.
Now matches adapter.py pattern: StreamHandler + propagate=False,
so all submodule logs (classifier, router, room_index, booster)
are visible via the shared parent logger.
Root logger defaults to WARNING (level 30) when no basicConfig is set.
adapter_integration.py only called getLogger(__name__) without setLevel,
so all INFO logs were silently filtered. adapter.py already had its own
setLevel(INFO) + handler, which is why its logs appeared.
Fix: add logger.setLevel(logging.INFO) after getLogger(__name__) at line 94.
This restores all suppressed INFO logs:
- Initializing ArchivarMessageHandler...
- FAISS Phase-1: RoomIndexManager + KeywordBooster ready
- FAISS Phase-1: Index built
- FAISS Phase-1: Router wired
- ArchivarMessageHandler ready
Root cause: RoomIndexManager.stats() returns a dict with mixed types
(bool, int, float, str). sum() iterated over all values and crashed
when hitting built_at_iso (str) after built_at (float).
Fix: Replace stats() call with direct .size and .room_ids properties.
Also commit FAISS Phase-1 files (booster.py, room_index.py, seed_data.py)
that were deployed to Gateway but not yet in repo.
Tests: 58 passed (0 failures)
check_room_map_completeness() und _load_room_map() verwendeten
hardcodierte Pfade (~/.hermes/hermes-agent/data/room-map.json)
statt der Konstanten ROOM_MAP_PATH/DEFAULT_MAP_PATH.
Das führte dazu, dass Unit-Tests die produktive room-map.json
überschrieben — der Mock-Patch auf ROOM_MAP_PATH griff nicht,
weil save() und reload() den hardcodierten Pfad verwendeten.
Fix:
- adapter_integration.py: 2 hardcodierte Pfade → ROOM_MAP_PATH
- room_map.py: Doppelte DEFAULT_MAP_PATH-Zuweisung entfernt
Drei Routing-Bug-Fixes basierend auf Analyse des Timeout-Falls vom 15.06.2026:
FIX 1 (KRITISCH): Timeout-Fallback auf Ursprungsraum statt Catch-All
- _llm_room_lookup() gibt jetzt (RoomEntry|None, bool) zurück
- bool=True signalisiert LLM-Aufruf-Fehler (Exception/Timeout)
- Bei LLM-Fehler: stay_in_room=True, is_catch_all=False
- Nur bei explizitem CATCH_ALL vom LLM: catch_all-Raum als Ziel
FIX 2: Keyword-Matching vor LLM-Aufruf (Embedding+Keyword-Fallback)
- Nach Embedding-Vorfilter: wenn work_order mit conf < 0.9
- find_room_by_keywords() aufrufen, bei Match direkt zurückgeben
- Verhindert unnötige LLM-Calls für klare Keyword-Matches
FIX 3: find_room_by_keywords() verbessert
- keywords_100-Matches: nicht erster Treffer, sondern Raum mit
den MEISTEN 100%-Matches gewinnt (best_100_score)
- keywords_context bleibt Fallback wenn kein 100%-Match existiert
Tests: 57/58 passed (1 pre-existing env-var failure)
Bug: DM ohne Routing nach einem Projektraum-Turn → alte
_THEMATIC_TARGET_ROOM klebt → Antwort im falschen Raum.
Fix: _THEMATIC_TARGET_ROOM.set('') zu Beginn jeder neuen Nachricht
in _process_incoming(). Der Archivar setzt sie dann neu — oder sie
bleibt leer (DM, Smalltalk, Catch-All).
Erkannt 20:21 durch Andreas: Tagesabschluss-Anfrage im DM,
Antwort landete in #Rocketchat-Plugin (vorheriger Turn).
Option C (Adapter routet Antwort automatisch um):
Priority 0 im Virtual→Real Room Translation: Wenn _THEMATIC_TARGET_ROOM
gesetzt ist und vom Ursprungsraum abweicht, geht die Antwort dorthin.
Null Core-Impact, +8 Zeilen in adapter.py, kein Prompt-Cache-Break.
Der Agent antwortet wie bisher — der Adapter lenkt um.
Flow: Agent sendet Antwort → Adapter prüft _THEMATIC_TARGET_ROOM →
gesetzt? → Zielraum. Sonst → _CURRENT_ORIGIN_ROOM (wie bisher).
Wenn der Archivar-LLM-Call timed out, erhält der Agent jetzt die
Liste aller subscribed Projekt-Räume im Prompt:
[Frage N, Timeout — Räume: #BAT-Team, #Rocketchat-Plugin, ...]
Damit kann der Agent selbstständig entscheiden, in welchen Raum
eine Frage gehört — auch ohne Archivar-Ergebnis. Erfüllt die
Auftraggeber-Vision: 'Antwortet der Archivar nach dem Timeout
nicht, entscheidet der Agent selbst, auch wenn es Token kostet.'
Bug: Der Router setzte stay_in_room=True (excluded_rooms, Meta-Fragen,
Keyword-Match auf Ursprungsraum), aber der Adapter ignorierte das Flag.
Er prüfte nur target_room != room_id → routete trotzdem.
Symptom: 'Die RC Beschreibung klingt toll' aus #Rocketchat-Plugin
löste Move-Request aus, obwohl:
- excluded_rooms → stay_in_room=True
- 'RC' matcht keywords_100 'rc' → Ziel = Ursprungsraum
Fix: Eine Zeile in der Routing-Bedingung:
and not getattr(decision, 'stay_in_room', False)
Jetzt respektiert der Adapter, wenn der Router sagt 'bleib hier'.
ArchivarMessageHandler was initialized without button_send_callback,
so every clarification request fell back to text-only ('Antworte mit
einer Zahl: 1 = Ja...'). Added _send_archivar_buttons() method that
translates Archivar button format into native Rocket.Chat Action-Buttons
with msg_in_chat_window=True. Also marks room in _rooms_with_pending_questions
so the response stays in the same room.
'::' in text (Zeile 571) klassifizierte JEDE Nachricht mit :: als
BUTTON_CLICK — z.B. Andreas' ':: Ich brauche den Wetterbericht'.
Der Agent sah die Nachricht nie → keine Antwort trotz grünem Status.
Fix: text.split('::', 1)[0].strip() != '' — erkennt nur echte
Button-Payloads (wo vor :: tatsächlich Inhalt steht wie CLARIFY:id).
':: Nachricht' → split[0] ist leer → kein Button → MessageType.TEXT.
Root Cause: Ein 3-Zeilen-ODER-Detector, der drei Payload-Formate
in einer Variable vermischt. Fragil weil Substring-Match.
- find_room_by_keywords() mit min_score Parameter (default=2)
Nur wenn best_score >= min_score → Raum returned, sonst None
→ Router fällt zu Embedding/LLM-Klassifikator durch
- verhindert Fehlrouting bei einzelnen Keyword-Treffern (plugin, etc.)
Architektur: Rainer | Implementierung: Miguel | QG: Rainer F1-F5 bestanden
Render clarify prompts with Rocket.Chat action buttons instead of
fallback text lists ('Reply with the number'). Full flow:
send_clarify():
- choices non-empty: builds RC buttons via _build_custom_buttons(),
one per choice + '✏️ Other' button
- clarify_id encoded as CLARIFY:{id}:{idx} or CLARIFY:{id}:other
- stores clarify_id→session_key in _clarify_state
- fallback to super().send_clarify() on empty choices or REST failure
_process_incoming():
- intercepts DDP messages starting with 'CLARIFY:'
- 'other' token → mark_awaiting_text() for text capture
- numeric token → resolve_gateway_clarify() with choice text
- returns immediately (no agent routing) for button clicks
__init__:
- adds self._clarify_state dict for session key mapping
The uncommitted diff from 06.06. had a bug: '::' (button response
marker) was placed in the wrong elif branch, routing it through the
Archivar instead of bypassing it.
Fixed: '::' detection moved into the top-level bypass condition alongside
is_button_response and _rooms_with_pending_questions. The dead
'elif room_type == d and is_auftrag' guard removed (redundant — DM
orders never reach this branch). Last elif promoted to else.