fix: prevent room-map.json overwrite + is_unrouteable handler

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.
This commit is contained in:
Hermes Agent
2026-06-06 18:53:11 +02:00
parent 024a173c8d
commit 4d35669174
5 changed files with 451 additions and 41 deletions
+10 -3
View File
@@ -581,7 +581,12 @@ class RocketChatAdapter(BasePlatformAdapter):
logger.debug("[rocketchat] Archivar classification skipped: %s", e)
# Forward-Antwort-Umleitung
if decision and hasattr(decision, 'target_room') and decision.target_room and decision.target_room != room_id:
# Nur umleiten, wenn der Zielraum subscribed ist (nicht unrouteable).
# is_unrouteable=True bedeutet: target_room ist nicht in den Bot-Subscriptions;
# dann im Ursprungsraum bleiben und dort antworten.
if (decision and hasattr(decision, 'target_room') and decision.target_room
and decision.target_room != room_id
and not getattr(decision, 'is_unrouteable', False)):
_CURRENT_ORIGIN_ROOM.set(decision.target_room)
try:
note_text = f"Ich antworte im {getattr(decision, 'matched_room_name', None) or 'Zielraum'}."
@@ -597,8 +602,10 @@ class RocketChatAdapter(BasePlatformAdapter):
# Both get the same session key.
virtual_chat_id = f"user:{username}"
# Track the REAL room for send() to route the response back
# Only set if no forwarding occurred
if not (decision and hasattr(decision, 'target_room') and decision.target_room and decision.target_room != room_id):
# Only set if no forwarding occurred (or forwarding was unrouteable)
if not (decision and hasattr(decision, 'target_room') and decision.target_room
and decision.target_room != room_id
and not getattr(decision, 'is_unrouteable', False)):
_CURRENT_ORIGIN_ROOM.set(room_id)
# Ensure this user→room mapping is recorded for proaktive sends