fix(flywheel): 修補剩餘 P0/P1 缺陷
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled

- CRITICAL-1: TYPE-1 path approval_id=str(alert_id) → uuid.uuid4(),
  避免 UUID(approval_id) 拋 ValueError 導致所有 Heartbeat/Info 告警崩潰
- CRITICAL-2: asyncio.create_task() 結果存入 _exec_task 並加 done_callback,
  防止 GC 在執行中途回收任務
- FORMAT: _push_to_telegram_background 新增 notification_type + diff_summary 參數,
  TYPE-4D → send_drift_card(),其他 → send_approval_card()(修正 ConfigDrift 顯示錯誤卡片)
- 傳遞 notification_type 至 Alertmanager 兩個呼叫點

ADR-073 四斷點修補最終收尾

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-12 17:14:46 +08:00
parent cce55d560d
commit 99b489ca63
2 changed files with 32 additions and 4 deletions

View File

@@ -4582,7 +4582,10 @@ class TelegramGateway:
if execution_triggered:
import asyncio
from src.services.approval_execution import get_execution_service
asyncio.create_task(get_execution_service().execute_approved_action(approval))
_exec_task = asyncio.create_task(
get_execution_service().execute_approved_action(approval)
)
_exec_task.add_done_callback(lambda t: t.exception() if not t.cancelled() else None)
logger.info(
"telegram_approval_execution_triggered",
approval_id=approval_id,