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.
- 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.
Harte Durchsetzung: Der Archivar darf NUR in Räume routen, die der Bot
tatsächlich abonniert hat. Alles andere ist ein Architekturfehler.
Neu:
- doc_store.py: DocumentationStore — speichert unrouteable Nachrichten
als Markdown mit YAML-Frontmatter unter data/archivar_docs/{category}/
- router.py: RoutingDecision.is_unrouteable + unrouteable_reason,
MessageRouter.set_subscribed_room_ids(), Zielraum-Validierung
- adapter_integration.py: ArchivarMessageHandler.set_subscribed_room_ids(),
classify_and_route() leitet bei is_unrouteable in doc_store um
- adapter.py: set_subscribed_room_ids() wird nach connect() mit den
realen subscribed rooms gefüttert
Verhalten: Wenn jemand 'ALARM: Server down' in einem Raum schreibt,
den der Bot nicht abonniert hat, wird die Nachricht KLASSIFIZIERT,
aber NICHT geroutet — sie landet im doc_store mit Begründung.
A: config.py auf Env-Vars umgestellt (ARCHIVAR_FAKT_ROOM, _FRAGE_ROOM, _ALARM_ROOM, _CATCHALL_ROOM, _PROJECT_ROOMS)
B: adapter.py-Kommentare von BAT-Terminologie auf generisch umgeschrieben
C: archivar/SKILL.md — Hermes-Skill-Schema mit Triggern, Architektur, Konfiguration, Pitfalls
D: classify_and_route() + send_callback in _process_incoming() integriert, chat_name mit [KATEGORIE] angereichert
E: RocketChatREST.download_file() — authentifizierter Datei-Download via X-Auth-Token, kein Security-Scanner-Trigger mehr
_download_and_inline_files() inlined [FILE]-Inhalte direkt in den Prompt
- adapter.py: recopied from production (write_file corrupted the em-dash on line 8)
- All archivar/*.py: from archivar.X → from .X for plugin-context compatibility