diff --git a/apps/api/src/jobs/ai_slo_watchdog_job.py b/apps/api/src/jobs/ai_slo_watchdog_job.py index d4aff21b..dd512120 100644 --- a/apps/api/src/jobs/ai_slo_watchdog_job.py +++ b/apps/api/src/jobs/ai_slo_watchdog_job.py @@ -112,8 +112,26 @@ async def _check_once() -> None: except Exception as e: logger.warning("watchdog_w5_stuck_analysis_check_failed", error=str(e)) + # W-6: Trust Drift 偵測(Playbook 信任度分布偏態) + # P2.6 接入 2026-04-24 ogt + Claude Sonnet 4.6 + # trust_drift_detector 是孤立服務,此處首次接入 watchdog 自動觸發 + try: + from src.services.trust_drift_detector import get_trust_drift_detector + dist = await get_trust_drift_detector().run() + if dist.drift_detected: + drift_labels = { + "optimism_bias": "盲目樂觀 — PostExecutionVerifier 可能失效或 RAG 資料污染", + "confidence_collapse": "學習鎖死 — EWMA 計算異常或所有執行誤判失敗", + } + label = drift_labels.get(dist.drift_type or "", dist.drift_type or "未知") + violations.append( + f"Trust Drift 偵測到 {label}(高分 {dist.high_ratio:.0%} / 低分 {dist.low_ratio:.0%},共 {dist.total} 個 Playbook)" + ) + except Exception as e: + logger.warning("watchdog_w6_trust_drift_check_failed", error=str(e)) + if not violations: - logger.debug("ai_slo_watchdog_all_ok", checks=5) + logger.debug("ai_slo_watchdog_all_ok", checks=6) return # 去重:violations 相同內容 1 小時內不重複發