feat(api): 新增復原演練批准包模板
All checks were successful
CD Pipeline / tests (push) Successful in 1m24s
Code Review / ai-code-review (push) Successful in 10s
CD Pipeline / build-and-deploy (push) Successful in 3m59s
CD Pipeline / post-deploy-checks (push) Successful in 2m23s

This commit is contained in:
Your Name
2026-06-05 01:20:50 +08:00
parent 2857da80b4
commit a367227d3a
12 changed files with 1609 additions and 34 deletions

View File

@@ -1,34 +1,34 @@
{
"schema_version": "ai_agent_automation_backlog_v1",
"generated_at": "2026-06-04T21:42:18+08:00",
"generated_at": "2026-06-05T05:36:00+08:00",
"source_inventory_snapshot_ref": "docs/evaluations/ai_agent_automation_inventory_snapshot_2026-06-04_static_seed.json",
"program_status": {
"overall_completion_percent": 100,
"current_priority": "P1",
"current_task_id": "P1-104",
"next_task_id": "P1-105",
"current_task_id": "P1-105",
"next_task_id": "P1-106",
"read_only_mode": true
},
"rollups": {
"total_items": 19,
"total_items": 20,
"by_priority": {
"P1": 17,
"P1": 18,
"P2": 1,
"P3": 1
},
"by_status": {
"planned": 7,
"done": 12
"done": 13
},
"by_gate_status": {
"read_only_allowed": 16,
"read_only_allowed": 17,
"production_change_blocked": 1,
"cost_approval_required": 1,
"blocked_by_evidence": 1
},
"by_owner_agent": {
"hermes": 10,
"openclaw": 8,
"openclaw": 9,
"nemotron": 1
}
},
@@ -307,6 +307,33 @@
],
"next_review": "P1-104"
},
{
"item_id": "AUTO-P1-105",
"priority": "P1",
"status": "done",
"workstream_id": "WS4",
"source_asset_id": "backup_restore_drill_approval_package_template",
"source_signal_kind": "approval_boundary",
"title": "定義復原演練批准包",
"owner_agent": "openclaw",
"recommended_action": "建立 read-only restore drill / escrow review approval package template要求 evidence、precheck、blast radius、abort、rollback、OpenClaw 仲裁與 HITL模板本身不執行 restore。",
"action_class": "backup_restore_approval_template",
"gate_status": "read_only_allowed",
"risk_level": "critical",
"evidence_refs": [
"docs/schemas/backup_restore_drill_approval_package_template_v1.schema.json",
"docs/evaluations/backup_restore_drill_approval_package_template_2026-06-05.json",
"GET /api/v1/agents/backup-restore-drill-approval-package-template"
],
"acceptance_criteria": [
"不執行 backup / restore / offsite sync",
"不寫 credential marker、不輸出 secret 明文",
"不改排程、不寫 workflow、不發 Telegram 測試通知",
"6 類批准包模板全部要求 OpenClaw 仲裁與 HITL",
"blocked / action-required 目標必須維持 blocked 或 action-required不得被 UI 解讀為 ready"
],
"next_review": "P1-105"
},
{
"item_id": "AUTO-P1-201",
"priority": "P1",

View File

@@ -1,11 +1,11 @@
{
"schema_version": "ai_agent_automation_inventory_snapshot_v1",
"generated_at": "2026-06-04T21:42:18+08:00",
"generated_at": "2026-06-05T05:36:00+08:00",
"program_status": {
"overall_completion_percent": 100,
"current_priority": "P1",
"current_task_id": "P1-104",
"next_task_id": "P1-105",
"current_task_id": "P1-105",
"next_task_id": "P1-106",
"read_only_mode": true
},
"status_taxonomy": {
@@ -423,9 +423,9 @@
{
"workstream_id": "WS4",
"display_name": "備份與 DR 自動化",
"completion_percent": 67,
"completion_percent": 83,
"status": "in_progress",
"next_task_id": "P1-105"
"next_task_id": "P1-106"
},
{
"workstream_id": "WS5",
@@ -631,7 +631,18 @@
"title": "在 AwoooP / governance UI 加備份證據",
"output": "/zh-TW/governance?tab=automation-inventory",
"gate_status": "read_only_allowed",
"next_action": "完成P1-105 定義復原演練批准包。"
"next_action": "完成P1-105 復原演練批准包模板已推進。"
},
{
"task_id": "P1-105",
"priority": "P1",
"status": "done",
"completion_percent": 100,
"owner_agent": "openclaw",
"title": "定義復原演練批准包",
"output": "docs/evaluations/backup_restore_drill_approval_package_template_2026-06-05.json",
"gate_status": "read_only_allowed",
"next_action": "完成P1-106 顯示異地 / escrow 準備度狀態。"
},
{
"task_id": "P1-201",
@@ -827,6 +838,24 @@
"ref": "/zh-TW/governance?tab=automation-inventory",
"result": "P1-104 Backup / DR 證據 UI 已接入 automation inventory tab本地 desktop 與 390px mobile 驗證 Backup / DR 證據、準備度矩陣、通知政策、成功抑制、即時升級、Gitea 與 SignOz disruptive guard 可見無載入錯誤horizontalOverflow <= 0。"
},
{
"evidence_id": "backup_restore_drill_approval_package_template_schema",
"kind": "schema",
"ref": "docs/schemas/backup_restore_drill_approval_package_template_v1.schema.json",
"result": "Backup / DR 復原演練批准包 schema 已建立,明確禁止 backup execution、restore execution、offsite sync、credential marker 寫入、workflow 寫入、Telegram 測試通知、secret 明文與生產路由變更。"
},
{
"evidence_id": "backup_restore_drill_approval_package_template_snapshot",
"kind": "doc",
"ref": "docs/evaluations/backup_restore_drill_approval_package_template_2026-06-05.json",
"result": "復原演練批准包模板快照已建立,涵蓋 database restore、configuration restore、credential escrow、K8s resource restore、observability restore 與 public route reconstruction 6 類模板;全部要求 OpenClaw 仲裁與 HITL。"
},
{
"evidence_id": "backup_restore_drill_approval_package_template_api",
"kind": "api",
"ref": "GET /api/v1/agents/backup-restore-drill-approval-package-template",
"result": "復原演練批准包模板只讀 API 已新增,只回傳 committed template不執行 backup、restore、offsite sync、不寫 credential marker、不送 Telegram 測試通知、不改生產路由。"
},
{
"evidence_id": "package_supply_chain_inventory_schema",
"kind": "schema",

View File

@@ -0,0 +1,510 @@
{
"schema_version": "backup_restore_drill_approval_package_template_v1",
"generated_at": "2026-06-05T05:36:00+08:00",
"source_refs": [
"docs/evaluations/backup_dr_target_inventory_2026-06-04.json",
"docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json",
"docs/evaluations/backup_notification_policy_2026-06-04.json",
"docs/ai/AI_AGENT_AUTOMATION_WORKLIST_2026-06-04.md",
"docs/HARD_RULES.md"
],
"program_status": {
"overall_completion_percent": 100,
"current_priority": "P1",
"current_task_id": "P1-105",
"next_task_id": "P1-106",
"read_only_mode": true
},
"rollups": {
"total_templates": 6,
"by_domain": {
"database_restore": 1,
"configuration_restore": 1,
"credential_escrow": 1,
"k8s_resource_restore": 1,
"observability_restore": 1,
"route_reconstruction": 1
},
"template_ready_ids": [
"database_restore_drill_approval_package",
"configuration_restore_approval_package",
"credential_escrow_review_package",
"velero_k8s_restore_drill_package",
"observability_restore_drill_package",
"public_route_reconstruction_package"
],
"hitl_required_template_ids": [
"database_restore_drill_approval_package",
"configuration_restore_approval_package",
"credential_escrow_review_package",
"velero_k8s_restore_drill_package",
"observability_restore_drill_package",
"public_route_reconstruction_package"
],
"blocked_source_target_ids": [
"configs_capture",
"credential_escrow_markers"
],
"action_required_source_target_ids": [
"signoz",
"velero_k8s_resources"
]
},
"approval_fields": [
{
"field_id": "operator_and_window",
"required": true,
"description": "列出人工 operator、維護窗口、時區、通訊負責人與批准到期時間。"
},
{
"field_id": "source_backup_ref",
"required": true,
"description": "列出備份來源、快照 ID、freshness、integrity 與 offsite 狀態;不得輸出 secret 或 credential 明文。"
},
{
"field_id": "target_environment",
"required": true,
"description": "列出演練目標環境、隔離邊界、資料遮罩策略與不得碰觸的 production surface。"
},
{
"field_id": "blast_radius",
"required": true,
"description": "列出受影響服務、資料、路由、通知、監控與回滾責任。"
},
{
"field_id": "precheck_evidence",
"required": true,
"description": "列出 backup freshness、integrity、offsite、credential escrow、restore dry-run plan 與 observer readiness。"
},
{
"field_id": "abort_and_rollback",
"required": true,
"description": "列出演練中止條件、回復步驟、驗證指標與復原後觀察期。"
},
{
"field_id": "post_verification",
"required": true,
"description": "列出復原後 smoke、資料一致性、告警靜音恢復、Run / LOGBOOK / evidence 更新。"
},
{
"field_id": "manual_approval",
"required": true,
"description": "列出 OpenClaw 仲裁、HITL、資料 owner、credential owner 與必要的維護窗口批准。"
}
],
"package_templates": [
{
"template_id": "database_restore_drill_approval_package",
"domain": "database_restore",
"status": "template_ready",
"owner_agent": "openclaw",
"purpose": "為 Gitea、AWOOOI PostgreSQL、momo PostgreSQL 與 Langfuse 類資料庫建立 restore drill 批准包,不執行 restore。",
"source_target_statuses": [
{
"target_id": "gitea",
"readiness": "ready"
},
{
"target_id": "awoooi_postgresql_daily",
"readiness": "ready"
},
{
"target_id": "momo_postgresql",
"readiness": "ready"
},
{
"target_id": "langfuse_postgresql",
"readiness": "ready"
}
],
"required_evidence": [
"docs/evaluations/backup_dr_target_inventory_2026-06-04.json",
"docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json",
"scripts/backup/backup-gitea.sh",
"scripts/backup/backup-momo-188-pg.sh"
],
"required_decisions": [
"是否允許在隔離環境執行資料庫 restore drill",
"是否需要遮罩資料或改用 sanitized backup",
"是否需要資料 owner 與維護窗口共同批准"
],
"required_prechecks": [
"確認 backup freshness 與 integrity evidence 未過期",
"確認 restore 目標環境與 production database 完全隔離",
"確認通知政策仍為 failure/action-required escalation"
],
"required_tests": [
"restore plan schema validation",
"post-restore smoke checklist",
"data consistency checklist",
"rollback evidence checklist"
],
"rollback_requirements": [
"列出刪除隔離演練環境與保留 evidence 的步驟",
"列出生產環境未受影響的 verification evidence"
],
"abort_criteria": [
"backup freshness 或 integrity 失效",
"目標環境指向 production",
"operator 無法確認資料遮罩或隔離邊界"
],
"manual_approvals": [
"OpenClaw arbitration",
"database owner review",
"HITL approval"
],
"prohibited_without_approval": [
"database restore",
"production connection string use",
"credential plaintext export",
"backup execution",
"schedule change"
],
"evidence_refs": [
"docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json",
"docs/evaluations/backup_notification_policy_2026-06-04.json"
]
},
{
"template_id": "configuration_restore_approval_package",
"domain": "configuration_restore",
"status": "template_ready",
"owner_agent": "hermes",
"purpose": "為設定、公開路由與 config capture 缺口建立 restore 批准包configs_capture blocked 時只能提交修復批准,不可演練 restore。",
"source_target_statuses": [
{
"target_id": "configs_capture",
"readiness": "blocked"
},
{
"target_id": "public_routes",
"readiness": "ready"
}
],
"required_evidence": [
"docs/evaluations/backup_dr_target_inventory_2026-06-04.json",
"scripts/backup/backup-public-routes.sh",
"docs/runbooks/OFFSITE-BACKUP-ESCROW-RUNBOOK.md"
],
"required_decisions": [
"configs_capture blocked 是否先轉成修復批准包",
"公開路由重建是否只允許在 staging 或隔離環境驗證",
"設定來源權威與 owner 是否已確認"
],
"required_prechecks": [
"確認 config snapshot 不含 secret 明文",
"確認路由重建計畫不改 production ingress 或 DNS",
"確認 blocked target 不被標為可 restore"
],
"required_tests": [
"config diff review",
"route reconstruction dry plan review",
"secret redaction checklist"
],
"rollback_requirements": [
"列出 config restore revert patch",
"列出 route backup 與現況比對方式"
],
"abort_criteria": [
"config evidence 含 secret 明文",
"source authority 未確認",
"restore target 需要 production 寫入"
],
"manual_approvals": [
"OpenClaw arbitration",
"configuration owner review",
"HITL approval"
],
"prohibited_without_approval": [
"config write",
"workflow write",
"production ingress change",
"DNS change",
"secret plaintext output"
],
"evidence_refs": [
"docs/evaluations/backup_dr_target_inventory_2026-06-04.json"
]
},
{
"template_id": "credential_escrow_review_package",
"domain": "credential_escrow",
"status": "template_ready",
"owner_agent": "openclaw",
"purpose": "為 credential escrow marker blocked 狀態建立人工 review 批准包;模板不寫 marker、不讀 secret、不輸出 credential。",
"source_target_statuses": [
{
"target_id": "credential_escrow_markers",
"readiness": "blocked"
}
],
"required_evidence": [
"docs/evaluations/backup_dr_target_inventory_2026-06-04.json",
"docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json",
"docs/runbooks/OFFSITE-BACKUP-ESCROW-RUNBOOK.md"
],
"required_decisions": [
"credential owner 是否確認 escrow marker 來源與保管流程",
"是否允許建立或更新 redacted marker",
"是否需要安全負責人與資料 owner 共同批准"
],
"required_prechecks": [
"確認批准包不得含 token、private key、cookie、authorization header 或 runner token",
"確認 marker 更新若被批准也必須走獨立執行流程",
"確認 blocked 狀態不被 UI 或 API 解讀為 ready"
],
"required_tests": [
"secret redaction checklist",
"escrow owner checklist",
"approval payload schema validation"
],
"rollback_requirements": [
"列出 marker 變更若被批准後的 audit trail 與 revert plan",
"列出 marker 缺失時的人工 break-glass 聯絡方式"
],
"abort_criteria": [
"批准包含 credential 明文",
"credential owner 未確認",
"嘗試由 Agent 自動寫 marker"
],
"manual_approvals": [
"OpenClaw arbitration",
"credential owner review",
"security owner review",
"HITL approval"
],
"prohibited_without_approval": [
"credential marker write",
"secret read",
"secret plaintext export",
"break-glass activation",
"Telegram test notification"
],
"evidence_refs": [
"docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json",
"docs/HARD_RULES.md"
]
},
{
"template_id": "velero_k8s_restore_drill_package",
"domain": "k8s_resource_restore",
"status": "template_ready",
"owner_agent": "openclaw",
"purpose": "為 Velero / K8s resource restore drill 建立批准包velero_k8s_resources 仍為 action_required 時只能提交補證據與演練計畫。",
"source_target_statuses": [
{
"target_id": "velero_k8s_resources",
"readiness": "action_required"
},
{
"target_id": "harbor_registry",
"readiness": "ready"
}
],
"required_evidence": [
"docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json",
"k8s/awoooi-prod/",
"docs/runbooks/OFFSITE-BACKUP-ESCROW-RUNBOOK.md"
],
"required_decisions": [
"是否允許在非 production namespace 執行 K8s resource restore drill",
"是否需要先補 Velero backup evidence",
"是否允許 Harbor registry backup 作為 image restore 證據"
],
"required_prechecks": [
"確認 namespace、service account、ingress 與 secret 不會指向 production",
"確認 restore dry plan 只用隔離資源",
"確認 action_required target 補 evidence 後才可升級"
],
"required_tests": [
"kubectl dry plan review",
"namespace isolation checklist",
"post-restore workload health checklist"
],
"rollback_requirements": [
"列出刪除演練 namespace 與資源的步驟",
"列出不影響 production service / ingress 的驗證"
],
"abort_criteria": [
"restore plan 指向 production namespace",
"manifest 包含未遮罩 secret",
"Velero evidence 仍為 action_required 且未被人工接受"
],
"manual_approvals": [
"OpenClaw arbitration",
"platform owner review",
"HITL approval"
],
"prohibited_without_approval": [
"kubectl apply",
"velero restore",
"namespace mutation",
"secret restore",
"production routing change"
],
"evidence_refs": [
"docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json"
]
},
{
"template_id": "observability_restore_drill_package",
"domain": "observability_restore",
"status": "template_ready",
"owner_agent": "hermes",
"purpose": "為 SigNoz / ClickHouse、Prometheus 與 Alertmanager 可觀測性 restore drill 建立批准包SignOz disruptive guard 必須保留。",
"source_target_statuses": [
{
"target_id": "signoz",
"readiness": "action_required"
},
{
"target_id": "prometheus_alertmanager",
"readiness": "ready"
}
],
"required_evidence": [
"docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json",
"docs/evaluations/backup_notification_policy_2026-06-04.json",
"ops/monitoring/",
"k8s/monitoring/"
],
"required_decisions": [
"是否允許 disruptive backup guard 覆蓋的服務進入演練",
"restore drill 是否需要暫時調整告警靜音與通知策略",
"Prometheus / Alertmanager evidence 是否足以支持復原驗證"
],
"required_prechecks": [
"確認 SignOz disruptive guard 已被 operator 看見並接受",
"確認成功訊息不即時洗版",
"確認 failure / action-required 仍會升級"
],
"required_tests": [
"metrics readback checklist",
"alert route readback checklist",
"notification suppression checklist"
],
"rollback_requirements": [
"列出恢復原告警靜音與通知政策的步驟",
"列出演練後 metrics / alert route readback"
],
"abort_criteria": [
"演練需要停止 production collector 且未批准",
"通知政策會發送成功洗版訊息",
"observer 無法驗證 restore 結果"
],
"manual_approvals": [
"OpenClaw arbitration",
"observability owner review",
"HITL approval"
],
"prohibited_without_approval": [
"collector stop",
"ClickHouse restore",
"Alertmanager route write",
"Telegram test notification",
"schedule change"
],
"evidence_refs": [
"docs/evaluations/backup_notification_policy_2026-06-04.json"
]
},
{
"template_id": "public_route_reconstruction_package",
"domain": "route_reconstruction",
"status": "template_ready",
"owner_agent": "openclaw",
"purpose": "為公開路由、Ingress、Nginx 備份與 DNS 重建建立批准包;模板不改生產路由。",
"source_target_statuses": [
{
"target_id": "public_routes",
"readiness": "ready"
}
],
"required_evidence": [
"scripts/backup/backup-public-routes.sh",
"docs/evaluations/backup_dr_target_inventory_2026-06-04.json",
"docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json"
],
"required_decisions": [
"是否允許在 staging 或 isolated host 重建公開路由",
"是否需要 DNS / TLS / ingress owner review",
"是否需要 production traffic freeze window"
],
"required_prechecks": [
"確認重建目標不接 production traffic",
"確認 TLS / DNS evidence 不含 private key",
"確認回滾與 readback 指標已列出"
],
"required_tests": [
"route diff review",
"TLS public certificate readback checklist",
"HTTP smoke checklist",
"production no-change checklist"
],
"rollback_requirements": [
"列出路由設定 revert patch",
"列出 DNS / ingress / Nginx readback 與保留 evidence"
],
"abort_criteria": [
"計畫會改 production route",
"TLS private key 或 secret 明文進入批准包",
"缺少可驗證回滾點"
],
"manual_approvals": [
"OpenClaw arbitration",
"route owner review",
"HITL approval"
],
"prohibited_without_approval": [
"production routing change",
"DNS change",
"TLS private key export",
"Nginx config write",
"workflow write"
],
"evidence_refs": [
"docs/evaluations/backup_dr_target_inventory_2026-06-04.json"
]
}
],
"decision_gate_contract": {
"openclaw_role": "仲裁 restore drill、escrow review、route reconstruction 與 action-required target 是否可進下一關。",
"hermes_role": "彙整 runbook、evidence、operator checklist、LOGBOOK 與批准包文字。",
"nemotron_role": "只可離線檢查 sanitized 演練計畫完整性,不得接觸 production、secret、shadow/canary 或執行權。",
"hitl_required": true,
"expires_after": "7 days or any source backup/readiness snapshot change",
"invalidated_by": [
"backup freshness evidence expired",
"readiness matrix changed",
"credential escrow blocker changed",
"production topology changed",
"manual approval window expired"
]
},
"operation_boundaries": {
"read_only_template_allowed": true,
"backup_execution_allowed": false,
"restore_execution_allowed": false,
"offsite_sync_execution_allowed": false,
"credential_marker_write_allowed": false,
"schedule_change_allowed": false,
"workflow_write_allowed": false,
"telegram_test_notification_allowed": false,
"destructive_prune_allowed": false,
"secret_plaintext_allowed": false,
"production_routing_allowed": false,
"sdk_installation_allowed": false,
"paid_api_call_allowed": false,
"shadow_or_canary_allowed": false
},
"approval_boundaries": {
"sdk_installation_allowed": false,
"paid_api_call_allowed": false,
"shadow_or_canary_allowed": false,
"production_routing_allowed": false,
"destructive_operation_allowed": false,
"restore_execution_allowed": false,
"offsite_sync_execution_allowed": false,
"credential_marker_write_allowed": false
}
}