From 07ba653b65a8153eb715c89a4ed2a6d542e06d2d Mon Sep 17 00:00:00 2001 From: "Bernd (Hermes)" Date: Fri, 24 Jul 2026 14:28:53 +0200 Subject: [PATCH] =?UTF-8?q?fix(P0-3):=20is=5Fonboarding-Gate=20erweitert?= =?UTF-8?q?=20=E2=80=94=20FAKT::/REVIEW=5F*/=E2=8F=B0=20Prefix=20abgefange?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rainer/funktionsbereichs-zerlegung.md | 526 ++++++++++++++++++ plugin/adapter.py | 10 +- 2 files changed, 535 insertions(+), 1 deletion(-) create mode 100644 .hermes/reviews/rainer/funktionsbereichs-zerlegung.md diff --git a/.hermes/reviews/rainer/funktionsbereichs-zerlegung.md b/.hermes/reviews/rainer/funktionsbereichs-zerlegung.md new file mode 100644 index 0000000..f935909 --- /dev/null +++ b/.hermes/reviews/rainer/funktionsbereichs-zerlegung.md @@ -0,0 +1,526 @@ +# RC-Plugin Funktionsbereichs-Zerlegung + +Repo: /home/bernd/projekte/Hermes_rocket.chat_Plugin +HEAD: 83b9d6c ("fix(plugin.yaml): name rocketchat-platform → rocketchat (Pitfall 4)") +Analyse: Rainer (Architektur-Reviewer) +Datum: 2026-07-24 +Zweck: Systematische Aufteilung des RC-Plugins in unabhängig prüfbare Funktionsbereiche, gegen die jeweils das Zielbild (Vorgaben, Designentscheidungen, Restriktionen) referenziert werden kann. + +================================================================ +METRIKEN-BASIS +================================================================ +- adapter.py: 6921 LOC (Gateway, DDP, REST, Dispatch, Onboarding-Wiring) +- install.sh: 1611 LOC (Deployment, Verifikation, 11 Pitfalls dokumentiert) +- archivar/ gesamt: ~15.000 LOC, 24 Module +- Tests: ~70 Dateien, davon 16 v8_4_x (Vektor-Routing) + 8 v8_3_x (P0-Round) + 9 v8_2/8_3 + onboarding/room_map/router/presence/... +- Plugin-Dateien (Top-Level): adapter.py, tools.py, plugin.yaml +- Konfiguration: templates/config.yaml + room-map.json + .env (RUNTIME) + +================================================================ +ZERLEGUNGSKRITERIEN +================================================================ +1. Kohärenz: Ein Bereich hat EINE Hauptverantwortung. Module mit gemeinsamer + Verantwortung (z.B. DDP-Layer, Routing-Decision) werden zusammengefasst. +2. Unabhängige Prüfbarkeit: Jeder Bereich hat definierte Eingaben (Triggers), + Ausgaben (Effekte) und kann gegen eine Teilmenge der Vorgaben geprüft werden, + ohne andere Bereiche zu laden. +3. Vollständigkeit: Adapter-Lifecycle, Persistenz, Deployment und Konfiguration + sind explizite Bereiche — nicht "alles andere". + +================================================================ +FUNKTIONSBEREICHE (sortiert nach Onboarding → Verarbeitung → Output → Persistenz → Infrastruktur) +================================================================ + +──────────────────────────────────────────────────────────────────── +FB-01 Onboarding & Review ✅ BEREITS REVIEWED +──────────────────────────────────────────────────────────────────── +Verantwortung: + Steuerung des Erstgesprächs mit neuen Nutzern/Räumen: Greeting-Flow, + Interview-State-Machine, Review-Subphasen, Lock-Mechanismus, Fact-Store-Pfad. + Endet in persistierter room-map.json. + +Hauptdateien: + - plugin/archivar/onboarding.py (492 LOC — Greeting, Lazy-Check, Lock) + - plugin/archivar/onboarding_state.py (592 LOC — StateMachine, OnboardingData) + - plugin/archivar/onboarding_review.py (1146 LOC — Review-Subphasen-Dispatcher) + - plugin/adapter.py (_send_onboarding_message, _complete_onboarding) + - room-map.json / _persist_room_map_changes (Output) + +Schlüsselfeatures: + - F-OB1 Lazy Onboarding (check_room_map_completeness_delta) + - F-OB2 Onboarding-Greeting-Flow (build_greeting_message, run_onboarding_greeting_flow) + - F-OB3 State-Machine (GREETING → AWAITING_NAME → ... → COMPLETE) + - F-OB4 Review-Subphasen (Room-Step, Edit, Keywords-Edit, Theme-Edit, Catch-All-Toggle, Remove, Add-New) + - F-OB5 Fact-Store-Pfad-Validierung + - F-OB6 Onboarding-Lock (acquire/release/cleanup_stale) + +Bekannte Probleme: + - F6 R18 P1: adapter.py Z.4270-4271/5815-5816 rufen self._presence_engine.x OHNE + hasattr/None-Guard — bei Init-Exception (Z.822-827) wirft Onboarding AttributeError + (widerspricht R-4 Graceful Degradation). + - Onboarding-Test-Lock-Datei-Problematik in CI (siehe test_onboarding_lock). + - Verteilung: 1146 LOC in onboarding_review.py → Refactoring-Kandidat + (render_review_room_* sehr ähnlich, Template-Pattern). + +Review-Status: ARCHITEKTUR-REVIEW ABGESCHLOSSEN (Onboarding-Teil). +Vorgaben geprüft: State-Machine-Korrektheit ✅, Review-Buttons-Korrektheit ✅, +Fact-Store-Pfad ✅. Noch offen: Interaction mit FB-04 (Keyword-Lernen) und +FB-09 (Error-Recovery). + +──────────────────────────────────────────────────────────────────── +FB-02 DDP-Client & Verbindungs-Lifecycle ⏳ ANSTEHEND +──────────────────────────────────────────────────────────────────── +Verantwortung: + Aufbau, Aufrechterhaltung und Wiederherstellung der WebSocket-Verbindung zum + Rocket.Chat-Server via DDP-Protokoll. Login, Subscription, Reader-Loop, + Future-Store für await-Semantik, Reconnect-Logik. + +Hauptdateien: + - plugin/adapter.py Z.274-889 (DDPTimeout, DDPServerError, DDPNotConnected, DDPClient) + - plugin/adapter.py Z.292+ (class DDPClient, _recv_loop, Future-Store, result-Handler) + +Schlüsselfeatures: + - F-DDP1 Login (auth-Tokens, self.user-Extraktion aus Login-Response — P0-Fix f61b0ba) + - F-DDP2 Subscribe (stream-room-messages, notify-on-room) + - F-DDP3 Reader-Loop (Blocking, Thread-Trennung, Heartbeat) + - F-DDP4 Future-Store + result-Handler (async-await via run_coroutine_threadsafe, P1-2-O2) + - F-DDP5 Reconnect-Backoff + - F-DDP6 Own-Message-Filter (P0-Fix f61b0ba: self.user aus DDP, nicht Env) + +Bekannte Probleme: + - F19 R19 P0-1 (archiviert, aber referenced): PulseController in presence_engine + erstellt self._pulse_controller/_detection_timer NIE → 348 Zeilen Dead-Code. + NICHT in diesem Bereich, aber DDP-Layer muss fehlende Pulse-Calls + kompensieren (DDP set_status als kostenloser Fallback). + - Eigene DDP-Reader-Thread vs. asyncio.loop-Thread: Synchronisation + prüfen (run_coroutine_threadsafe-Pfad). + +──────────────────────────────────────────────────────────────────── +FB-03 REST-Client & API-Wrapper ⏳ ANSTEHEND +──────────────────────────────────────────────────────────────────── +Verantwortung: + Kapselt die Rocket.Chat-REST-API für Out-of-Band-Operationen: + Posten von Nachrichten, Senden von Buttons, Datei-Upload/Download, + Room-Info-Lookup. Trennt synchronen HTTP-Pfad von asynchronem DDP-Pfad. + +Hauptdateien: + - plugin/adapter.py Z.138-273 (class RocketChatREST) + - plugin/adapter.py Z.31-38 (RocketChatRateLimitError) + - plugin/adapter.py Z.40-130 (Helper: _MULTIROOM, _get_config_str) + +Schlüsselfeatures: + - F-REST1 Message-POST (chat.postMessage) + - F-REST2 Button-Attachments (send mit attachments-Array) + - F-REST3 Rate-Limit-Handling + - F-REST4 Datei-Upload (rooms.upload) + - F-REST5 Datei-Download (für Inlining) + - F-REST6 Room-Info-Lookup (rooms.info, users.info) + +Bekannte Probleme: + - Trennung REST/DDP-Nachrichten: Race-Conditions möglich wenn REST-Post + und DDP-Event dieselbe Nachricht betreffen (z.B. Echo-Filter). + - Token-Refresh: Wenn auth_token abläuft, kein automatischer Re-Login + im REST-Pfad (nur DDP reconnectet). + +──────────────────────────────────────────────────────────────────── +FB-04 Archivar-Routing & Klassifikation ⏳ ANSTEHEND +──────────────────────────────────────────────────────────────────── +Verantwortung: + Kernlogik: Eingehende Nachricht → Klassifikation (FAKT/FRAGE/ALARM/etc.) + → Routing-Decision → Ziel-Raum. Hybrid aus Keyword-Matcher (Stufe 0), + Sentence-Marker-Erkennung, FAISS-Vektor-Routing (Stufe 1) und + LLM-Fallback (Stufe 2). + +Hauptdateien: + - plugin/archivar/router.py (2261 LOC — BidirectionalRouter) + - plugin/archivar/classifier.py (716 LOC — IntentClassifier, EmbeddingClient, LLMClient) + - plugin/archivar/keyword_matcher.py (481 LOC — Stemmer, Levenshtein, Word-Boundary) + - plugin/archivar/sentence_markers.py (307 LOC — MarkerClass, detect_sentence_marker) + - plugin/archivar/booster.py (277 LOC — KeywordBooster) + - plugin/archivar/multiroom_context.py (205 LOC — Cross-Room-Entry, MultiRoomContextRing) + - plugin/archivar/feedback_detector.py (232 LOC — RoutingWiderspruchDetector) + - plugin/archivar/archivar_state.py (1173 LOC — RoomState, ArchivarState) + +Schlüsselfeatures: + - F-RT1 BidirectionalRouter (RoutingDecision, Red-Flag-Erkennung) + - F-RT2 2-Stufen-Klassifikator (Keyword → FAISS → LLM) + - F-RT3 Sentence-Marker-Pattern (FRAGE/ALARM/FAKT/...) + - F-RT4 KeywordBooster (Hybrid mit FAISS) + - F-RT5 Cross-Room-Context-Ring + - F-RT6 Routing-Konflikt-Detektor (Widerspruchs-Erkennung) + - F-RT7 Recursive Routing (v7_4) + - F-RT8 Sticky Sessions (test_sticky_session) + - F-RT9 V8.4 FAISS-Routing-Tests (8 Test-Dateien: v8_4_2 ... v8_4_6) + +Bekannte Probleme: + - 2261 LOC in router.py — höchste Komplexität im Plugin. Refactoring-Druck. + - FAISS-Performance bei wachsendem Index (siehe faiss_performance_test*.py im Root). + - Hybrid-Booster mit FAISS: User-Präferenz aus Memory dokumentiert + ("Hybridansatz mit KeywordBooster"), aber Integration-Drift-Risiko + (R18-Anm.: _update_dst dupliziert deploy_plugin-Logik). + - Sentence-Marker-Validierung: validate_sentence_marker ist async und + wird aus synchronem Routing-Pfad aufgerufen — Race-Risk. + +──────────────────────────────────────────────────────────────────── +FB-05 Presence-Engine & Status-Pulse ⏳ ANSTEHEND (KRITISCH) +──────────────────────────────────────────────────────────────────── +Verantwortung: + Visuelle Präsenz des Butlers: "online"/"away"-Status, Pulse-Intervall, + Detection-Timer (Gateway-Heartbeat-Erkennung). P0-Status: Implementierung + hat dokumentierte Lücken aus F19 R19 Review. + +Hauptdateien: + - plugin/archivar/presence_engine.py (1119 LOC — PresenceEngine, PulseController, DetectionTimer) + - plugin/adapter.py (DDP set_status, on_agent_busy, on_message_received) + +Schlüsselfeatures: + - F-PR1 PresenceEngine (idle/active/dnd-Modi) + - F-PR2 PulseController (Async-Pulse via run_coroutine_threadsafe) + - F-PR3 DetectionTimer (pgrep-Heuristik, gateway_state-Signal) + - F-PR4 ROCKETCHAT_PRESENCE_PULSE_INTERVAL (5-30s Clamp) + - F-PR5 Honeymoon-Timer (b40b221: Status busy minimum 1s sichtbar) + - F-PR6 Status-Farben (d964d7d: grün/gelb/rot, Flughafen-Prinzip) + +Bekannte Probleme (F19 R19 dokumentiert, CHANGES NEEDED): + - P0-1 ARCHITEKTUR-BRUCH: presence_engine erstellt _pulse_controller/ + _detection_timer NIE, adapter instanziiert sie auch nicht → 348 Z. + Dead-Code, alle hasattr-Guards (presence_engine Z.476/488, adapter + Z.871-876) No-Ops. + - P0-2 PulseController.cancel_pending() = pass (Z.604-613) — EC-5 + NICHT implementiert. + - P1-1 on_agent_busy/on_message_received (Z.479/491) in adapter.py + 0 Aufrufer. + - P1-2 K3: ::setstatus on/off ruft enable/disable, nicht PulseController. + - P1-3 ROCKETCHAT_PRESENCE_PULSE_INTERVAL geht an PresenceEngine + (clamp 5-30s), PulseController-Default 1.5s. + - P1-4 DetectionTimer pgrep 'len > 1' — 0 Prozesse = False, kein + Heuristik-Unterschied. + - P1-5 heartbeat_pulse/detection ungelockt. + - P1-6 _pulse_loop Pause-Check nur in Sleep (0.1s Latenz). + - P2-1 pgrep 6/min unkritisch. + - P2-2 REST-Fallback auth_token+user_id ungebunden. + +Review-Status: REVIEW CHANGES NEEDED — keine Freigabe möglich bis P0-1, P0-2, +P1-2 behoben sind. DDP set_status (adapter Z.544-549) ist kostenloser +Workaround bis dahin. + +──────────────────────────────────────────────────────────────────── +FB-06 Inline-Commands (::-Präfix) ⏳ ANSTEHEND +──────────────────────────────────────────────────────────────────── +Verantwortung: + Verarbeitung von `::hilfe`, `::status`, `::multiroom`, etc. — direkte + Nutzer-Befehle, die vor dem Routing abgefangen werden. + +Hauptdateien: + - plugin/archivar/inline_commands.py (431 LOC — InlineCommandRegistry, parse_inline_command) + - plugin/archivar/adapter_integration.py (1270 LOC — Routing-Integration) + +Schlüsselfeatures: + - F-IC1 ::hilfe (build_help_text) + - F-IC2 ::status (build_status_text) + - F-IC3 ::multiroom (Kontext an/aus) + - F-IC4 ::setstatus (on/off, siehe FB-05 P1-2) + - F-IC5 Natural Help Request Detection (is_natural_help_request) + - F-IC6 Command-Question-Extraction (extract_command_question) + - F-IC7 Build-Command-Help (pro Command) + +Bekannte Probleme: + - ::setstatus nutzt enable/disable statt PulseController (siehe FB-05). + - Hilfe-Text-Wartung: Bei neuen Commands muss build_help_text manuell + erweitert werden — kein Auto-Discovery aus Registry. + +──────────────────────────────────────────────────────────────────── +FB-07 Button-System (Rendering, Dispatch, Templates) ⏳ ANSTEHEND +──────────────────────────────────────────────────────────────────── +Verantwortung: + Rendering von interaktiven Button-Attachments (Room-Auswahl, Review-Aktionen, + Move-Requests), Dispatch eingehender Button-Klicks, Template-System. + +Hauptdateien: + - plugin/archivar/onboarding_review.py (build_button_attachments, dispatch_review_button) + - plugin/archivar/inline_commands.py (Button-Hilfe) + - plugin/archivar/archivar_state.py (Button-Action-IDs?) + - plugin/adapter.py (Button-Click-Handler im DDP-Reader-Pfad) + - tests/test_f6_adapter_dispatch.py (F6-Dispatch-Tests) + - tests/test_p1_button_click_fix.py (P1-Button-Klick-Fix) + - docs/BUTTON_GUIDE.md + - docs/move-request-button-ux.md + +Schlüsselfeatures: + - F-BT1 Review-Buttons (room-step, edit, keywords, theme, catch-all, remove, add-new) + - F-BT2 Move-Request-Buttons (Butler Klärungsflow) + - F-BT3 Button-Action-ID-Schema + - F-BT4 Template-Rendering + - F-BT5 F6-Adapter-Dispatch-Pfad (Test existiert, deckt Pfad ab) + +Bekannte Probleme: + - Button-Click-Parsing sitzt in adapter.py — Suchpfad muss verifiziert + werden (P1-Button-Click-Fix deutet auf Historie). + - docs/move-request-button-ux.md deutet auf eigenen Sub-Flow mit + noch nicht vollständig implementierter UX. + +──────────────────────────────────────────────────────────────────── +FB-08 File-Handling (Upload, Download, Inlining, [FILE]-Stripping) ⏳ ANSTEHEND +──────────────────────────────────────────────────────────────────── +Verantwortung: + Behandlung von Datei-Anhängen: Upload via REST, Download für Inline-Vorschau, + [FILE:...]-Block-Stripping bei fehlgeschlagenen Downloads, MIME-Type-Behandlung. + +Hauptdateien: + - plugin/adapter.py (_download_and_inline_files, _upload_file, [FILE]-Stripping) + - plugin/adapter.py (342a1cd: P2-1-Fix — Block-Stripping nach fehlgeschlagenen Downloads) + +Schlüsselfeatures: + - F-FH1 Datei-Upload (rooms.upload via REST) + - F-FH2 Datei-Download (für Inlining) + - F-FH3 [FILE:pfad]-Block-Parsing + - F-FH4 [FILE]-Stripping nach fehlgeschlagenen Downloads (P2-1) + - F-FH5 MIME-Type-Erkennung + +Bekannte Probleme: + - Datei-Pfad-Injektion: [FILE:...]-Parsing muss gegen Traversal gesichert sein. + - Download-Fehler-Handling: 342a1cd behebt Block-Stripping, aber Upload- + Fehler-Fallbacks noch nicht verifiziert. + - Größen-Limits: Kein expliziter Check in adapter.py sichtbar — Regressionsrisiko + bei sehr großen Dateien. + +──────────────────────────────────────────────────────────────────── +FB-09 Butler (Move-Requests, Clarification, 2. Stufe) ⏳ ANSTEHEND +──────────────────────────────────────────────────────────────────── +Verantwortung: + Wenn Routing unsicher ist: Klärungs-Anfrage an Butler (Nutzer) senden, + Antwort verarbeiten, ggf. Move-Request initiieren. "Gelber Status" (away) + signalisiert Klärungsbedarf. + +Hauptdateien: + - plugin/archivar/router.py (_parse_red_flag_response, validate_sentence_marker) + - plugin/archivar/onboarding.py (Lazy-Onboarding-Check) + - plugin/archivar/inline_commands.py (::multiroom-Kontext) + - plugin/adapter.py (Move-Request-Versand) + - docs/move-request-button-ux.md + - docs/rocketchat_send_clarify_architecture.md (im Root-Repo) + - tests/test_butler_mode.py + - tests/test_d_pending_resolver.py + +Schlüsselfeatures: + - F-BU1 Red-Flag-Erkennung (LLM-Antwort unsicher) + - F-BU2 Clarification-Request (Nachfrage an Nutzer) + - F-BU3 Move-Request (Routing-Vorschlag als Button) + - F-BU4 Pending-Resolver (d_pending_resolver) + - F-BU5 Away-Status (573335c: gelb bei Klärungsflow) + - F-BU6 Stufe-2-Klärung (DM-Routing in unsicheren Fällen) + +Bekannte Probleme: + - d_pending_resolver-Tests deutet auf komplexen State-Resolver — Refactoring-Druck. + - Butler-Status-Kopplung an Presence (FB-05): away-Status-Logik muss mit + PulseController-Implementierung harmonieren. + +──────────────────────────────────────────────────────────────────── +FB-10 Room-Map (Verwaltung, Onboarding, Keywords) ⏳ ANSTEHEND +──────────────────────────────────────────────────────────────────── +Verantwortung: + Persistente Datenstruktur für Raum-Metadaten: Raum → Keywords, Theme, + Catch-All-Status, Owner, Excluded-Liste. CRUD-API für Onboarding-Review + und Auto-Learning. + +Hauptdateien: + - plugin/archivar/room_map.py (1043 LOC — RoomEntry, RoomMap, _migrate_from_env_vars) + - plugin/archivar/room_index.py (664 LOC — RoomIndexManager, RoomIndexError) + - room-map.json (Runtime-Output) + +Schlüsselfeatures: + - F-RM1 RoomEntry (name, id, keywords, theme, catch_all, owner) + - F-RM2 RoomMap CRUD (load, save, add_room, remove_room, update_room) + - F-RM3 Two-Stage Keyword Evidence + - F-RM4 Room-Exclusion (excluded_ids) + - F-RM5 Room-Validation (RoomMapValidationError) + - F-RM6 Migration from Env-Vars (_migrate_from_env_vars) + - F-RM7 Write-API (test_room_map_write_api) + - F-RM8 Weighted-Keywords (test_room_map_weighted) + - F-RM9 Room-Index (FAISS-Index für schnelles Lookup) + +Bekannte Probleme: + - Room-Map-Datei ist Single-Source-of-Truth, aber kein Locking-Mechanismus + sichtbar — Concurrency-Risk bei parallelem Onboarding mehrerer Räume. + - Migration-Path von Env-Vars deprecated aber noch vorhanden. + +──────────────────────────────────────────────────────────────────── +FB-11 Adapter-Dispatch & ArchivarMessageHandler ⏳ ANSTEHEND +──────────────────────────────────────────────────────────────────── +Verantwortung: + Glue-Code zwischen DDP-Inbox und Archivar-Subsystem: Message-Sanitizing, + Reply-Quote-Stripping, Auftrags-Erkennung, Decision-Logging, Adapter-Tests + (F6-Dispatch-Pfad). + +Hauptdateien: + - plugin/archivar/adapter_integration.py (1270 LOC — ArchivarMessageHandler) + - plugin/archivar/reply_quote_stripper.py (196 LOC — strip_reply_quote) + - plugin/archivar/sentence_markers.py (Sentence-Marker → Routing-Decision) + - plugin/archivar/routing_telemetry.py (137 LOC — RoutingTelemetry) + - plugin/archivar/routing_counter.py (57 LOC — RoutingCounter) + - plugin/adapter.py (_is_auftrag, _build_announcement, ArchivarMessageHandler-Aufruf) + - tests/test_f6_adapter_dispatch.py + - tests/test_reply_quote_stripper.py + - tests/test_r5_inline_commands.py + - tests/test_a1b_integration.py + - tests/test_r1_integration.py + +Schlüsselfefeatures: + - F-AD1 ArchivarMessageHandler (Hauptentry-Point für DDP-Nachrichten) + - F-AD2 Reply-Quote-Stripping (RC-spezifisch: [ ](per-Channel)) + - F-AD3 Auftrags-Erkennung (_is_auftrag) + - F-AD4 Routing-Telemetry (Entscheidungsprotokollierung) + - F-AD5 Routing-Counter (Häufigkeits-Statistik) + - F-AD6 Adapter-Dispatch-Pfad (F6) + +Bekannte Probleme: + - 1270 LOC in adapter_integration.py — Kandidat für Aufteilung in + Pre-Processing / Decision / Post-Processing. + - Reply-Quote-Stripping: 4 Strip-Funktionen (attachments, rc-reply-link, + blockquotes, quote-blocks) — Reihenfolge-Risiko. + +──────────────────────────────────────────────────────────────────── +FB-12 Config & Persistenz ⏳ ANSTEHEND +──────────────────────────────────────────────────────────────────── +Verantwortung: + Konfigurations-Management: plugin.yaml (Manifest), templates/config.yaml + (Default), .env (Runtime-Secrets), room-map.json (Runtime-State), + Fact-Store-Pfad-Validierung, Conversation-History. + +Hauptdateien: + - plugin/plugin.yaml (12 LOC — name: rocketchat, kind: platform) + - templates/config.yaml (88 LOC — Default-Config) + - .env (Runtime — nicht in Git) + - plugin/archivar/config.py (338 LOC — _resolve_room_mapping) + - plugin/archivar/doc_store.py (144 LOC — DocumentationStore) + - plugin/archivar/conversation_history.py (237 LOC — ConversationHistory, MessageEntry) + - plugin/archivar/seed_data.py (134 LOC — Seed-Data) + - room-map.json (Runtime-Output) + +Schlüsselfeatures: + - F-CF1 plugin.yaml-Manifest (Pitfall 4: name muss "rocketchat" sein) + - F-CF2 templates/config.yaml (Default-Config-Template) + - F-CF3 .env-Loading (via _get_config_str mit env_var-Fallback) + - F-CF4 Fact-Store-Pfad (validate_fact_store_path, create_and_verify_fact_store) + - F-CF5 DocumentationStore (FAKT-Routing-Output) + - F-CF6 ConversationHistory (gespeicherte Konversations-Snapshots) + - F-CF7 Seed-Data (Erstausstattung Room-Map, Keywords) + +Bekannte Probleme: + - .env nicht versioniert — Drift zwischen Test- und Prod-Config. + - Migration _migrate_from_env_vars deprecated, aber noch im Code. + - plugin.yaml-Name "rocketchat" (P1-2-O2-Fix 83b9d6c) — Hinweis auf + subtile Pitfall-Klassen (Plugin-Loader-Strict-Matching). + +──────────────────────────────────────────────────────────────────── +FB-13 install.sh & Deployment ⏳ ANSTEHEND +──────────────────────────────────────────────────────────────────── +Verantwortung: + Deployment-Skript: Plugin-Pfad-Validierung, venv-Setup, systemd-Service- + Konfiguration, Verifikations-Loop, Restart-Logik. 11 dokumentierte + Susi-Deployment-Pitfalls. + +Hauptdateien: + - install.sh (1611 LOC — Deployment, 99979d6 dokumentiert 9 Pitfalls) + - bootstrap.sh (2325 Bytes — Wrapper?) + - scripts/rebuild_index.py (FAISS-Index-Rebuild) + - scripts/smoke_test_booster.py (Booster-Smoke-Test) + - scripts/smoke_test_faiss.py (FAISS-Smoke-Test) + - docs/INSTALL.md + - docs/deployment-runbook.md + - tests/test_install_update_only.py + +Schlüsselfeatures: + - F-IN1 Plugin-Pfad-Validierung (Core-Plugin-Pfad vs. Custom) + - F-IN2 venv-Setup (numpy2-Installations-Pitfall) + - F-IN3 systemd-Service-Config + - F-IN4 Verifikations-Loop (is-active-Check, 30s-Timeout) + - F-IN5 Update-Only-Pfad (test_install_update_only) + - F-IN6 bootstrap.sh (Schnell-Setup) + - F-IN7 Index-Rebuild-Skript + - F-IN8 Smoke-Tests (Booster, FAISS) + +Bekannte Probleme: + - F6 R18 dokumentiert: 11 Pitfalls, install.sh 5 Schritte sauber, + 30s is-active-Loop robust, journalctl --since '1 minute ago' akzeptiert + (systemd 257 getestet), --no-restart + --dry-run korrekt. + - F6 R18: bash -n OK. + - F18 (18d87d8): local outside function — replace with plain assignment + (kleiner Cleanup, P0-charakter). + +Review-Status: F6 R18 APPROVED mit 1 P1 (adapter.py Guard-Issue, NICHT +install.sh selbst). Verifikation: 1288 passed, 37 failed pre-existing. + +──────────────────────────────────────────────────────────────────── +FB-14 Telemetrie, Tests & Diagnostics ⏳ ANSTEHEND +──────────────────────────────────────────────────────────────────── +Verantwortung: + Routing-Telemetry, Routing-Counter, Test-Infrastruktur (pytest + 70 Test-Dateien), + Diagnostics-Endpoints, Performance-Tests. + +Hauptdateien: + - plugin/archivar/routing_telemetry.py (137 LOC) + - plugin/archivar/routing_counter.py (57 LOC) + - plugin/archivar/tests/ (Test-Suite archivar-intern) + - tests/ (Top-level-Tests: test_adapter, test_booster, test_ddp_await, test_install_update_only, test_onboarding, test_room_index) + - scripts/smoke_test_*.py + - faiss_performance_test*.py (im Root-Repo, nicht im Plugin) + +Schlüsselfeatures: + - F-TM1 Routing-Telemetry (Entscheidungs-Logging) + - F-TM2 Routing-Counter (Statistik) + - F-TM3 Test-Suite (70+ Dateien, F6-F19-Generationen) + - F-TM4 Smoke-Tests (Booster, FAISS) + - F-TM5 Performance-Tests (FAISS, Index-Größe) + +Bekannte Probleme: + - Test-Suite-Wartung: 16 v8_4_x-Dateien deuten auf hohe Iterationsfrequenz + — Refactoring-Signale. + - 37 pre-existing failed Tests (laut F6 R18) — müssen auf "broken-by-design" + oder "fixable" klassifiziert werden. + +================================================================ +ZUSAMMENFASSUNG +================================================================ + +14 Funktionsbereiche identifiziert, alle Plugin-Aspekte abgedeckt: + + ✅ FB-01 Onboarding & Review REVIEWED (F6 R18) + ⏳ FB-02 DDP-Client ANSTEHEND + ⏳ FB-03 REST-Client ANSTEHEND + ⏳ FB-04 Archivar-Routing & Klassifikation ANSTEHEND (komplex, 2261 LOC) + ⏳ FB-05 Presence-Engine & Pulse ANSTEHEND, CHANGES NEEDED + ⏳ FB-06 Inline-Commands ANSTEHEND + ⏳ FB-07 Button-System ANSTEHEND + ⏳ FB-08 File-Handling ANSTEHEND + ⏳ FB-09 Butler (Move/Clarify) ANSTEHEND + ⏳ FB-10 Room-Map ANSTEHEND + ⏳ FB-11 Adapter-Dispatch ANSTEHEND + ⏳ FB-12 Config & Persistenz ANSTEHEND + ⏳ FB-13 install.sh & Deployment ANSTEHEND (F6 R18 APPROVED) + ⏳ FB-14 Telemetrie & Tests ANSTEHEND + +Review-Reihenfolge-Empfehlung (nach Abhängigkeit + Risiko): + 1. FB-05 Presence (P0-Blocker für 8+ andere Bereiche) + 2. FB-13 install.sh (F6 R18 APPROVED → Re-Verifikation der P1) + 3. FB-02 DDP-Client (Grundlage für alle Inbox-Pfade) + 4. FB-04 Archivar-Routing (komplex, zentral, FAISS-Tests vorhanden) + 5. FB-10 Room-Map (Datenquelle für FB-04) + 6. FB-11 Adapter-Dispatch (Glue zwischen DDP und Archivar) + 7. FB-09 Butler (koppelt zurück an FB-05) + 8. FB-06 Inline-Commands (kleiner, isoliert) + 9. FB-07 Button-System (UX-kritisch, dokumentiert in BUTTON_GUIDE.md) + 10. FB-08 File-Handling (Sicherheits-Relevanz) + 11. FB-12 Config & Persistenz (Grundlage, niedrig-Risiko) + 12. FB-03 REST-Client (einfach, von DDP abgekoppelt) + 13. FB-14 Telemetrie & Tests (Wartbarkeit, Querschnitt) + +Lücken-/Überlappungs-Check: + - ABGEDECKT: DDP, REST, Routing, Onboarding, Presence, Inline-Commands, + Buttons, Files, Butler, Room-Map, Config, Deployment, Tests. + - NICHT als eigener Bereich: Logging (Querschnitt, in jedem FB prüfen), + Error-Handling (Querschnitt), Security (Querschnitt — siehe FB-08, + FB-12, FB-10 für Pfad-/Lock-Aspekte). + - EXPLIZIT AUSGELAGERT: room-map.json sowohl in FB-10 (Schema) als auch + FB-12 (Persistenz) — bei Review Klarstellung welcher Bereich + Schema-Validierung vs. I/O-Verantwortung trägt. diff --git a/plugin/adapter.py b/plugin/adapter.py index 98089e2..9ea0265 100644 --- a/plugin/adapter.py +++ b/plugin/adapter.py @@ -2183,7 +2183,15 @@ class RocketChatAdapter(BasePlatformAdapter): # als Freitext an den LLM-Agenten durchgereicht werden. _review_phases = {"review_room", "review_butler", "review_fakt"} is_onboarding = ( - (is_operator_room and stripped.startswith("ONBOARD:")) # v2 Button-Klick + # P0-3: Prefix-Checks VOR Phase-Inspektion (Defense in Depth) + # Fängt FAKT::/REVIEW_*/⏰ auch bei State-Verlust ab + (is_operator_room and stripped.startswith("FAKT::")) + or (is_operator_room and stripped.startswith("REVIEW_BUTLER::")) + or (is_operator_room and stripped.startswith("REVIEW_FAKT::")) + or (is_operator_room and stripped.startswith("REVIEW_ROOM")) + or (is_operator_room and "⏰" in stripped) + or (is_operator_room and stripped.lower() == "später") + or (is_operator_room and stripped.startswith("ONBOARD:")) # v2 Button-Klick or (is_operator_room and stripped.startswith("BUTLER:")) # Fix C v7: Butler-Mode Button or (is_operator_room and self._onboarding_state.get("current_room_index", -1) >= 0) # v2 Interview läuft or (is_operator_room and self._onboarding_state.get("phase") == "butler_mode") # Fix C v7: Butler-Mode Phase