Fix 1 (BEFUND 5): INFO-Konflikte senden keine Buttons mehr.
_ask_keyword_conflict_resolution() prüft jetzt ob alle Konflikte
INFO sind → reiner Text-Hinweis ohne Buttons. CRITICAL/WARNING
bekommen weiterhin Buttons.
Fix 2 (BEFUND 6): 3 Test-Assert-Erweiterungen.
test_conflict_buttons_sent_for_context_vs_100 prüft jetzt:
- ℹ️-Emoji im Text
- "Keine Aktion nötig" im Text
- Keine attachments (nur 2 args: room_id, text)
Fix 3 (BEFUND 7): Test-Isolation via /tmp/archivar_test_state.json.
_build_mock_adapter() setzt ARCHIVAR_STATE_PATH auf temp file
und löscht es vor jedem Test — verhindert persistierte
State-Leaks zwischen Testläufen (gleiches Pattern wie V8.4.1).
- room_map.py: check_keyword_conflicts() erweitert um keyword_type-Parameter
und alle 4 Konflikt-Typen (CRITICAL, WARNING, INFO, OK)
- adapter.py: Konflikt-Prüfung nach keywords_100 und keywords_context Eingabe
im Onboarding-Flow integriert
- _ask_keyword_conflict_resolution(): neue Methode für Konflikt-Dialog mit
'Trotzdem verwenden' / 'Anderes Keyword' Buttons
- Konflikt-Auflösung mit Re-Enter-Loop für Neueingabe
- Logging: 'Onboarding-Conflict: keyword ... user chose: keep anyway / change'
- test_v8_4_2.py: 17 neue Tests (RoomMap-Level + Adapter-Level)
- test_v8_2.py: bestehende Tests an neue Signatur angepasst
Two fixes in test_v8_4.py:
1. _make_router() now uses a temp state file (/tmp/archivar_test_state.json)
instead of the default ArchivarState() path. This isolates tests from
persisted never_route entries that were blocking keyword-match routing.
2. test_red_flag_not_triggered_when_keyword_matches: changed test message
from "Bitte dokumentiere das neue Feature" to "Bitte erstelle eine
Dokumentation für das neue Feature" so the 100% keyword "dokumentation"
actually appears as a substring (find_room_by_keywords uses substring
matching, not stemming).
Result: 24/24 V8.4 tests passed. Full suite: 566 passed, 1 pre-existing
failure (test_no_env_vars — ARCHIVAR_PROJECT_ROOMS env var), 2 skipped.
F1 (P0): target_message_id-Tracking
- RocketChatREST.post_message() gibt jetzt message._id zurück (Optional[str])
- _post_message_with_retry() gibt message_id zurück (Optional[str])
- Auto-Route speichert target_message_id in _recent_auto_routes
- Widerspruch nutzt target_message_id für delete_message im Zielraum
F2 (P0): Widerspruchs-Detector präzisiert
- Wortgrenzen-Match: re.search(r'\b' + re.escape(kw) + r'\b', text)
- Satzkontext-Whitelist: Keyword am Satzanfang ODER mit '!' im Satz
- Widerspruch greift NUR wenn Auto-Route in den letzten 10 Min
- 'Das ist nein nicht möglich' → KEIN Widerspruch mehr
F3 (P1): Raumwechsel-Validierung
- #-Pflicht: Match muss '#' vor dem Raum-Namen haben
- Negativ-Liste: 'in den', 'nach hause', 'nach oben' etc. blocken
- room-map-Validierung: Nur Räume aus room-map.json werden akzeptiert
F4 (P2): sticky_topic-Vergleich vereinheitlicht
- Auto-Route sticky_topic jetzt via room_name_to_topic(target_name)
- Konsistent mit current_topic-Berechnung im Session-Sticky-Pfad
F5 (P2): Docstring korrigiert
- delete_message: 'POST /api/v1/chat.delete' (nicht DELETE)
F6 (P2): 22 Integration-Tests in test_v8_3_1.py
- F1: 4 Tests (message_id tracking)
- F2: 9 Tests (Wortgrenzen, Satzkontext, 10-Min-Fenster)
- F3: 6 Tests (#-Pflicht, Negativ-Liste, room-map)
- F4: 3 Tests (sticky_topic-Vereinheitlichung)
Bug 1: _META_PATTERNS Pattern 3 matchte JEDES Vorkommen von 'Archivar',
auch in Sachfragen wie 'Was hat der Archivar empfohlen?' → is_meta=True
→ 100%-Keyword-Match wurde nie geprüft.
Fix: Pattern 3 aufgeteilt in zwei bidirektionale Patterns:
- 'archivar' + System-Operationsverb (klassifiziert, routet, leitet weiter,
arbeitet, funktioniert, macht) — in beiden Richtungen
- System-Begriffe ohne 'archivar' (klassifikation, routing, weiterleitung)
bleiben eigenständige Meta-Signale
Bug 2: Bei stay_in_room=True wurde target_room=catch_all_id (DM) gesetzt
statt target_room=origin_room_id. Das leakt in _THEMATIC_TARGET_ROOM →
Agent-Prompt bekommt falschen Raum → Agent denkt er sei im DM.
Fix:
- router.py: Meta-Frage target_room=origin_room_id statt catch_all_id
- adapter.py: _THEMATIC_TARGET_ROOM nur setzen wenn NICHT stay_in_room
Tests: 16 neue Tests (TestMetaPatternsP0 + TestTargetRoomStayInRoomP0)
- 26/26 test_router.py PASS
- 32/32 test_v7_4_recursive.py PASS
- 192/193 full suite PASS (1 pre-existing env-var failure)
Button 2 (Generell hier bleiben): set_never_route(room_id, topic) mit
Thema aus room_name_to_topic() — bereits korrekt in P0-B implementiert.
Button 3 (Nur diesmal): stay_tracker-Inkrement + Auto-Promotion nach 3x
mit set_never_route(room_id, topic) — bereits korrekt in P0-B.
Router: _check_never_route_topic prüft matched_room.name → topic gegen
never_route[room_id][topic] — bereits korrekt in P0-B.
DER BUG: _sticky_rooms war ein räumlicher Bypass, der ALLE Nachrichten
in einem Raum blockierte, unabhängig vom Thema. Entfernt:
- __init__: _sticky_rooms-Dict entfernt
- Button 2: _sticky_rooms[room_id] = time.time() entfernt
- Button 3 Auto-Promotion: _sticky_rooms[room_id] = time.time() entfernt
- Archivar-Bypass: elif room_id in self._sticky_rooms entfernt
Jetzt läuft jede Nachricht durch den Router, der thematisch prüft:
never_route für 'lan-dokumentation' blockt NICHT 'protonbridge'.
Tests: 8 neue Tests in TestNeverRouteThematic (alle grün, 107/108 passed,
1 pre-existing env-var failure unrelated).
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)
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).