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.
Der Adapter kann schon lange Buttons (send() parst [[BUTTONS:custom]] seit
Monaten). Move-Requests nutzten trotzdem nur numerische Text-Optionen.
Jetzt: _build_custom_buttons() direkt im Move-Request-Flow. Rocket.Chat
Action-Buttons [Ja, rüberkopieren] [Hier bleiben] [Generell hier bleiben]
— klickbar, keine Zahlen, kein Kontext-Verlust.
Kritischer Bug: Nach 'Hier bleiben'/'Generell hier bleiben' wurde return
aufgerufen → der Original-Auftragstext ging verloren, nur '3' erreichte
den Agenten → Agent antwortete verwirrt.
Jetzt: Originaltext aus move_req['text'] wiederherstellen, skip_archivar=True
setzen, als normale Nachricht durchreichen. Der Agent verarbeitet den Auftrag
normal weiter — der User hat nur das Routing entschieden.
Drei kritische Bugs behoben:
1. Move-Request-Prüfung VOR Archivar-Klassifikation — '3' wurde vorher als
thematische Frage ins Catch-All kopiert, jetzt wird die Antwort erkannt
2. _pending_move_requests von msg_id auf room_id umgestellt — jede Antwort
mit neuer msg_id schlug vorher fehl
3. Numerische Antworten (1/2/3) werden jetzt direkt erkannt, nicht nur
Text-Matches ('rüberkopieren'/'hier bleiben'/'generell')
The send() method in adapter.py had a structural defect where the
button-parsing, template-handling, and rest.post_message code (98 lines)
was at module level instead of inside the send() method body.
send() ended after room-resolution without a return statement, causing
it to return None. _send_with_retry() in base.py then crashed with
AttributeError: 'NoneType' object has no attribute 'success'.
This made every Rocket.Chat response silently fail — the agent
processed messages but could never deliver replies.
Fix: moved the orphaned code block back into the send() method body
where it belongs, after the room-resolution logic and before
_find_fallback_room_for_user.
DM-Aufträge werden nie geroutet. Bei thematischen Fragen: Silent Copy.
Bei Aufträgen: Buttons [Ja, rüberkopieren] [Hier bleiben] [Generell hier bleiben].
Architektur-Skizze: docs/archivar-user-flow-c.md
Button responses (`is_button_response`) are ALWAYS direct replies to an agent
question and carry a `question_id::choice` payload. Routing them through the
Archivar risked landing a one-character "A" in the catch-all room where the
agent would see it without the original question context.
Now button clicks skip `classify_and_route()` entirely and stay in whatever
room they originated from.
DocumentationStore() now uses RoomMap.fact_store_path instead of the
hardcoded ~/.hermes/.../archivar_docs default. One-line change — the
doc_store is initialized after _load_room_map() so room_map is available.
This allows per-deployment configuration: in production, fact_store_path
points to /data/Wissensdatenbank/0100 Inbox so FAKT messages land in the
Obsidian vault's inbox for StartObsidian integration.
- Trigger now catches 'Name = Thema', '#Name', 'Raum:', digits, skip words
- After onboarding: numbered room list with Catch-All marker
- User can change Catch-All by replying with room number
- 'überspringen'/'skip' keeps current Catch-All
- Example text is generic (not project-specific): 'Projektraum = Entwicklung, ...'
- Parser accepts '#Name = Thema' (no 'Raum:' prefix needed)
- _derive_keywords() extracts keywords from room name + theme
- Onboarding message uses real newlines (join list, not \n literals)
- Shows actual missing room names with '=' prompt, plus example
Implements the RC-Skill's promised room-map completeness check after
Adapter.connect(). Previously the adapter subscribed to rooms but never
verified they were all present in room-map.json. New rooms were
subscribed but invisible to the Archivar router.
Scope (~450 lines, 4 files):
- adapter_integration.py: check_room_map_completeness() compares
subscribed rooms (filtered to c/p types) against RoomMap.
Single-Room-Regel: 1 relevant room → auto catch_all, no interview.
onboarding_active flag in _stats prevents re-triggering.
- room_map.py: add_or_update_room() for safe in-memory mutations,
reload() for disk-to-memory sync without gateway restart,
static save() for atomic file writes.
- adapter.py: connect() calls check after Archivar init, triggers
_start_onboarding() if rooms missing. _process_incoming() intercepts
'Raum: #Name = Thema' responses during active onboarding.
- test_auto_onboarding.py: 4 unit tests covering single-room
auto-assign, multi-room detection, DM filtering, and already-
complete map (no action).
Deployed to production: adapter.py + archivar/*.py copied to
Auslieferungspfad. Gateway restarted — no onboarding triggered
(map already complete).
ROOT CAUSE: install.sh --update-only blindly deployed room-map.json
from the repo (containing 'GENERAL' as catch_all) to the production
/home/bernd/.hermes/data/ directory, overwriting the machine-specific map.
FIXES (3 changes):
1. REMOVED room-map.json from repo + added to .gitignore
This file is machine-specific data, not source code.
2. REMOVED room-map.json deploy from install.sh (both paths):
- Normal install block (section 3.5)
- --update-only emergency deploy (section 3.5)
Replaced with comment: 'MACHINE-SPECIFIC — created by RC-Skill onboarding'
3. FIX adapter.py: is_unrouteable guard on ContextVar routing
Before: ContextVar set to target_room even when unrouteable
Result: 'Ich antworte im Zielraum.' note appeared, but Hermes
couldn't deliver to unsubscribed room — answer lost silently.
After: Forward block checks not getattr(decision, 'is_unrouteable', False)
If unrouteable → stays in origin room, answers there normally.
PRODUCTION: Correct room-map.json deployed with 4 project rooms
+ DM catch_all on .101. Excluded rooms: multi-agent DM, testbot DM.
Ersetzt classify_and_route() durch handle_and_forward().
Nachrichten werden jetzt klassifiziert UND automatisch in den
Zielraum kopiert, wenn target_room != origin_room.
send_callback ist bereits im ArchivarMessageHandler-Konstruktor
gesetzt (adapter.py:416).
Ohne diesen Parameter kann der Router:
- Multi-Agent-Raum nicht ausschließen (Schritt 0)
- Herkunft nicht in LLM-Room-Lookup einbeziehen
- Keine korrekte Catch-All-Validierung durchführen
Adapter hat room_id in _process_incoming() bereits verfügbar.