OoO f10999ed1c
Some checks are pending
CD Pipeline / deploy (push) Has started running
feat(p43): Ollama 主機 state transition 自動告警 + inline AutoHeal 閉環
問題:
Phase 42 加 scheduler 每 15min probe 寫入 host_health_probes,但只是
silent 累積 — 主機真的掛掉時統帥仍然要主動開觀測台才知道。

修補:
- run_scheduler.py::run_host_health_probe
  寫入 DB 之前先查同 host 的最近一筆 probe 比對
  state transition 偵測:
    healthy → unhealthy:推 P1 告警 + inline AutoHeal 按鈕
    unhealthy → healthy:推 P3 「已恢復」訊息
- run_scheduler.py::_push_host_transition_alert(新 helper)
  使用 services.telegram_templates::send_telegram_with_result
  inline keyboard 含「🩹 立即 AutoHeal {GCP-A|GCP-B|111}」按鈕
  + 「📊 查 24h 健康統計」次按鈕
  按鈕 callback_data 對齊既有 Phase 41 cmd:obs_heal handler
- Dedup:1 小時內同 host 同方向 transition 只推一次(防 flapping 洗版)
  用 host_health_probes 自身查歷史對比,無需新 dedup 表

完整閉環:
  scheduler 每 15min probe → 偵測 state transition → 推 Telegram 告警
  → 統帥點 inline button → cmd:obs_heal:{label} → AutoHeal 跑 ADR-013
  playbook → 寫入 incidents + heal_logs → 下一次 probe 偵測 unhealthy→
  healthy → 推「已恢復」訊息

至此觀測台從「raw stats dashboard」進化為:
  - 持續累積歷史(Phase 42)
  - 主動告警 + 一鍵修復(Phase 43)
  - 完整閉環自動化(從監控到復原全自動,僅關鍵節點需人工確認)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 19:26:54 +08:00
Description
EwoooC — 商品看板 + 業績報表 + AI KM (Flask + pgvector, Docker Compose on 188)
37 MiB
Languages
PostScript 59.7%
Python 30.9%
HTML 4.2%
CSS 2.1%
JavaScript 1.9%
Other 1.1%