{
  "schema_version": "service_health_failure_notification_policy_v1",
  "generated_at": "2026-06-05T16:20:00+08:00",
  "source_service_health_matrix_ref": "docs/evaluations/service_health_gap_matrix_2026-06-05.json",
  "source_refs": [
    "docs/evaluations/service_health_gap_matrix_2026-06-05.json",
    "docs/schemas/service_health_failure_notification_policy_v1.schema.json",
    "docs/HARD_RULES.md",
    "docs/ai/AI_AGENT_AUTOMATION_WORKLIST_2026-06-04.md",
    "apps/api/tests/test_telegram_message_templates.py"
  ],
  "program_status": {
    "overall_completion_percent": 100,
    "current_priority": "P1",
    "current_task_id": "P1-007",
    "next_task_id": "P2-004",
    "read_only_mode": true
  },
  "rollups": {
    "total_rules": 7,
    "by_decision": {
      "suppress_immediate_success": 2,
      "create_action_required": 2,
      "escalate_immediate": 3
    },
    "immediate_escalation_rule_ids": [
      "production_api_health_failed",
      "ollama_provider_health_action_required",
      "security_scanner_health_blocked"
    ],
    "suppressed_success_rule_ids": [
      "service_health_verified",
      "endpoint_freshness_verified"
    ],
    "action_required_rule_ids": [
      "stale_endpoint_detected",
      "health_gap_requires_owner_review"
    ],
    "notification_send_allowed_count": 0
  },
  "notification_channels": [
    {
      "channel_id": "awooop_operator_event",
      "purpose": "承載需人工處理、incident 或 approval evidence 的 operator-visible event。",
      "immediate_allowed": true,
      "success_immediate_allowed": false,
      "requires_operator_action": true
    },
    {
      "channel_id": "telegram_ops",
      "purpose": "只承載 failure、blocked、critical action-required 即時升級；成功與一般 verified 狀態不得即時送出。",
      "immediate_allowed": true,
      "success_immediate_allowed": false,
      "requires_operator_action": true
    },
    {
      "channel_id": "governance_readonly_ui",
      "purpose": "顯示 committed policy、evidence refs、next action 與禁止事項；不發送通知。",
      "immediate_allowed": false,
      "success_immediate_allowed": false,
      "requires_operator_action": false
    },
    {
      "channel_id": "daily_status_summary",
      "purpose": "成功與非緊急狀態只進每日摘要，避免 Telegram / AwoooP 成功洗版。",
      "immediate_allowed": false,
      "success_immediate_allowed": false,
      "requires_operator_action": false
    }
  ],
  "policy_rules": [
    {
      "rule_id": "service_health_verified",
      "event_kind": "service_health_target_verified",
      "service_state": "verified",
      "severity": "info",
      "decision": "suppress_immediate_success",
      "channels": [
        "governance_readonly_ui",
        "daily_status_summary"
      ],
      "owner_agent": "hermes",
      "requires_incident": false,
      "requires_approval_record": false,
      "message_contract": "健康目標已驗證時只更新治理頁與每日摘要；不得送 Telegram / AwoooP 即時成功訊息。",
      "evidence_refs": [
        "docs/evaluations/service_health_gap_matrix_2026-06-05.json"
      ]
    },
    {
      "rule_id": "endpoint_freshness_verified",
      "event_kind": "endpoint_freshness_verified",
      "service_state": "verified",
      "severity": "info",
      "decision": "suppress_immediate_success",
      "channels": [
        "governance_readonly_ui",
        "daily_status_summary"
      ],
      "owner_agent": "hermes",
      "requires_incident": false,
      "requires_approval_record": false,
      "message_contract": "端點 freshness 已對齊時只更新 committed evidence 與每日摘要；不得即時洗版。",
      "evidence_refs": [
        "docs/evaluations/service_health_gap_matrix_2026-06-05.json"
      ]
    },
    {
      "rule_id": "stale_endpoint_detected",
      "event_kind": "service_health_stale_endpoint",
      "service_state": "action_required",
      "severity": "warning",
      "decision": "create_action_required",
      "channels": [
        "awooop_operator_event",
        "governance_readonly_ui",
        "daily_status_summary"
      ],
      "owner_agent": "openclaw",
      "requires_incident": false,
      "requires_approval_record": false,
      "message_contract": "過期端點先建立 action-required，必須帶 stale ref、current truth、evidence ref 與下一步；不得直接改 endpoint。",
      "evidence_refs": [
        "docs/evaluations/service_health_gap_matrix_2026-06-05.json"
      ]
    },
    {
      "rule_id": "health_gap_requires_owner_review",
      "event_kind": "service_health_gap_requires_owner_review",
      "service_state": "action_required",
      "severity": "high",
      "decision": "create_action_required",
      "channels": [
        "awooop_operator_event",
        "governance_readonly_ui",
        "daily_status_summary"
      ],
      "owner_agent": "openclaw",
      "requires_incident": false,
      "requires_approval_record": true,
      "message_contract": "健康缺口需 owner review 時建立 action-required 與 approval evidence；不得 live probe 或重啟。",
      "evidence_refs": [
        "docs/evaluations/service_health_gap_matrix_2026-06-05.json"
      ]
    },
    {
      "rule_id": "production_api_health_failed",
      "event_kind": "production_api_health_failed",
      "service_state": "failed",
      "severity": "critical",
      "decision": "escalate_immediate",
      "channels": [
        "awooop_operator_event",
        "telegram_ops",
        "governance_readonly_ui"
      ],
      "owner_agent": "openclaw",
      "requires_incident": true,
      "requires_approval_record": false,
      "message_contract": "正式 API health 失敗才可升級；訊息必須包含 target、last committed evidence、stage、next action 與 blocked reason，不得夾帶 secret。",
      "evidence_refs": [
        "docs/evaluations/service_health_gap_matrix_2026-06-05.json"
      ]
    },
    {
      "rule_id": "ollama_provider_health_action_required",
      "event_kind": "ai_provider_health_action_required",
      "service_state": "failed",
      "severity": "critical",
      "decision": "escalate_immediate",
      "channels": [
        "awooop_operator_event",
        "telegram_ops",
        "governance_readonly_ui"
      ],
      "owner_agent": "openclaw",
      "requires_incident": true,
      "requires_approval_record": true,
      "message_contract": "AI provider 健康關鍵失敗才升級；必須顯示 provider lane、fallback impact、evidence ref 與人工批准需求，不得切 provider。",
      "evidence_refs": [
        "docs/evaluations/service_health_gap_matrix_2026-06-05.json",
        "docs/evaluations/ai_provider_route_matrix_2026-06-05.json"
      ]
    },
    {
      "rule_id": "security_scanner_health_blocked",
      "event_kind": "security_scanner_health_blocked",
      "service_state": "blocked",
      "severity": "critical",
      "decision": "escalate_immediate",
      "channels": [
        "awooop_operator_event",
        "telegram_ops",
        "governance_readonly_ui"
      ],
      "owner_agent": "openclaw",
      "requires_incident": true,
      "requires_approval_record": true,
      "message_contract": "安全掃描健康阻擋才升級；必須保留 Kali / scanner 只讀邊界，不得觸發 active scan 或 /execute。",
      "evidence_refs": [
        "docs/evaluations/service_health_gap_matrix_2026-06-05.json"
      ]
    }
  ],
  "message_template_contract": {
    "required_fields": [
      "stage",
      "next_action",
      "blocked_reason",
      "auto_or_manual",
      "target_id",
      "severity",
      "evidence_ref"
    ],
    "forbidden_fields": [
      "secret_value",
      "token",
      "authorization_header",
      "private_key",
      "database_password",
      "work_window_transcript",
      "codex_user_message",
      "prompt_text",
      "chain_of_thought",
      "session_id",
      "browser_context"
    ],
    "success_message_policy": "成功與 verified 狀態不得即時送 Telegram / AwoooP，只能進治理頁與每日摘要。",
    "failure_message_policy": "critical failed / blocked 或 high action-required 才可升級，但本 snapshot 不授權實際發送。"
  },
  "agent_roles": [
    {
      "agent_id": "openclaw",
      "role": "判斷 service health failure / action-required 是否需要 incident、approval 與 operator event。",
      "allowed_actions": [
        "只讀仲裁嚴重度",
        "整理 message contract",
        "拒絕成功即時洗版"
      ],
      "blocked_actions": [
        "送出 Telegram / AwoooP 訊息",
        "live probe",
        "重啟或修改 endpoint"
      ]
    },
    {
      "agent_id": "hermes",
      "role": "整理每日摘要、治理頁文字與 evidence refs。",
      "allowed_actions": [
        "只讀整理證據",
        "標示摘要欄位",
        "更新 committed policy"
      ],
      "blocked_actions": [
        "發送通知",
        "讀取 secret payload",
        "改排程或 workflow"
      ]
    }
  ],
  "operation_boundaries": {
    "read_only_policy_allowed": true,
    "notification_send_allowed": false,
    "telegram_test_message_allowed": false,
    "awooop_event_write_allowed": false,
    "live_probe_allowed": false,
    "external_health_probe_allowed": false,
    "service_restart_allowed": false,
    "endpoint_change_allowed": false,
    "workflow_trigger_allowed": false,
    "runtime_execution_allowed": false,
    "secret_plaintext_allowed": false
  },
  "approval_boundaries": {
    "notification_send_approved": false,
    "telegram_test_message_approved": false,
    "awooop_event_write_approved": false,
    "live_probe_approved": false,
    "service_restart_approved": false,
    "endpoint_change_approved": false,
    "runtime_execution_approved": false
  },
  "display_redaction_contract": {
    "frontend_display_policy": "前端只顯示已提交政策證據、規則摘要與已脫敏訊息合約；不得顯示未核准內部內容、未脫敏操作紀錄或工作階段脈絡。",
    "allowed_frontend_fields": [
      "已提交證據參照",
      "政策規則摘要",
      "決策彙總",
      "通道邊界",
      "下一步",
      "阻擋操作摘要"
    ],
    "forbidden_frontend_content": [
      "未核准內部內容",
      "未脫敏操作紀錄",
      "未核准決策細節",
      "工作階段脈絡",
      "機密 / 權杖 / 授權標頭"
    ],
    "conversation_transcript_display_allowed": false,
    "redaction_required": true
  }
}
