- Added time.sleep(3.0) between post A and post B
- Hermes-Core serializes incoming messages per bot instance with
depth-3 limit; two posts without delay trigger Interrupt-Recursion
- Updated docstring: 'innerhalb 1s' → 'sequenziell mit 3s Delay'
- Updated module docstring and function docstring
Ref: Rainer's review, Befund B-5
- Replaced 'Erkläre ausführlich die Architektur des Hermes Rocket.Chat
Plugins...' with 'Erkläre ausführlich die Architektur eines
Chatbot-Backends mit Multi-Room-Routing, ContextVar-basierter
Task-Isolation und einem Push-basierten Eingangskanal.'
- New text contains NO 100%-keywords (no 'rocketchat', 'ddp',
'websocket', 'plugin', 'gateway', 'hermes') — triggers real LLM
answer instead of auto-route
- Updated docstring to note keyword-free requirement
Ref: Rainer's review, Vorschlag F-4
- Keyword text: 'rocket chat plugin preflight briefing dokumentieren'
(all words only in keywords_context, no 100%-keyword match)
- Removed hardcoded _DEFAULT_ROCKETCHAT_PLUGIN_ROOM fallback
- Added _get_env_room_or_skip_plugin_room() — skips cleanly if
RC_LIVE_ROCKETCHAT_PLUGIN_ROOM not set
- Updated assertion from 'hermes' to 'rocket'/'plugin'
- Updated docstring and fail messages
Ref: Rainer's review .hermes/reviews/rainer/test-anpassung-2026-07-29.md
Rewrite des test_06_concurrent (vorher @pytest.mark.skip Skeleton):
- Umbenannt zu 'ContextVar-Isolation zwischen parallelen Routings'
- Szenario: Zwei Nachrichten in zwei Räumen gleichzeitig mit
verschiedenen Keywords ('lan subnetz maskieren' + 'rocketchat ddp bug')
- Verifiziert unabhängige Routings ohne Cross-Contamination
- Assertions: A) Je 1 Bot-Antwort pro Raum, B) Antwort_A referenziert
LAN-Routing, C) Antwort_B referenziert Rocketchat-Routing,
D) KEIN Cross-Talk, E) Message-Ownership, F) Beide innerhalb 60s
- Docstring korrigiert: 'Themenring' → 'ContextVar-Isolation'
(der Themenring als Ring-Datenstruktur ist ein anderes Konzept)
Rewrite des test_05_stream_retry (vorher @pytest.mark.skip Skeleton):
- Umbenannt zu 'ContextVar-Isolation unter paralleler Last'
- Szenario: Lange Antwort in test_room + kurze Antwort in test-rc-target
gleichzeitig — verifiziert dass Streams nicht kontaminieren
- Assertions: A) 1 Bot-Antwort pro Raum, B) Lange Antwort >200 Zeichen,
C) KEIN Cross-Talk (kein 'rüber'/'Move' in test_room, kein 'Architektur'
in target), D) Message-Ownership
- Docstring korrigiert: ehrliche Beschreibung statt irreführendem
'Stream-Retry' (Stream-Abbruch ist nicht via REST simulierbar)
Rewrite des test_03_move_request:
- Verwendet Context-Keyword ('hermes deployment pipeline') statt 100%-Keyword
um echten Butler-Mode (Move-Request-Buttons) zu triggern
- Butler-Mode-Guard: pytest.skip wenn butler_mode=off
- Move-Request-Indikator-Check: Text + Button-Attachments
- Button-Payload: MOVE_REQ:<source_room>::confirm_move
- Zielraum-Verifikation: #Rocketchat-Plugin (aus room-map.json)
- Assertions: A) Move-Request-Indikator, B) '(Auftrag von @' + Keyword,
C) Message-Ownership, D) Cursor-Trennung
- RC_LIVE_BUTLER_MODE env var für explizite Butler-Mode-Steuerung
- Add _sanitize_file_path_component() — strips all chars except [a-zA-Z0-9._-]
- download_file() now sanitizes file_id and filename before URL construction
- URL-encode path components with urllib.parse.quote()
- Response size cap: read in 64KB chunks, stop at max_size (default 10MB)
- Reject downloads when sanitized file_id or filename is empty
- Add 10 new tests in test_p1_fb08_file_security.py (all green)
- No regressions: 578 archivar tests pass, 82 top-level tests pass
Bug: Nach Auto-Route + Widerspruch ging die 2. send()-Antwort in den
falschen Raum (Auto-Route-Ziel statt Ursprungsraum).
Root Cause: _CURRENT_ORIGIN_ROOM kann in neuen asyncio-Tasks einen
stale Wert vom Parent-Task erben (Auto-Route-copy_context). send()
Priority 0 verwendete diesen Wert blind, ohne den Task-Token gegen
_room_context zu validieren.
Fix:
- send() Priority 0: Pre-Read-Validierung — _CURRENT_TASK_TOKEN
gegen _room_context[chat_id]['task_token'] prüfen. Bei Mismatch
Priority 0 skippen, normale ContextVar-Logik weiterlaufen lassen.
- send_clarify() Priority 0: analoge Validierung.
- Telemetrie: routing_counter.increment('priority0_token_mismatch_skip')
bei jedem Mismatch.
- Backward-Compat: _room_context-Einträge ohne task_token werden wie
'kein Token' behandelt (Priority 0 greift normal).
Tests (6 neu, alle grün):
- test_send_priority0_token_match
- test_send_priority0_token_mismatch
- test_send_priority0_no_stored_token
- test_send_clarify_token_mismatch
- test_auto_route_then_widerspruch_answer_in_origin (E2E)
- test_priority0_mismatch_telemetry
Keine Änderungen an _set_room_context_origin / _get_room_context_origin
oder den 10 _CURRENT_ORIGIN_ROOM.set-Stellen.
The /reset response ('Konversation zurueckgesetzt...') was arriving
after the keyword post, landing after source_cursor and being picked
up by wait_for_bot_message as a move-request candidate. The assertion
then failed because the /reset response contains no routing keywords.
Fix: wait 5s (was 3s) so the bot has time to process /reset AND send
its response before the keyword post. source_cursor from the keyword
post_message return then sits AFTER the /reset response, and
wait_for_bot_message correctly ignores it.
Three fixes for test_03_move_request:
1. Auto-route detection: auto-route keywords ('wechseln', 'sehe dich',
'thema') now take priority over button keywords and attachments.
Previously, an auto-route announcement with a room link card
(attachment) would set _is_button_request=True, preventing the skip.
Now auto-route keywords trigger skip immediately.
2. /reset pre-step: send '/reset' to source room before posting the
keyword message. This clears sticky topics from previous tests
(test_02 etc.) that would cause the bot to auto-route to
rc-test-automated instead of test-rc-target.
3. 1970 cursor handling in wait_for_bot_message: when the target room
is empty, get_latest_timestamp returns '1970-01-01T00:00:00.000Z'.
Passing this as 'oldest' to RC's channels.history can cause issues.
Now we skip the oldest filter when cursor starts with '1970-01-01'.
AUFGABE 1 — test_03 flexible routing assertion:
- Ersetzt starre 'kopieren'/'rüber'-Prüfung durch flexible Keyword-Liste
(wechseln, thema, sehe dich, move, raum, rüberkopieren, wechsel)
- Zusätzlich: Prüfung auf Zielraum-Namen (rc-test-automated, test-rc-target)
- Akzeptiert sowohl Move-Request-Buttons (Butler) als auch Auto-Route-Ankündigung
AUFGABE 2 — test_04 rate-limiting:
- 10s Pause vor Step 2 (rate-limit window reset nach test_03)
- Timeout von 25s auf 30s erhöht
- Polling-Intervall (sleep vor Projektraum-Check) von 2s auf 5s erhöht
AUFGABE 3 — Onboarding-Reset-Fix:
- Drei Stellen in adapter.py connect(): _start_onboarding([]) nur noch
aufrufen wenn sm.state != OnboardingState.ACTIVE
- Verhindert dass onboarding.yaml bei jedem Gateway-Neustart auf
AWAITING_ROOM zurückgesetzt wird, obwohl Onboarding abgeschlossen ist
The plugin sets statusText='Onboarding läuft' even when F8 logs
'Onboarding bereits abgeschlossen — produktiver Pfad'. The F8 log
line is authoritative, not the statusText. Only block if bot status
is completely offline (not online/away/busy).
- _cancel_pending_results() löst alle pending Futures mit DDPNotConnected auf
- disconnect() ruft _cancel_pending_results() nach Socket-Close
- _reader_loop Exit-Pfad ruft _cancel_pending_results() nach self.connected=False
- PulseController._pulse_tick_async fängt Exception (inkl. DDPNotConnected) und fällt auf REST zurück
- 2 neue Tests: test_disconnect_clears_pending_futures, test_reader_loop_exit_clears_pending_futures
- Non-greedy Regex entfernt alle übrigen [FILE]...Download:... Blöcke nach der Download-Schleife
- Verhindert dass der Agent Download-URLs sieht wenn Downloads fehlschlagen
- 3 neue Tests: TestFileBlockStripping (fail-only, mixed success/fail, unicode filenames)
Post-Deployment-Verifikation im --update-only Block:
- Sleep von 8s auf 12s erhöht (Gateway braucht ~8-10s für Archivar/Connected)
- Retry-Schleife: bis zu 3 Versuche im Abstand von 5s (max 22s total)
- journalctl --since mit präzisem Zeitstempel (date) statt '2 minutes ago'
- --no-pager Flag für zuverlässige Ausgabe
- Jede Prüfung gibt Treffer-Anzahl aus (nicht nur 'NICHT gefunden')
- Erst nach 3 vergeblichen Versuchen -> die() mit Fehler
Tests: 7 neue Testfälle für retry-loop, timestamp, --no-pager, sleep 12,
hit counts, retry-wait-message. Alle 21 Tests grün.
Bug A: DM-Dedup — _start_onboarding prüft ob DM bereits in missing_rooms
Bug B: ::onboarding ohne Args nutzt check_room_map_completeness (alle c/p-Räume)
Bug C: Zombie-State-Validierung — connect() verwirft State wenn Operator nicht subscribed oder Lock inaktiv
Erweitert _sync_room_map_with_membership() um die von Andreas geforderten
Bereinigungsschritte nach room-map.json-GC:
1. FAISS-Index: rebuild + save (war bereits in M13, jetzt robuster)
2. KeywordBooster: cleanup_orphaned_rooms() — baut _keyword_to_rooms
Mapping aus bereinigter RoomMap neu
3. ArchivarState: cleanup_orphaned_rooms() — entfernt stay_decision,
keyword_weights, sticky_keywords, manual_overrides, promotion_candidates
für gelöschte Räume
4. Onboarding _stay_tracker: entfernt Einträge für gelöschte Räume
Reihenfolge im Gateway-Start (adapter.py connect()):
DDP connect → _sync_room_map_with_membership() → DDP subscribe →
Archivar init → Auto-Onboarding
Alle neuen Methoden sind idempotent und mit Tests abgedeckt:
- test_archivar_state.py: +8 Tests (cleanup_orphaned_rooms)
- test_booster.py: +4 Tests (cleanup_orphaned_rooms)
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)