Fix Archivar forward note bug: Use rest.post_message() instead of self.send() to ensure note appears in origin room

This commit is contained in:
Hermes Agent
2026-06-06 09:11:36 +02:00
parent e3f9ee31f4
commit 024a173c8d
3 changed files with 45 additions and 1 deletions
+32
View File
@@ -73,6 +73,8 @@ load_lang() {
[update_only_banner]="━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n Hermes RC Plugin — Emergency Deploy\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
[deploying]="📦 Deploying plugin files (update-only, no questions)..."
[deploy_done]="✅ %d files deployed to %s"
[room_map_backup]="💾 Backed up existing room-map.json to %s"
[room_map_deployed]="📊 Deployed room-map.json to %s"
[cache_cleared]="🧹 Cleared __pycache__"
[verifying]="🔍 Verifying gateway..."
[verify_ok]="✅ Gateway running with Rocket.Chat connected"
@@ -127,6 +129,8 @@ load_lang() {
[update_only_banner]="━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n Hermes RC Plugin — Notfall-Deployment\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
[deploying]="📦 Deploye Plugin-Dateien (update-only, ohne Rückfragen)..."
[deploy_done]="✅ %d Dateien deployed nach %s"
[room_map_backup]="💾 Vorhandene room-map.json gesichert nach %s"
[room_map_deployed]="📊 room-map.json deployed nach %s"
[cache_cleared]="🧹 __pycache__ gelöscht"
[verifying]="🔍 Verifiziere Gateway..."
[verify_ok]="✅ Gateway läuft mit Rocket.Chat verbunden"
@@ -358,6 +362,20 @@ perform_update() {
done < <(find "$script_dir/plugin" -type f ! -path '*/__pycache__/*' ! -name '*.pyc')
copied_count=$(find "$script_dir/plugin" -type f ! -path '*/__pycache__/*' ! -name '*.pyc' | wc -l)
msg copied "$copied_count"
# Deploy room-map.json if it exists
local DATA_DST="$hermes_dir/data"
if [ -f "$script_dir/room-map.json" ]; then
mkdir -p "$DATA_DST"
local ROOM_MAP_DST="$DATA_DST/room-map.json"
if [ -f "$ROOM_MAP_DST" ]; then
# Create backup of existing room-map.json
cp "$ROOM_MAP_DST" "$ROOM_MAP_DST.backup.$(date +%s)"
msg room_map_backup "$ROOM_MAP_DST.backup.$(date +%s)"
fi
cp "$script_dir/room-map.json" "$ROOM_MAP_DST"
msg room_map_deployed "$ROOM_MAP_DST"
fi
fi
# Execute backend checks directly (Ollama check from lines 429-446)
@@ -467,6 +485,20 @@ perform_update_only() {
return 1
fi
# 3.5. Deploy room-map.json if it exists
local DATA_DST="$hermes_dir/data"
if [ -f "$script_dir/room-map.json" ]; then
mkdir -p "$DATA_DST"
local ROOM_MAP_DST="$DATA_DST/room-map.json"
if [ -f "$ROOM_MAP_DST" ]; then
# Create backup of existing room-map.json
cp "$ROOM_MAP_DST" "$ROOM_MAP_DST.backup.$(date +%s)"
msg room_map_backup "$ROOM_MAP_DST.backup.$(date +%s)"
fi
cp "$script_dir/room-map.json" "$ROOM_MAP_DST"
msg room_map_deployed "$ROOM_MAP_DST"
fi
# 4. Clear stale __pycache__
find "$PLUGIN_DST" -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
msg cache_cleared
+1 -1
View File
@@ -585,7 +585,7 @@ class RocketChatAdapter(BasePlatformAdapter):
_CURRENT_ORIGIN_ROOM.set(decision.target_room)
try:
note_text = f"Ich antworte im {getattr(decision, 'matched_room_name', None) or 'Zielraum'}."
await self.send(room_id, note_text)
self.rest.post_message(room_id, note_text)
except Exception as e:
logger.debug("[rocketchat] Failed to send forward note: %s", e)
+12
View File
@@ -0,0 +1,12 @@
{
"version": 1,
"rooms": {
"GENERAL": {
"name": "#general",
"theme": "General discussion",
"keywords": ["general", "discussion"],
"catch_all": true
}
},
"excluded_rooms": []
}