diff --git a/apps/api/src/api/v1/webhooks.py b/apps/api/src/api/v1/webhooks.py index 269536ce..ac13671d 100644 --- a/apps/api/src/api/v1/webhooks.py +++ b/apps/api/src/api/v1/webhooks.py @@ -343,6 +343,8 @@ async def _push_to_telegram_background( auto_tuning_command: str = "", # 2026-04-02 ogt: 修復 ai_provider 未傳遞 → Telegram 顯示「AI 仲裁判定」而非具體模型名稱 ai_provider: str = "", + # 2026-04-08 ogt: 補傳 incident_id 以啟用詳情/重診/歷史按鈕 + incident_id: str = "", ) -> None: """ 背景任務: 推送待簽核卡片到 Telegram (v7.0 含 SignOz 整合) @@ -392,6 +394,7 @@ async def _push_to_telegram_background( ai_tokens=ai_tokens, ai_cost=ai_cost, ai_provider=ai_provider, + incident_id=incident_id, ) logger.info( @@ -967,6 +970,8 @@ async def receive_alert( ai_tokens=ai_tokens, ai_cost=ai_cost, ai_provider=ai_provider, + # 2026-04-08 ogt: 補傳 incident_id 以啟用詳情/重診/歷史按鈕 + incident_id="", # /alerts 路徑尚無 incident,detail/reanalyze/history 按鈕不顯示 ) return AlertResponse( @@ -1407,6 +1412,8 @@ async def alertmanager_webhook( ai_tokens=ai_tokens, ai_cost=ai_cost, ai_provider=ai_provider, + # 2026-04-08 ogt: 補傳 incident_id 以啟用詳情/重診/歷史按鈕 + incident_id=incident_id, ) record_alert_chain_success("alertmanager") @@ -1445,7 +1452,7 @@ async def alertmanager_webhook( # ================================================================ # Incident-Approval 同步 (鐵律: 即使 LLM 失敗也必須創建) # ================================================================ - await create_incident_for_approval( + fallback_incident_id = await create_incident_for_approval( approval_id=str(approval.id), risk_level="medium", target_resource=target_resource, @@ -1467,6 +1474,7 @@ async def alertmanager_webhook( primary_responsibility="HUMAN", confidence=0.0, namespace=namespace, + incident_id=fallback_incident_id, ) return AlertResponse(