test: add tests for email loop prevention
Add tests/test_email_loop_prevention.py (47 tests) covering:
- detect_automated_message(): sender patterns (mailer-daemon, postmaster,
noreply, …), RFC headers (Auto-Submitted, X-Auto-Response-Suppress,
multipart/report, X-Loop, Precedence), subject heuristics (German and
English bounce/OOO phrases), and negative cases for normal senders
- EmailAgent.handle_automated_message(): state creation, loop_escalated
flag, one-shot admin alert, silent drop on repeat, notifier failure safety
- EmailAgent.process_message() message-count cap: at-limit still processes,
over-limit returns "", escalation called once, duplicate prevention,
notifier failure safety, constant value assertion
- AdminNotifier.notify_loop_escalation(): SMTP dispatch, [WARNUNG] subject,
body content, no-CC guard, no-SMTP dev-mode guard
Add TestConversationStateLoopEscalated to test_models.py (5 tests):
default value, to_dict inclusion, True round-trip, from_dict backward
compatibility with persisted conversations missing the key.
All 168 tests pass.
https://claude.ai/code/session_01KwvR5hDPjSuJg4kvw5b5e5