feat(governance): show knowledge degradation ownership
This commit is contained in:
@@ -367,6 +367,7 @@ _TOP_LEVEL_FALLBACK_KEEP: dict[str, set[str]] = {
|
||||
"automatable_work",
|
||||
"next_action",
|
||||
"next_step",
|
||||
"ownership",
|
||||
"ratio",
|
||||
"stale",
|
||||
"stale_count",
|
||||
@@ -543,6 +544,51 @@ def _governance_operator_context(event_type: str, impact: dict[str, Any]) -> lis
|
||||
]
|
||||
|
||||
|
||||
def _governance_ownership_lines(event_type: str, payload: dict[str, Any]) -> list[str]:
|
||||
"""Return explicit agent ownership for governance alerts."""
|
||||
ownership = _as_dict(payload.get("ownership"))
|
||||
|
||||
if not ownership and event_type == "knowledge_degradation":
|
||||
ownership = {
|
||||
"lead_agent": "Hermes",
|
||||
"lead_reason": "E7 自動 KM 主責:反查 Incident / Sentry / SigNoz / PlayBook,產生 KM 更新草稿與任務。",
|
||||
"support_agents": [
|
||||
"OpenClaw:提供告警分類、規則匹配與 PlayBook 脈絡摘要,不直接批量改寫 KM。",
|
||||
"ElephantAlpha:read-only 稽核高影響 KM 草稿與風險,不執行寫入或通知。",
|
||||
],
|
||||
"human_owner": "KM owner / SRE owner",
|
||||
"human_reason": "審核高影響 KM 後才允許寫入,避免 AI 自動固化錯誤知識。",
|
||||
}
|
||||
|
||||
if not ownership:
|
||||
return []
|
||||
|
||||
rows: list[str] = []
|
||||
lead_agent = ownership.get("lead_agent")
|
||||
lead_reason = ownership.get("lead_reason")
|
||||
if lead_agent:
|
||||
lead_text = f"主責:{lead_agent}"
|
||||
if lead_reason:
|
||||
lead_text += f" — {lead_reason}"
|
||||
rows.append(lead_text)
|
||||
|
||||
support_agents = ownership.get("support_agents")
|
||||
if isinstance(support_agents, list):
|
||||
rows.extend(str(item) for item in support_agents if item)
|
||||
|
||||
human_owner = ownership.get("human_owner")
|
||||
human_reason = ownership.get("human_reason")
|
||||
if human_owner:
|
||||
human_text = f"人工覆核:{human_owner}"
|
||||
if human_reason:
|
||||
human_text += f" — {human_reason}"
|
||||
rows.append(human_text)
|
||||
|
||||
if not rows:
|
||||
return []
|
||||
return ["", "👥 *負責分工*", _tree_lines(rows)]
|
||||
|
||||
|
||||
def format_governance_alert_card(event_type: str, payload: dict[str, Any]) -> str:
|
||||
"""格式化 AI 治理 Telegram 卡片。
|
||||
|
||||
@@ -571,6 +617,7 @@ def format_governance_alert_card(event_type: str, payload: dict[str, Any]) -> st
|
||||
]
|
||||
|
||||
sections.extend(_governance_operator_context(event_type, impact))
|
||||
sections.extend(_governance_ownership_lines(event_type, payload))
|
||||
|
||||
impact_lines = _governance_summary_lines(event_type, impact)
|
||||
if impact_lines:
|
||||
|
||||
@@ -224,6 +224,16 @@ class GovernanceAgent:
|
||||
],
|
||||
"next_action": "run_kb_growth_healthcheck",
|
||||
},
|
||||
"ownership": {
|
||||
"lead_agent": "Hermes",
|
||||
"lead_reason": "E7 自動 KM 主責:反查 Incident / Sentry / SigNoz / PlayBook,產生 KM 更新草稿與任務。",
|
||||
"support_agents": [
|
||||
"OpenClaw:提供告警分類、規則匹配與 PlayBook 脈絡摘要,不直接批量改寫 KM。",
|
||||
"ElephantAlpha:read-only 稽核高影響 KM 草稿與風險,不執行寫入或通知。",
|
||||
],
|
||||
"human_owner": "KM owner / SRE owner",
|
||||
"human_reason": "審核高影響 KM 後才允許寫入,避免 AI 自動固化錯誤知識。",
|
||||
},
|
||||
"actionable": {
|
||||
"items": [
|
||||
"每日檢查 ANTI_PATTERN 更新結果",
|
||||
|
||||
Reference in New Issue
Block a user