Files
Hermes_rocket.chat_Plugin/plugin
Bernd (Hermes) 438d4bc2cb plugin: Post-Crash-Forensik + skip_background_review-Integration
Feature 1: crash_forensics.py (~447 Zeilen)
- classify_crash_source() — Plugin vs Core aus Traceback
- reconstruct_counter_drift() — Counter Soll/Ist Vergleich
- format_crash_forensic_report() — 6 Datenpunkte mit CRASH-FORENSIK: Präfix
- gather_journal_for_pid() — journalctl via asyncio.create_subprocess_exec
- check_for_predecessor_crash() — 4-Quellen-Korrelation:
  (1) Heartbeat-Leiche, (2) journalctl, (3) restart_loop.json, (4) gateway_state.json
- run_post_crash_forensic_test() — Test-Mode mit simulierten Daten
- Filter: Heartbeat >1h skip, planned_takeover skip
- try/except — blockiert NIEMALS den Gateway-Start

Feature 2: adapter.py connect() Integration
- _crash_forensic_done Flag in __init__()
- Forensik-Aufruf ALS ALLERERSTES in connect() (vor REST-Login, vor DDP)
- Nur beim initialen Connect, nicht bei Reconnects

Rainers 5 Prüfpunkte verifiziert:
1. Heartbeat-Pfad: ~/.hermes/state/gateway.heartbeat
2. journalctl: systemctl --user (User-Unit)
3. AIAgent-Aufrufstellen: 3 Stellen in gateway/run.py (Z.5336, 18427, 21209)
4. planned_takeover: shutdown_forensics.py .gateway-takeover.json
5. subprocess: asyncio.create_subprocess_exec (async-konform)

Tests:
- run_post_crash_forensic_test(): 6 Datenpunkte korrekt
- check_for_predecessor_crash() ohne Heartbeat: None (kein False-Positive)
2026-08-14 20:44:22 +02:00
..