Files
ewoooc/services
ogt 61496af2c5
All checks were successful
CD Pipeline / deploy (push) Successful in 1m20s
fix: stop runaway EA Telegram spam (cooldown + API key detection + dedup)
Root cause: OPENROUTER_API_KEY not set → fallback confidence=0.60 →
always below threshold → _escalate_to_human() every 60s loop → infinite
Telegram messages, all meaningless.

Three-layer fix:
1. API Key detection: if fallback_decision triggered (reasoning contains
   "Elephant Alpha unavailable"), silently skip — no Telegram, no cost,
   update last_triggered to prevent infinite retry
2. Per-trigger cooldown in _check_triggers():
   price_drop_alert 30min / market_opportunity 60min /
   threat_escalation 15min / resource_optimization 60min
3. Escalation dedup in _escalate_to_human(): _last_escalated[] tracks
   last Telegram send time per trigger type; suppresses within cooldown

Valid HITL escalations (when EA is actually online) still work correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 05:34:21 +08:00
..