telegram: attach AI panel to alert-quality sends (advisory block)

Auto-scan and level-breach alert paths attach the panel AFTER the
quality gate and dedup decision (no LLM spend on suppressed alerts),
via run_in_executor so the event loop stays free. Alert message gains a
two-line 🤖 AI Panel block (verdict + confidence + rationale, persona
votes); /status shows the daily panel budget when the feature is on.

Claude-Session: https://claude.ai/code/session_01SisdfkxnXNL9iZsXxN3T15
This commit is contained in:
Harwinder Sekhon
2026-08-07 22:32:57 -04:00
parent 7be2231eb3
commit a7c2bfc7da
2 changed files with 47 additions and 0 deletions
+20
View File
@@ -7235,6 +7235,26 @@ def _():
ap.reset_panel_state()
@test("panel verdict flows to Telegram message; absent verdict silent")
def _():
import telegram_bot as tb
report = _panel_report()
assert "AI Panel" not in tb.format_signal_message(report)
report.panel_verdict = "OPPOSE"
report.panel_confidence = 64.0
report.panel_rationale = "counter-trend against aligned H4"
report.panel_takes = [
{"persona": "macro", "stance": "support", "confidence": 60,
"note": "n"},
{"persona": "technical", "stance": "oppose", "confidence": 80,
"note": "n"},
]
msg = tb.format_signal_message(report)
assert "AI Panel" in msg and "OPPOSE" in msg and "(64%)" in msg
assert "counter-trend against aligned H4" in msg
assert "macro:sup" in msg and "technical:opp" in msg
@test("backtest parity: analyze_from_dataframes never populates panel")
def _():
try: