diff --git a/apps/api/src/api/v1/agents.py b/apps/api/src/api/v1/agents.py index cc9d6683a..b477cf9ed 100644 --- a/apps/api/src/api/v1/agents.py +++ b/apps/api/src/api/v1/agents.py @@ -88,6 +88,9 @@ from src.services.ai_agent_redis_dry_run_gate import ( from src.services.ai_agent_report_automation_review import ( load_latest_ai_agent_report_automation_review, ) +from src.services.ai_agent_report_runtime_readiness import ( + load_latest_ai_agent_report_runtime_readiness, +) from src.services.ai_agent_report_truth_actionability_review import ( load_latest_ai_agent_report_truth_actionability_review, ) @@ -911,6 +914,34 @@ async def get_agent_report_automation_review() -> dict[str, Any]: ) from exc +@router.get( + "/agent-report-runtime-readiness", + response_model=dict[str, Any], + summary="取得 AI Agent 報表 runtime 啟動前閘門", + description=( + "讀取最新已提交的 P2-403L 日週月報派送、Telegram Gateway queue、讀報回執、" + "AI 讀報後分析、中低風險自動處理、高風險審核與 post-action verifier 啟動前閘門;" + "此端點不排程實發、不送 Telegram、不寫 Gateway queue、不啟動 AI runtime worker、" + "不啟動中低風險 auto worker、不執行生產優化、不讀 secret、不回傳內部對話內容。" + ), +) +async def get_agent_report_runtime_readiness() -> dict[str, Any]: + """Return the latest read-only AI Agent report runtime readiness gate.""" + try: + return await asyncio.to_thread(load_latest_ai_agent_report_runtime_readiness) + except FileNotFoundError as exc: + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, + detail=str(exc), + ) from exc + except (json.JSONDecodeError, ValueError) as exc: + logger.error("ai_agent_report_runtime_readiness_invalid", error=str(exc)) + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail="AI Agent 報表 runtime 啟動前閘門無效", + ) from exc + + @router.get( "/agent-owner-approved-fixture-dry-run", response_model=dict[str, Any], diff --git a/apps/api/src/services/ai_agent_report_runtime_readiness.py b/apps/api/src/services/ai_agent_report_runtime_readiness.py new file mode 100644 index 000000000..46e7df3fc --- /dev/null +++ b/apps/api/src/services/ai_agent_report_runtime_readiness.py @@ -0,0 +1,199 @@ +""" +AI Agent report runtime readiness snapshot. + +Loads the latest committed P2-403L report delivery, Telegram receipt, AI +analysis, and medium / low risk automation readiness gate. This module does +not schedule reports, write Telegram Gateway queues, start AI workers, or +optimize production. +""" + +from __future__ import annotations + +import json +from pathlib import Path +from typing import Any + +from src.services.snapshot_paths import default_evaluations_dir + +_DEFAULT_EVALUATIONS_DIR = default_evaluations_dir(Path(__file__)) +_SNAPSHOT_PATTERN = "ai_agent_report_runtime_readiness_*.json" +_SCHEMA_VERSION = "ai_agent_report_runtime_readiness_v1" +_RUNTIME_AUTHORITY = "report_runtime_readiness_only_no_live_delivery_or_optimization" + + +def load_latest_ai_agent_report_runtime_readiness( + evaluations_dir: Path | None = None, +) -> dict[str, Any]: + """Load the newest committed AI Agent report runtime readiness snapshot.""" + directory = evaluations_dir or _DEFAULT_EVALUATIONS_DIR + candidates = sorted(directory.glob(_SNAPSHOT_PATTERN)) + if not candidates: + raise FileNotFoundError(f"no AI Agent report runtime readiness snapshots found in {directory}") + + latest = candidates[-1] + with latest.open(encoding="utf-8") as handle: + payload = json.load(handle) + + if not isinstance(payload, dict): + raise ValueError(f"{latest}: expected JSON object") + _require_schema(payload, str(latest)) + _require_activation_boundaries(payload, str(latest)) + _require_lane_contract(payload, str(latest)) + _require_policy_contract(payload, str(latest)) + _require_telegram_contract(payload, str(latest)) + _require_rollup_consistency(payload, str(latest)) + return payload + + +def _require_schema(payload: dict[str, Any], label: str) -> None: + if payload.get("schema_version") != _SCHEMA_VERSION: + raise ValueError(f"{label}: expected schema_version={_SCHEMA_VERSION}") + status = payload.get("program_status") or {} + if status.get("read_only_mode") is not True: + raise ValueError(f"{label}: program_status.read_only_mode must be true") + if status.get("runtime_authority") != _RUNTIME_AUTHORITY: + raise ValueError(f"{label}: runtime_authority must remain {_RUNTIME_AUTHORITY}") + if status.get("current_task_id") != "P2-403L": + raise ValueError(f"{label}: current_task_id must be P2-403L") + + +def _require_activation_boundaries(payload: dict[str, Any], label: str) -> None: + truth = payload.get("activation_truth") or {} + ready_flags = { + "report_scheduler_contract_ready", + "telegram_gateway_queue_contract_ready", + "telegram_delivery_receipt_contract_ready", + "ai_readback_analysis_contract_ready", + "medium_low_auto_guard_contract_ready", + "high_risk_approval_gate_contract_ready", + } + missing_ready = sorted(flag for flag in ready_flags if truth.get(flag) is not True) + if missing_ready: + raise ValueError(f"{label}: readiness contract flags must remain true: {missing_ready}") + + false_flags = { + "live_report_delivery_enabled", + "telegram_gateway_queue_write_enabled", + "report_read_receipt_write_enabled", + "ai_analysis_runtime_enabled", + "medium_low_auto_worker_enabled", + "production_optimization_enabled", + "high_risk_auto_execution_enabled", + } + unsafe_flags = sorted(flag for flag in false_flags if truth.get(flag) is not False) + if unsafe_flags: + raise ValueError(f"{label}: live runtime flags must remain false: {unsafe_flags}") + + zero_counts = { + "live_report_delivery_count_24h", + "telegram_gateway_queue_write_count_24h", + "report_read_receipt_count_24h", + "ai_analysis_runtime_count_24h", + "medium_low_auto_execution_count_24h", + "production_optimization_count_24h", + "high_risk_auto_execution_count_24h", + } + non_zero = sorted(key for key in zero_counts if truth.get(key) != 0) + if non_zero: + raise ValueError(f"{label}: live report runtime counts must remain zero: {non_zero}") + + +def _require_lane_contract(payload: dict[str, Any], label: str) -> None: + lanes = payload.get("runtime_lanes") or [] + lane_ids = {lane.get("lane_id") for lane in lanes} + required_lanes = { + "report_scheduler", + "telegram_gateway_queue", + "telegram_delivery_receipt", + "ai_post_report_analysis", + "medium_low_auto_guard", + "high_risk_approval", + "post_action_verifier", + } + if lane_ids != required_lanes: + raise ValueError(f"{label}: runtime lanes must match {sorted(required_lanes)}") + + agents = {lane.get("owner_agent") for lane in lanes} + if not {"openclaw", "hermes", "nemotron"}.issubset(agents): + raise ValueError(f"{label}: runtime lanes must include OpenClaw, Hermes, and NemoTron ownership") + + live_lanes = sorted(lane.get("lane_id") for lane in lanes if lane.get("current_live_count_24h") != 0) + if live_lanes: + raise ValueError(f"{label}: lane live counts must remain zero: {live_lanes}") + + +def _require_policy_contract(payload: dict[str, Any], label: str) -> None: + policies = payload.get("automation_policies") or [] + policy_ids = {policy.get("risk_id") for policy in policies} + if policy_ids != {"low", "medium", "high", "critical"}: + raise ValueError(f"{label}: automation policies must include low, medium, high, critical") + + for policy in policies: + risk_id = policy.get("risk_id") + if policy.get("current_execution_enabled") is not False: + raise ValueError(f"{label}: policy {risk_id} current_execution_enabled must remain false") + if risk_id in {"high", "critical"}: + if policy.get("approval_required") is not True: + raise ValueError(f"{label}: policy {risk_id} must require approval") + if policy.get("auto_allowed_after_guard") is not False: + raise ValueError(f"{label}: policy {risk_id} cannot be auto allowed") + if risk_id in {"low", "medium"} and policy.get("auto_allowed_after_guard") is not True: + raise ValueError(f"{label}: policy {risk_id} must be auto allowed only after guard") + + +def _require_telegram_contract(payload: dict[str, Any], label: str) -> None: + route = payload.get("telegram_route_readiness") or {} + if route.get("canonical_room") != "AwoooI SRE 戰情室": + raise ValueError(f"{label}: canonical Telegram room must remain AwoooI SRE 戰情室") + if route.get("gateway_required") is not True: + raise ValueError(f"{label}: Telegram Gateway must be required") + + false_fields = { + "direct_bot_api_allowed", + "bot_log_out_allowed", + "telegram_gateway_queue_write_enabled", + "e2e_delivery_verified", + "delivery_receipt_write_enabled", + } + unsafe = sorted(field for field in false_fields if route.get(field) is not False) + if unsafe: + raise ValueError(f"{label}: Telegram live route fields must remain false: {unsafe}") + + +def _require_rollup_consistency(payload: dict[str, Any], label: str) -> None: + rollups = payload.get("rollups") or {} + lanes = payload.get("runtime_lanes") or [] + cadences = payload.get("report_delivery_cadence_gates") or [] + decisions = payload.get("operator_decisions") or [] + policies = payload.get("automation_policies") or [] + truth = payload.get("activation_truth") or {} + + expected = { + "runtime_lane_count": len(lanes), + "report_cadence_gate_count": len(cadences), + "operator_decision_count": len(decisions), + "automation_policy_count": len(policies), + "ready_contract_count": len([lane for lane in lanes if lane.get("contract_status") == "ready_for_owner_review"]), + "blocked_contract_count": len([lane for lane in lanes if lane.get("contract_status") == "blocked_by_runtime_gate"]), + "current_enabled_count": 0, + "live_report_delivery_count": truth.get("live_report_delivery_count_24h"), + "live_ai_analysis_count": truth.get("ai_analysis_runtime_count_24h"), + "live_medium_low_auto_execution_count": truth.get("medium_low_auto_execution_count_24h"), + "telegram_gateway_queue_write_count": truth.get("telegram_gateway_queue_write_count_24h"), + "high_risk_auto_execution_count": truth.get("high_risk_auto_execution_count_24h"), + } + mismatched = { + key: {"expected": value, "actual": rollups.get(key)} + for key, value in expected.items() + if rollups.get(key) != value + } + if mismatched: + raise ValueError(f"{label}: rollup counts must match payload sections: {mismatched}") + + approval_required = sorted( + decision.get("decision_id") + for decision in decisions + if decision.get("approval_required") is True + ) + if sorted(rollups.get("approval_required_decision_ids") or []) != approval_required: + raise ValueError(f"{label}: approval_required_decision_ids mismatch") diff --git a/apps/api/tests/test_ai_agent_report_runtime_readiness.py b/apps/api/tests/test_ai_agent_report_runtime_readiness.py new file mode 100644 index 000000000..0a1e2f542 --- /dev/null +++ b/apps/api/tests/test_ai_agent_report_runtime_readiness.py @@ -0,0 +1,107 @@ +import copy +import json + +import pytest + +from src.services.ai_agent_report_runtime_readiness import ( + load_latest_ai_agent_report_runtime_readiness, +) + + +def _write_snapshot(tmp_path, payload): + path = tmp_path / "ai_agent_report_runtime_readiness_2026-06-12.json" + path.write_text(json.dumps(payload), encoding="utf-8") + return path + + +def test_load_latest_ai_agent_report_runtime_readiness(): + data = load_latest_ai_agent_report_runtime_readiness() + + assert data["schema_version"] == "ai_agent_report_runtime_readiness_v1" + assert data["program_status"]["current_task_id"] == "P2-403L" + assert data["program_status"]["next_task_id"] == "P2-403M" + assert data["program_status"]["overall_completion_percent"] == 86 + assert data["activation_truth"]["report_scheduler_contract_ready"] is True + assert data["activation_truth"]["telegram_gateway_queue_contract_ready"] is True + assert data["activation_truth"]["ai_readback_analysis_contract_ready"] is True + assert data["activation_truth"]["medium_low_auto_guard_contract_ready"] is True + assert data["activation_truth"]["live_report_delivery_enabled"] is False + assert data["activation_truth"]["telegram_gateway_queue_write_enabled"] is False + assert data["activation_truth"]["medium_low_auto_worker_enabled"] is False + assert data["activation_truth"]["production_optimization_count_24h"] == 0 + assert data["telegram_route_readiness"]["canonical_room"] == "AwoooI SRE 戰情室" + assert data["telegram_route_readiness"]["direct_bot_api_allowed"] is False + assert data["telegram_route_readiness"]["bot_log_out_allowed"] is False + assert data["rollups"]["runtime_lane_count"] == 7 + assert data["rollups"]["report_cadence_gate_count"] == 3 + assert data["rollups"]["operator_decision_count"] == 7 + assert data["rollups"]["automation_policy_count"] == 4 + assert data["rollups"]["current_enabled_count"] == 0 + assert data["rollups"]["live_report_delivery_count"] == 0 + assert data["rollups"]["telegram_gateway_queue_write_count"] == 0 + assert data["rollups"]["live_medium_low_auto_execution_count"] == 0 + + +def test_rejects_live_report_delivery_enabled(tmp_path): + data = load_latest_ai_agent_report_runtime_readiness() + bad = copy.deepcopy(data) + bad["activation_truth"]["live_report_delivery_enabled"] = True + _write_snapshot(tmp_path, bad) + + with pytest.raises(ValueError, match="live runtime flags"): + load_latest_ai_agent_report_runtime_readiness(tmp_path) + + +def test_rejects_telegram_gateway_queue_write_count(tmp_path): + data = load_latest_ai_agent_report_runtime_readiness() + bad = copy.deepcopy(data) + bad["activation_truth"]["telegram_gateway_queue_write_count_24h"] = 1 + bad["rollups"]["telegram_gateway_queue_write_count"] = 1 + _write_snapshot(tmp_path, bad) + + with pytest.raises(ValueError, match="live report runtime counts"): + load_latest_ai_agent_report_runtime_readiness(tmp_path) + + +def test_rejects_direct_telegram_api(tmp_path): + data = load_latest_ai_agent_report_runtime_readiness() + bad = copy.deepcopy(data) + bad["telegram_route_readiness"]["direct_bot_api_allowed"] = True + _write_snapshot(tmp_path, bad) + + with pytest.raises(ValueError, match="Telegram live route fields"): + load_latest_ai_agent_report_runtime_readiness(tmp_path) + + +def test_rejects_medium_low_policy_without_guard(tmp_path): + data = load_latest_ai_agent_report_runtime_readiness() + bad = copy.deepcopy(data) + for policy in bad["automation_policies"]: + if policy["risk_id"] == "medium": + policy["auto_allowed_after_guard"] = False + _write_snapshot(tmp_path, bad) + + with pytest.raises(ValueError, match="medium"): + load_latest_ai_agent_report_runtime_readiness(tmp_path) + + +def test_rejects_high_risk_auto_allowed(tmp_path): + data = load_latest_ai_agent_report_runtime_readiness() + bad = copy.deepcopy(data) + for policy in bad["automation_policies"]: + if policy["risk_id"] == "high": + policy["auto_allowed_after_guard"] = True + _write_snapshot(tmp_path, bad) + + with pytest.raises(ValueError, match="high"): + load_latest_ai_agent_report_runtime_readiness(tmp_path) + + +def test_rejects_rollup_mismatch(tmp_path): + data = load_latest_ai_agent_report_runtime_readiness() + bad = copy.deepcopy(data) + bad["rollups"]["runtime_lane_count"] = 999 + _write_snapshot(tmp_path, bad) + + with pytest.raises(ValueError, match="rollup counts"): + load_latest_ai_agent_report_runtime_readiness(tmp_path) diff --git a/apps/api/tests/test_ai_agent_report_runtime_readiness_api.py b/apps/api/tests/test_ai_agent_report_runtime_readiness_api.py new file mode 100644 index 000000000..d473a2a6e --- /dev/null +++ b/apps/api/tests/test_ai_agent_report_runtime_readiness_api.py @@ -0,0 +1,30 @@ +from fastapi.testclient import TestClient + +from src.main import app + + +def test_get_ai_agent_report_runtime_readiness_api(): + client = TestClient(app) + response = client.get("/api/v1/agents/agent-report-runtime-readiness") + + assert response.status_code == 200 + data = response.json() + assert data["schema_version"] == "ai_agent_report_runtime_readiness_v1" + assert data["program_status"]["current_task_id"] == "P2-403L" + assert data["program_status"]["next_task_id"] == "P2-403M" + assert data["program_status"]["overall_completion_percent"] == 86 + assert data["activation_truth"]["report_scheduler_contract_ready"] is True + assert data["activation_truth"]["telegram_gateway_queue_contract_ready"] is True + assert data["activation_truth"]["live_report_delivery_enabled"] is False + assert data["activation_truth"]["telegram_gateway_queue_write_enabled"] is False + assert data["activation_truth"]["medium_low_auto_worker_enabled"] is False + assert data["activation_truth"]["production_optimization_count_24h"] == 0 + assert data["telegram_route_readiness"]["canonical_room"] == "AwoooI SRE 戰情室" + assert data["telegram_route_readiness"]["direct_bot_api_allowed"] is False + assert data["telegram_route_readiness"]["bot_log_out_allowed"] is False + assert data["rollups"]["runtime_lane_count"] == 7 + assert data["rollups"]["operator_decision_count"] == 7 + assert data["rollups"]["current_enabled_count"] == 0 + assert data["rollups"]["live_report_delivery_count"] == 0 + assert data["rollups"]["telegram_gateway_queue_write_count"] == 0 + assert data["rollups"]["live_medium_low_auto_execution_count"] == 0 diff --git a/apps/web/messages/en.json b/apps/web/messages/en.json index c2dc549f6..4aee7d65d 100644 --- a/apps/web/messages/en.json +++ b/apps/web/messages/en.json @@ -4074,6 +4074,50 @@ "high": "高風險", "critical": "關鍵阻擋" } + }, + "reportRuntimeReadiness": { + "title": "P2-403L 報表派送與自動處理啟動閘門", + "source": "{generated} · {current} → {next}", + "truthTitle": "啟動前真相", + "telegramTitle": "Telegram 戰情室路由", + "telegramSummary": "唯一正式收件目標是 {room};Secret 只能引用 {secret};目前仍有 {blocked} 類旁路需要收斂。", + "metrics": { + "overall": "P2-403L 進度", + "lanes": "runtime lanes", + "ready": "可審查", + "blocked": "阻擋中", + "approvals": "需批准", + "enabled": "已啟動", + "delivery": "實發報表", + "mediumLow": "中低風險執行" + }, + "flags": { + "scheduler": "排程契約: {value}", + "queue": "queue writes: {value}", + "aiRuns": "AI runs: {value}", + "mediumLow": "中低風險 runs: {value}", + "gateway": "Gateway required: {value}", + "directApi": "direct API: {value}", + "deliveryVerified": "E2E verified: {value}" + }, + "labels": { + "liveCount": "live {count}", + "enabled": "enabled: {value}", + "autoAfterGuard": "guard 後可自動: {value}", + "approvalRequired": "需審核: {value}" + }, + "statuses": { + "ready_for_owner_review": "可審查", + "blocked_by_runtime_gate": "runtime 阻擋", + "approval_required": "需批准", + "ready_for_review": "可檢視" + }, + "riskTiers": { + "low": "低風險", + "medium": "中風險", + "high": "高風險", + "critical": "關鍵阻擋" + } } } }, diff --git a/apps/web/messages/zh-TW.json b/apps/web/messages/zh-TW.json index c2dc549f6..4aee7d65d 100644 --- a/apps/web/messages/zh-TW.json +++ b/apps/web/messages/zh-TW.json @@ -4074,6 +4074,50 @@ "high": "高風險", "critical": "關鍵阻擋" } + }, + "reportRuntimeReadiness": { + "title": "P2-403L 報表派送與自動處理啟動閘門", + "source": "{generated} · {current} → {next}", + "truthTitle": "啟動前真相", + "telegramTitle": "Telegram 戰情室路由", + "telegramSummary": "唯一正式收件目標是 {room};Secret 只能引用 {secret};目前仍有 {blocked} 類旁路需要收斂。", + "metrics": { + "overall": "P2-403L 進度", + "lanes": "runtime lanes", + "ready": "可審查", + "blocked": "阻擋中", + "approvals": "需批准", + "enabled": "已啟動", + "delivery": "實發報表", + "mediumLow": "中低風險執行" + }, + "flags": { + "scheduler": "排程契約: {value}", + "queue": "queue writes: {value}", + "aiRuns": "AI runs: {value}", + "mediumLow": "中低風險 runs: {value}", + "gateway": "Gateway required: {value}", + "directApi": "direct API: {value}", + "deliveryVerified": "E2E verified: {value}" + }, + "labels": { + "liveCount": "live {count}", + "enabled": "enabled: {value}", + "autoAfterGuard": "guard 後可自動: {value}", + "approvalRequired": "需審核: {value}" + }, + "statuses": { + "ready_for_owner_review": "可審查", + "blocked_by_runtime_gate": "runtime 阻擋", + "approval_required": "需批准", + "ready_for_review": "可檢視" + }, + "riskTiers": { + "low": "低風險", + "medium": "中風險", + "high": "高風險", + "critical": "關鍵阻擋" + } } } }, diff --git a/apps/web/src/app/[locale]/governance/tabs/automation-inventory-tab.tsx b/apps/web/src/app/[locale]/governance/tabs/automation-inventory-tab.tsx index aa22fe418..5273a42c1 100644 --- a/apps/web/src/app/[locale]/governance/tabs/automation-inventory-tab.tsx +++ b/apps/web/src/app/[locale]/governance/tabs/automation-inventory-tab.tsx @@ -46,6 +46,7 @@ import { type AiAgentProactiveOperationsContractSnapshot, type AiAgentRedisDryRunGateSnapshot, type AiAgentReportAutomationReviewSnapshot, + type AiAgentReportRuntimeReadinessSnapshot, type AiAgentReportTruthActionabilityReviewSnapshot, type AiAgentRuntimeVerifierEvidenceReviewSnapshot, type AiAgentRuntimeWriteGateReviewSnapshot, @@ -338,6 +339,7 @@ export function AutomationInventoryTab() { const [postWriteVerifierPackage, setPostWriteVerifierPackage] = useState(null) const [runtimeVerifierEvidenceReview, setRuntimeVerifierEvidenceReview] = useState(null) const [reportAutomationReview, setReportAutomationReview] = useState(null) + const [reportRuntimeReadiness, setReportRuntimeReadiness] = useState(null) const [reportTruthActionabilityReview, setReportTruthActionabilityReview] = useState(null) const [ownerDryRunPackage, setOwnerDryRunPackage] = useState(null) const [hostStatefulInventory, setHostStatefulInventory] = useState(null) @@ -371,6 +373,7 @@ export function AutomationInventoryTab() { apiClient.getAiAgentPostWriteVerifierPackage(), apiClient.getAiAgentRuntimeVerifierEvidenceReview(), apiClient.getAiAgentReportAutomationReview(), + apiClient.getAiAgentReportRuntimeReadiness(), apiClient.getAiAgentReportTruthActionabilityReview(), apiClient.getAiAgentOwnerApprovedFixtureDryRun(), apiClient.getAiAgentHostStatefulVersionInventory(), @@ -403,6 +406,7 @@ export function AutomationInventoryTab() { postWriteVerifierPackageResult, runtimeVerifierEvidenceReviewResult, reportAutomationReviewResult, + reportRuntimeReadinessResult, reportTruthActionabilityReviewResult, ownerDryRunPackageResult, hostStatefulInventoryResult, @@ -432,6 +436,7 @@ export function AutomationInventoryTab() { setPostWriteVerifierPackage(postWriteVerifierPackageResult.status === 'fulfilled' ? postWriteVerifierPackageResult.value : null) setRuntimeVerifierEvidenceReview(runtimeVerifierEvidenceReviewResult.status === 'fulfilled' ? runtimeVerifierEvidenceReviewResult.value : null) setReportAutomationReview(reportAutomationReviewResult.status === 'fulfilled' ? reportAutomationReviewResult.value : null) + setReportRuntimeReadiness(reportRuntimeReadinessResult.status === 'fulfilled' ? reportRuntimeReadinessResult.value : null) setReportTruthActionabilityReview(reportTruthActionabilityReviewResult.status === 'fulfilled' ? reportTruthActionabilityReviewResult.value : null) setOwnerDryRunPackage(ownerDryRunPackageResult.status === 'fulfilled' ? ownerDryRunPackageResult.value : null) setHostStatefulInventory(hostStatefulInventoryResult.status === 'fulfilled' ? hostStatefulInventoryResult.value : null) @@ -459,6 +464,7 @@ export function AutomationInventoryTab() { postWriteVerifierPackageResult, runtimeVerifierEvidenceReviewResult, reportAutomationReviewResult, + reportRuntimeReadinessResult, reportTruthActionabilityReviewResult, ownerDryRunPackageResult, hostStatefulInventoryResult, @@ -864,6 +870,36 @@ export function AutomationInventoryTab() { .slice(0, 5) }, [reportAutomationReview]) + const visibleReportRuntimeLanes = useMemo(() => { + if (!reportRuntimeReadiness) return [] + const priority = { blocked_by_runtime_gate: 0, ready_for_owner_review: 1 } as Record + return [...reportRuntimeReadiness.runtime_lanes] + .sort((a, b) => { + const left = priority[a.contract_status] ?? 2 + const right = priority[b.contract_status] ?? 2 + if (left !== right) return left - right + return a.lane_id.localeCompare(b.lane_id) + }) + .slice(0, 7) + }, [reportRuntimeReadiness]) + + const visibleReportRuntimeDecisions = useMemo(() => { + if (!reportRuntimeReadiness) return [] + const statusPriority = { approval_required: 0, blocked_by_runtime_gate: 1, ready_for_review: 2 } as Record + const riskPriority = { critical: 0, high: 1, medium: 2, low: 3 } as Record + return [...reportRuntimeReadiness.operator_decisions] + .sort((a, b) => { + const left = statusPriority[a.status] ?? 3 + const right = statusPriority[b.status] ?? 3 + if (left !== right) return left - right + const leftRisk = riskPriority[a.risk_tier] ?? 4 + const rightRisk = riskPriority[b.risk_tier] ?? 4 + if (leftRisk !== rightRisk) return leftRisk - rightRisk + return a.decision_id.localeCompare(b.decision_id) + }) + .slice(0, 7) + }, [reportRuntimeReadiness]) + const visibleReportTruthFindings = useMemo(() => { if (!reportTruthActionabilityReview) return [] const priority = { critical: 0, high: 1, medium: 2, low: 3 } as Record @@ -1083,7 +1119,7 @@ export function AutomationInventoryTab() { ) } - if (error || !snapshot || !backlog || !backupTargets || !backupReadiness || !backupPolicy || !offsiteEscrow || !giteaHealth || !observabilityMatrix || !providerRouteMatrix || !deploymentLayout || !proactiveOperations || !interactionLearningProof || !liveReadModelGate || !redisDryRunGate || !learningWritebackPackage || !telegramReceiptPackage || !ownerApprovedLearningDryRun || !runtimeWriteGateReview || !postWriteVerifierPackage || !runtimeVerifierEvidenceReview || !reportAutomationReview || !reportTruthActionabilityReview || !ownerDryRunPackage || !hostStatefulInventory || !serviceHealthGapMatrix || !serviceHealthNotificationPolicy) { + if (error || !snapshot || !backlog || !backupTargets || !backupReadiness || !backupPolicy || !offsiteEscrow || !giteaHealth || !observabilityMatrix || !providerRouteMatrix || !deploymentLayout || !proactiveOperations || !interactionLearningProof || !liveReadModelGate || !redisDryRunGate || !learningWritebackPackage || !telegramReceiptPackage || !ownerApprovedLearningDryRun || !runtimeWriteGateReview || !postWriteVerifierPackage || !runtimeVerifierEvidenceReview || !reportAutomationReview || !reportRuntimeReadiness || !reportTruthActionabilityReview || !ownerDryRunPackage || !hostStatefulInventory || !serviceHealthGapMatrix || !serviceHealthNotificationPolicy) { return (
@@ -1232,6 +1268,16 @@ export function AutomationInventoryTab() { const reportAutoEnabled = reportAutomationReview.rollups.current_auto_execution_enabled_count const reportLiveDelivery = reportAutomationReview.rollups.live_report_delivery_count const reportLiveOptimization = reportAutomationReview.rollups.live_auto_optimization_count + const reportRuntimeOverall = reportRuntimeReadiness.program_status.overall_completion_percent + const reportRuntimeLanes = reportRuntimeReadiness.rollups.runtime_lane_count + const reportRuntimeReady = reportRuntimeReadiness.rollups.ready_contract_count + const reportRuntimeBlocked = reportRuntimeReadiness.rollups.blocked_contract_count + const reportRuntimeApprovals = reportRuntimeReadiness.rollups.approval_required_decision_ids.length + const reportRuntimeEnabled = reportRuntimeReadiness.rollups.current_enabled_count + const reportRuntimeLiveDelivery = reportRuntimeReadiness.rollups.live_report_delivery_count + const reportRuntimeQueueWrites = reportRuntimeReadiness.rollups.telegram_gateway_queue_write_count + const reportRuntimeAiRuns = reportRuntimeReadiness.rollups.live_ai_analysis_count + const reportRuntimeMediumLowRuns = reportRuntimeReadiness.rollups.live_medium_low_auto_execution_count const reportTruthOverall = reportTruthActionabilityReview.program_status.overall_completion_percent const reportTruthFindings = reportTruthActionabilityReview.rollups.zero_signal_finding_count const reportTruthCritical = reportTruthActionabilityReview.rollups.critical_finding_count @@ -1997,6 +2043,132 @@ export function AutomationInventoryTab() {
+
+
+
+ + + {t('reportRuntimeReadiness.title')} + +
+ +
+ +
+ } /> + } /> + } /> + 0 ? 'danger' : 'ok'} icon={} /> + 0 ? 'danger' : 'ok'} icon={} /> + } /> + } /> + } /> +
+ +
+
+ {t('reportRuntimeReadiness.truthTitle')} + + {reportRuntimeReadiness.activation_truth.truth_note} + +
+ + + + +
+
+ +
+ {t('reportRuntimeReadiness.telegramTitle')} + + {t('reportRuntimeReadiness.telegramSummary', { + room: reportRuntimeReadiness.telegram_route_readiness.canonical_room, + secret: reportRuntimeReadiness.telegram_route_readiness.secret_ref, + blocked: reportRuntimeReadiness.telegram_route_readiness.blocked_route_count, + })} + +
+ + + +
+
+
+ +
+ {visibleReportRuntimeLanes.map(lane => { + const tone = lane.contract_status === 'blocked_by_runtime_gate' ? 'danger' : lane.risk_tier === 'high' || lane.risk_tier === 'critical' ? 'warn' : 'ok' + return ( +
+
+ + {lane.display_name} + + +
+
+ + + +
+ + {lane.enablement_required.slice(0, 2).join(' / ')} + + +
+ ) + })} +
+ +
+ {reportRuntimeReadiness.automation_policies.map(policy => ( +
+
+ + {policy.display_name} + + +
+
+ + +
+ + {policy.reporting_rule} + +
+ ))} +
+ +
+ {visibleReportRuntimeDecisions.map(decision => ( +
+
+ + {decision.display_name} + + +
+
+ + +
+ + {decision.next_safe_step} + +
+ ))} +
+
+
diff --git a/apps/web/src/lib/api-client.ts b/apps/web/src/lib/api-client.ts index 37471df96..e9cd3a7b4 100644 --- a/apps/web/src/lib/api-client.ts +++ b/apps/web/src/lib/api-client.ts @@ -327,6 +327,11 @@ export const apiClient = { return handleResponse(res) }, + async getAiAgentReportRuntimeReadiness() { + const res = await fetch(`${API_BASE_URL}/agents/agent-report-runtime-readiness`) + return handleResponse(res) + }, + async getAiAgentOwnerApprovedFixtureDryRun() { const res = await fetch(`${API_BASE_URL}/agents/agent-owner-approved-fixture-dry-run`) return handleResponse(res) @@ -2074,6 +2079,128 @@ export interface AiAgentReportAutomationReviewSnapshot { } } +export interface AiAgentReportRuntimeReadinessSnapshot { + schema_version: 'ai_agent_report_runtime_readiness_v1' + generated_at: string + program_status: { + overall_completion_percent: number + current_priority: 'P0' | 'P1' | 'P2' | 'P3' + current_task_id: 'P2-403L' + next_task_id: string + read_only_mode: true + runtime_authority: 'report_runtime_readiness_only_no_live_delivery_or_optimization' + status_note: string + } + source_refs: string[] + activation_truth: { + report_scheduler_contract_ready: true + telegram_gateway_queue_contract_ready: true + telegram_delivery_receipt_contract_ready: true + ai_readback_analysis_contract_ready: true + medium_low_auto_guard_contract_ready: true + high_risk_approval_gate_contract_ready: true + live_report_delivery_enabled: false + live_report_delivery_count_24h: number + telegram_gateway_queue_write_enabled: false + telegram_gateway_queue_write_count_24h: number + report_read_receipt_write_enabled: false + report_read_receipt_count_24h: number + ai_analysis_runtime_enabled: false + ai_analysis_runtime_count_24h: number + medium_low_auto_worker_enabled: false + medium_low_auto_execution_count_24h: number + production_optimization_enabled: false + production_optimization_count_24h: number + high_risk_auto_execution_enabled: false + high_risk_auto_execution_count_24h: number + truth_note: string + } + runtime_lanes: Array<{ + lane_id: string + display_name: string + owner_agent: 'openclaw' | 'hermes' | 'nemotron' + risk_tier: 'low' | 'medium' | 'high' | 'critical' + target_runtime: string + contract_status: 'ready_for_owner_review' | 'blocked_by_runtime_gate' + current_live_count_24h: number + enablement_required: string[] + blocked_actions: string[] + }> + automation_policies: Array<{ + risk_id: 'low' | 'medium' | 'high' | 'critical' + display_name: string + approval_required: boolean + auto_allowed_after_guard: boolean + current_execution_enabled: false + required_guards: string[] + reporting_rule: string + }> + report_delivery_cadence_gates: Array<{ + cadence_id: 'daily' | 'weekly' | 'monthly' + display_name: string + scheduler_source: string + telegram_digest_policy: string + recipient_room: string + dry_run_required: true + current_delivery_enabled: false + live_delivery_count_24h: number + }> + telegram_route_readiness: { + canonical_room: 'AwoooI SRE 戰情室' + secret_ref: 'SRE_GROUP_CHAT_ID' + gateway_required: true + direct_bot_api_allowed: false + bot_log_out_allowed: false + legacy_routes_must_converge: true + telegram_gateway_queue_write_enabled: false + e2e_delivery_verified: false + delivery_receipt_write_enabled: false + blocked_route_count: number + } + agent_post_report_actions: Array<{ + agent_id: 'openclaw' | 'hermes' | 'nemotron' + display_name: string + after_report_responsibility: string + allowed_without_approval: string[] + blocked_until_approval: string[] + live_action_count_24h: number + }> + operator_decisions: Array<{ + decision_id: string + display_name: string + risk_tier: 'low' | 'medium' | 'high' | 'critical' + owner_agent: 'openclaw' | 'hermes' | 'nemotron' + approval_required: boolean + status: 'ready_for_review' | 'blocked_by_runtime_gate' | 'approval_required' + why_it_matters: string + next_safe_step: string + }> + display_redaction_contract: { + redaction_required: true + raw_report_payload_display_allowed: false + private_reasoning_display_allowed: false + secret_value_display_allowed: false + work_window_transcript_display_allowed: false + allowed_display_fields: string[] + blocked_display_fields: string[] + } + rollups: { + runtime_lane_count: number + report_cadence_gate_count: number + operator_decision_count: number + automation_policy_count: number + ready_contract_count: number + blocked_contract_count: number + approval_required_decision_ids: string[] + current_enabled_count: number + live_report_delivery_count: number + live_ai_analysis_count: number + live_medium_low_auto_execution_count: number + telegram_gateway_queue_write_count: number + high_risk_auto_execution_count: number + } +} + export interface AiAgentOwnerApprovedFixtureDryRunSnapshot { schema_version: 'ai_agent_owner_approved_fixture_dry_run_v1' generated_at: string diff --git a/docs/LOGBOOK.md b/docs/LOGBOOK.md index 051869d02..fabcf20a7 100644 --- a/docs/LOGBOOK.md +++ b/docs/LOGBOOK.md @@ -51,6 +51,35 @@ **邊界**:本段未讀取 secret value、未發真實 Telegram 測試訊息、未改 Prometheus / Alertmanager route 或 receiver、未改 CronJob、未 SSH、未 active scan、未啟動 runtime repair / verifier worker、未把 SRE 路由收斂解讀為資安 owner response 或 runtime 授權。 +## 2026-06-12|P2-403L 報表派送與自動處理啟動前閘門 + +**背景**:P2-403J 已把日報 / 週報 / 月報、每個 Agent 工作量、圖表化報告、AI 建議與高 / 中 / 低風險政策接上治理頁,但 report delivery、Telegram Gateway queue write、AI 讀報後 runtime analysis、中低風險 auto worker 與生產優化仍全部為 `0`。本段把「如何啟動」拆成可審核 runtime lane,而不是直接打開正式執行。 + +**完成內容:** +- 新增 `docs/schemas/ai_agent_report_runtime_readiness_v1.schema.json`,定義 P2-403L 報表派送、Telegram Gateway queue、讀報回執、AI 讀報後分析、中低風險自動處理、高風險審核與 post-action verifier 啟動前閘門。 +- 新增 `docs/evaluations/ai_agent_report_runtime_readiness_2026-06-12.json`,固定 `7` 個 runtime lane、`3` 個報表週期 gate、`4` 個風險政策、`7` 個 operator decision;ready contract `6`、blocked contract `1`、需要批准 decision `6`。 +- 新增 `apps/api/src/services/ai_agent_report_runtime_readiness.py` 與 `GET /api/v1/agents/agent-report-runtime-readiness`;loader 強制 live report delivery、Gateway queue write、read receipt write、AI runtime、medium / low auto worker、production optimization、高風險 auto execution 全部維持 `false / 0`。 +- Governance automation inventory 頁新增 P2-403L「報表派送與自動處理啟動閘門」區塊,顯示 runtime lanes、啟動前真相、Telegram 戰情室路由、風險政策與 operator decisions;仍不提供發送、queue write、啟動 worker、批准或生產優化按鈕。 +- AI Agent 自動化工作清單、互動學習證據報告與 MASTER 已同步 P2-403L;下一步改為 `P2-403M` no-write dry-run / SRE 戰情室 Gateway queue 草案 / readback verifier。 + +**本地驗證:** +- JSON parse:P2-403L schema / snapshot、`zh-TW.json`、`en.json` 通過。 +- `DATABASE_URL='postgresql+asyncpg://test:test@localhost/test' PYTHONPATH=apps/api pytest -q apps/api/tests/test_ai_agent_report_runtime_readiness.py apps/api/tests/test_ai_agent_report_runtime_readiness_api.py`:`8 passed`。 +- Report governance 回歸:P2-403L + P2-403J automation + report truth 目標測試 `23 passed`。 +- `python3 -m py_compile apps/api/src/services/ai_agent_report_runtime_readiness.py apps/api/src/api/v1/agents.py` 通過。 +- `pnpm --filter @awoooi/web typecheck` 通過。 +- `NEXT_PUBLIC_API_URL=https://awoooi.wooo.work NEXT_PRIVATE_BUILD_WORKER_COUNT=1 SENTRY_SUPPRESS_GLOBAL_ERROR_HANDLER_FILE_WARNING=1 pnpm --filter @awoooi/web build` 通過;第一次 build 曾因舊 temp worktree `.next` 佔用磁碟導致 webpack cache `ENOSPC`,清理舊 build 產物後重跑成功。 +- `python3 scripts/security/security-mirror-progress-guard.py --root .`:`SECURITY_MIRROR_PROGRESS_GUARD_OK`。 +- `python3 scripts/security/source-control-owner-response-guard.py --root .`:`SOURCE_CONTROL_OWNER_RESPONSE_GUARD_OK`。 +- `python3 scripts/ops/doc-secrets-sanity-check.py docs .gitea`:`DOC_SECRET_SANITY_OK scanned_files=711`。 +- `git diff --check` 通過。 + +**完成度與邊界:** +- P2-403L 啟動前閘門:本地 `86%`,正式站部署 / production browser smoke 待補。 +- live report delivery、Telegram Gateway queue write、read receipt write、AI analysis runtime、中低風險 auto execution、高風險 auto execution、production optimization:全部仍為 `0`。 +- 低 / 中風險政策上可在 guard 通過後自動處理,但啟動 worker 本身仍需 no-write dry-run、post-action verifier、rollback/no-op evidence 與 failure-only Telegram 草案;高 / 關鍵風險仍必須統帥或 owner 審核。 +- 本段不排程實發、不送 Telegram、不寫 Gateway queue、不呼叫 Bot API、不改 CronJob / Alertmanager / Prometheus / route / receiver、不讀 secret、不寫 KM / PlayBook trust / timeline / replay score、不啟動 runtime worker、不執行生產優化、不顯示工作視窗對話內容。 + ## 2026-06-12|P2-403J 日週月報與風險自動化 Review **背景**:統帥要求 AI Agent 產生日報、週報、月報,能看到每個 AI Agent 做了哪些工作與工作量,並以數據化、圖表化報告呈現;Agent 看過報告後要能自動分析評估並提出解決方案,高風險需統帥審核,中 / 低風險則朝自動處理並告警回報前進。本段先建立只讀 review、API、治理頁與測試,不直接開啟 runtime 執行。 diff --git a/docs/ai/AI_AGENT_AUTOMATION_WORKLIST_2026-06-04.md b/docs/ai/AI_AGENT_AUTOMATION_WORKLIST_2026-06-04.md index 4943d286b..01007b34f 100644 --- a/docs/ai/AI_AGENT_AUTOMATION_WORKLIST_2026-06-04.md +++ b/docs/ai/AI_AGENT_AUTOMATION_WORKLIST_2026-06-04.md @@ -12,7 +12,7 @@ | Nemotron 實際整合應用 | 30% | 完整回放前仍被關卡擋下 | `blocked_needs_evidence`,下一關是 `refresh_source_evidence_then_5_record_smoke_only` | | 工具 / 服務 / 套件 AI 自動化 | 92% | P0 已完成;P1 服務 / runtime / 監控 / provider / service health / 備份 / DR / 套件與供應鏈只讀基線已完成;P1-007 失敗限定通知合約與前端 redaction 合約已完成;下一主線是 P2-004 依賴 / 供應鏈漂移監控 | 狀態分類、盤點 schema、權限矩陣、靜態盤點種子、只讀 API、UI 骨架、驗證、自動化待辦 schema / 快照 / API / 分組 UI、Backup / DR 目標盤點、準備度矩陣、備份通知政策、Backup / DR 證據 UI、復原演練批准包模板、異地 / escrow 準備度狀態、任務批准邊界、確定性進度彙總、Python 套件 / 供應鏈只讀基線、JS pnpm/npm 只讀基線、Docker build surface 只讀基線、CVE / license / drift 嚴重度政策、定期依賴漂移與外部資料來源檢查設計、依賴升級批准包模板、runtime_surface_inventory_v1 schema / snapshot / API / UI、gitea_workflow_runner_health_v1 schema / snapshot / API / UI、observability_contract_matrix_v1 schema / snapshot / API / UI、ai_provider_route_matrix_v1 schema / snapshot / API / UI、service_health_gap_matrix_v1 schema / snapshot / API / UI、service health evidence cards UI、service_health_failure_notification_policy_v1 schema / snapshot / API / UI 已完成 | | OpenClaw / Hermes / NemoTron 佈建布局 | 45% | P1-401 / P1-402 已完成;仍是只讀 layout 與治理頁顯示,不是 runtime deploy | `ai_agent_deployment_layout_v1` schema、`ai_agent_deployment_layout_2026-06-11.json`、`GET /api/v1/agents/agent-deployment-layout`、治理頁自動化盤點 UI、`AI_AGENT_DEPLOYMENT_LAYOUT_2026-06-11.md` | -| OpenClaw / Hermes / NemoTron 主動溝通、學習與成長證據 | 100% | P2-401A 已完成只讀 contract;P2-403A 已完成互動 / 接手 / 學習 / 成長證據面板;P2-403B 已完成 AgentSession / Redis Streams live read model gate;P2-403C 已完成 Redis Streams consumer group dry-run、handoff envelope、ack / dead-letter / replay gate;P2-403D 已完成 learning writeback approval package;P2-403E 已完成 Telegram receipt approval package;P2-403F 已完成 owner-approved learning dry-run preview、人工操作選項與 fixture-only dry-run 總包;P2-403G 已完成 runtime write gate review,固定雙重批准、dry-run hash、post-write verifier 與 redaction 欄位;P2-403H 已完成 post-write verifier implementation package、rollback lane、failure lane 與人工操作選項;P2-403I 已完成 runtime verifier evidence implementation review;P2-403J 已完成報表真相、告警有效性、日報、週報、月報、每個 Agent 工作量、圖表化報告、AI 分析建議與高 / 中 / 低風險自動化政策審查;P2-403K 已完成本地程式層 SRE 戰情室路由收斂,移除 Gitea / API / ops script 的舊群組與 private mirror fallback。runtime worker、DB migration、production Redis consumer group、Telegram 實發、delivery receipt E2E、report delivery、AI analysis runtime、中低風險 auto worker、KM / PlayBook trust / timeline / replay score 寫入、SDK / 付費服務仍未開 gate | `ai_agent_communication_learning_contract_v1`、`ai_agent_interaction_learning_proof_v1`、`ai_agent_live_read_model_gate_v1`、`ai_agent_redis_dry_run_gate_v1`、`ai_agent_learning_writeback_approval_package_v1`、`ai_agent_telegram_receipt_approval_package_v1`、`ai_agent_owner_approved_learning_dry_run_v1`、`ai_agent_owner_approved_fixture_dry_run_v1`、`GET /api/v1/agents/agent-communication-learning-contract`、`GET /api/v1/agents/agent-interaction-learning-proof`、`GET /api/v1/agents/agent-live-read-model-gate`、`GET /api/v1/agents/agent-redis-dry-run-gate`、`GET /api/v1/agents/agent-learning-writeback-approval-package`、`GET /api/v1/agents/agent-telegram-receipt-approval-package`、`GET /api/v1/agents/agent-owner-approved-learning-dry-run`、`GET /api/v1/agents/agent-owner-approved-fixture-dry-run`、`ai_agent_runtime_write_gate_review_v1`、`GET /api/v1/agents/agent-runtime-write-gate-review`、`ai_agent_post_write_verifier_package_v1`、`GET /api/v1/agents/agent-post-write-verifier-package`、`ai_agent_runtime_verifier_evidence_review_v1`、`GET /api/v1/agents/agent-runtime-verifier-evidence-review`、`ai_agent_report_truth_actionability_review_v1`、`GET /api/v1/agents/agent-report-truth-actionability-review`、`ai_agent_report_automation_review_v1`、`GET /api/v1/agents/agent-report-automation-review`、`/zh-TW/governance?tab=automation-inventory`、MASTER §3.2.1b / §3.2.1d / §3.4.3 | +| OpenClaw / Hermes / NemoTron 主動溝通、學習與成長證據 | 100% | P2-401A 已完成只讀 contract;P2-403A 已完成互動 / 接手 / 學習 / 成長證據面板;P2-403B 已完成 AgentSession / Redis Streams live read model gate;P2-403C 已完成 Redis Streams consumer group dry-run、handoff envelope、ack / dead-letter / replay gate;P2-403D 已完成 learning writeback approval package;P2-403E 已完成 Telegram receipt approval package;P2-403F 已完成 owner-approved learning dry-run preview、人工操作選項與 fixture-only dry-run 總包;P2-403G 已完成 runtime write gate review,固定雙重批准、dry-run hash、post-write verifier 與 redaction 欄位;P2-403H 已完成 post-write verifier implementation package、rollback lane、failure lane 與人工操作選項;P2-403I 已完成 runtime verifier evidence implementation review;P2-403J 已完成報表真相、告警有效性、日報、週報、月報、每個 Agent 工作量、圖表化報告、AI 分析建議與高 / 中 / 低風險自動化政策審查;P2-403K 已完成本地程式層 SRE 戰情室路由收斂;P2-403L 已完成報表派送、Telegram Gateway queue、讀報回執、AI 讀報後分析、中低風險自動處理與高風險審核的啟動前閘門。runtime worker、DB migration、production Redis consumer group、Telegram 實發、delivery receipt E2E、report delivery、Gateway queue write、AI analysis runtime、中低風險 auto worker、KM / PlayBook trust / timeline / replay score 寫入、SDK / 付費服務仍未開 gate | `ai_agent_communication_learning_contract_v1`、`ai_agent_interaction_learning_proof_v1`、`ai_agent_live_read_model_gate_v1`、`ai_agent_redis_dry_run_gate_v1`、`ai_agent_learning_writeback_approval_package_v1`、`ai_agent_telegram_receipt_approval_package_v1`、`ai_agent_owner_approved_learning_dry_run_v1`、`ai_agent_owner_approved_fixture_dry_run_v1`、`GET /api/v1/agents/agent-communication-learning-contract`、`GET /api/v1/agents/agent-interaction-learning-proof`、`GET /api/v1/agents/agent-live-read-model-gate`、`GET /api/v1/agents/agent-redis-dry-run-gate`、`GET /api/v1/agents/agent-learning-writeback-approval-package`、`GET /api/v1/agents/agent-telegram-receipt-approval-package`、`GET /api/v1/agents/agent-owner-approved-learning-dry-run`、`GET /api/v1/agents/agent-owner-approved-fixture-dry-run`、`ai_agent_runtime_write_gate_review_v1`、`GET /api/v1/agents/agent-runtime-write-gate-review`、`ai_agent_post_write_verifier_package_v1`、`GET /api/v1/agents/agent-post-write-verifier-package`、`ai_agent_runtime_verifier_evidence_review_v1`、`GET /api/v1/agents/agent-runtime-verifier-evidence-review`、`ai_agent_report_truth_actionability_review_v1`、`GET /api/v1/agents/agent-report-truth-actionability-review`、`ai_agent_report_automation_review_v1`、`GET /api/v1/agents/agent-report-automation-review`、`ai_agent_report_runtime_readiness_v1`、`GET /api/v1/agents/agent-report-runtime-readiness`、`/zh-TW/governance?tab=automation-inventory`、MASTER §3.2.1b / §3.2.1d / §3.4.3 | | AI Agent 主動營運委派與版本生命週期 | 100% | P2-402A / P2-402B / P2-402C / P2-402D / P2-402E / P2-402F / P2-402G 已完成;已建立 repo-only 版本新鮮度快照、工具採用批准包、Telegram action-required digest policy、Gitea PR 草案 lane、host / K3s / stateful 版本只讀盤點、API 與 governance UI。定期排程、外部版本查詢、工具安裝、CI 變更、套件升級、主機更新、container pull、實際 PR creation、auto merge、Telegram 實發、SSH、kubectl、重啟仍未開 gate | `ai_agent_proactive_operations_contract_v1`、`ai_agent_version_freshness_snapshot_v1`、`ai_agent_tool_adoption_approval_package_v1`、`ai_agent_telegram_action_required_digest_policy_v1`、`ai_agent_gitea_pr_draft_lane_v1`、`ai_agent_host_stateful_version_inventory_v1`、`GET /api/v1/agents/agent-proactive-operations-contract`、`GET /api/v1/agents/agent-version-freshness-snapshot`、`GET /api/v1/agents/agent-tool-adoption-approval-package`、`GET /api/v1/agents/agent-telegram-action-required-digest-policy`、`GET /api/v1/agents/agent-gitea-pr-draft-lane`、`GET /api/v1/agents/agent-host-stateful-version-inventory`、`/zh-TW/governance?tab=automation-inventory`、MASTER §3.2.1c | | 本工作清單與分析報告 | 100% | 已完成 | 本 MD 文件 | @@ -20,9 +20,9 @@ AI Agent 自動化工作包目前完成度:**92%**。本工作清單文件本 三 Agent 佈建布局目前完成度:**45%**。第一波已完成只讀 schema / snapshot / API / 測試 / 報告,第二波已接入治理頁自動化盤點 UI;正式 runtime 佈署、Telegram E2E 發送與 AgentSession 工作流仍需逐項 gate。 -三 Agent 主動溝通、學習與成長證據目前完成度:**100%**。已完成只讀契約、互動 / 接手 / 學習 / 成長證據面板、P2-403B live read model gate、P2-403C Redis dry-run gate、P2-403D learning writeback approval package、P2-403E Telegram receipt approval package、P2-403F owner-approved learning dry-run preview、人工操作選項與 fixture-only dry-run 總包、P2-403G runtime write gate review、P2-403H post-write verifier implementation package、P2-403I runtime verifier evidence implementation review、P2-403J 報表真相 / 告警有效性 / 日週月報 / Agent 工作量 / 圖表化報告 / AI 建議 / 風險自動化政策審查、P2-403K SRE 戰情室路由程式收斂、API、治理頁顯示、測試與 MASTER 同步;目前 live AgentSession、Agent message、handoff、learning write、Telegram receipt、Gateway queue write、runtime verifier execution、report delivery、AI analysis runtime、中低風險 auto worker、Telegram 實發與 delivery receipt E2E 仍全部為 `0`,下一步依優先順序推 `P2-403L` delivery receipt / queue write E2E,但仍不得跳過 runtime gate。 +三 Agent 主動溝通、學習與成長證據目前完成度:**100%**。已完成只讀契約、互動 / 接手 / 學習 / 成長證據面板、P2-403B live read model gate、P2-403C Redis dry-run gate、P2-403D learning writeback approval package、P2-403E Telegram receipt approval package、P2-403F owner-approved learning dry-run preview、人工操作選項與 fixture-only dry-run 總包、P2-403G runtime write gate review、P2-403H post-write verifier implementation package、P2-403I runtime verifier evidence implementation review、P2-403J 報表真相 / 告警有效性 / 日週月報 / Agent 工作量 / 圖表化報告 / AI 建議 / 風險自動化政策審查、P2-403K SRE 戰情室路由程式收斂,以及 P2-403L 報表派送 / Telegram queue / 讀報回執 / AI 讀報分析 / 中低風險自動處理 / 高風險審核啟動前閘門、API、治理頁顯示、測試與 MASTER 同步;目前 live AgentSession、Agent message、handoff、learning write、Telegram receipt、Gateway queue write、runtime verifier execution、report delivery、AI analysis runtime、中低風險 auto worker、Telegram 實發與 delivery receipt E2E 仍全部為 `0`,下一步依優先順序推 `P2-403M` no-write dry-run / SRE 戰情室 Gateway queue 草案 / readback verifier,但在批准前仍不得啟動 runtime loop。 -AI Agent 主動營運委派與版本生命週期目前完成度:**100%**。已完成 12 類版本 domain、24 類可委派能力、5 種 cadence、8 類 MCP、4 類 RAG memory、只讀 API、`P2-402B` repo-only daily version freshness snapshot、`P2-402C` Renovate / OSV-Scanner / Trivy / Syft / Grype 工具採用批准包、`P2-402D` Telegram action-required digest policy、`P2-402E` Gitea PR 草案 lane、`P2-402F` host OS / K3s / stateful services 版本只讀盤點,以及 `P2-402G` governance UI 顯示可委派能力;`P2-403A`、`P2-403B`、`P2-403C`、`P2-403D`、`P2-403E`、`P2-403F` 、`P2-403G`、`P2-403H`、`P2-403I`、`P2-403J` 與 `P2-403K` 已先補互動、學習證據面、live read model gate、Redis dry-run gate、learning writeback approval package、Telegram receipt approval package、owner-approved learning dry-run preview、runtime write gate review、post-write verifier package、runtime verifier evidence review、報表真相、TG 戰情室收斂、日週月報、Agent 工作量、圖表化報告、風險自動化政策審查與 SRE 戰情室路由程式收斂。下一步是 `P2-403L` delivery receipt / queue write E2E,外部 registry / package source / host probe / SSH / kubectl / 工具安裝 / CI 變更 / 實際 PR creation / Telegram 實發與 learning write 仍需 gate。 +AI Agent 主動營運委派與版本生命週期目前完成度:**100%**。已完成 12 類版本 domain、24 類可委派能力、5 種 cadence、8 類 MCP、4 類 RAG memory、只讀 API、`P2-402B` repo-only daily version freshness snapshot、`P2-402C` Renovate / OSV-Scanner / Trivy / Syft / Grype 工具採用批准包、`P2-402D` Telegram action-required digest policy、`P2-402E` Gitea PR 草案 lane、`P2-402F` host OS / K3s / stateful services 版本只讀盤點,以及 `P2-402G` governance UI 顯示可委派能力;`P2-403A` 到 `P2-403L` 已先補互動、學習證據面、live read model gate、Redis dry-run gate、learning writeback approval package、Telegram receipt approval package、owner-approved learning dry-run preview、runtime write gate review、post-write verifier package、runtime verifier evidence review、報表真相、TG 戰情室收斂、日週月報、Agent 工作量、圖表化報告、風險自動化政策與報表 runtime 啟動前閘門。下一步是 `P2-403M` no-write dry-run / SRE 戰情室 Gateway queue 草案 / readback verifier,外部 registry / package source / host probe / SSH / kubectl / 工具安裝 / CI 變更 / 實際 PR creation / Telegram 實發與 learning write 仍需 gate。 完成度計算模型: @@ -969,6 +969,7 @@ UI: | P2-403H | 完成 | 100 | OpenClaw | Post-write verifier implementation package、rollback lane、failure lane 與人工操作選項 | `ai_agent_post_write_verifier_package_v1` / snapshot / 只讀 API / governance UI;4 個 verification target、3 個 failure lane、4 個 operator action 與 live verifier execution `0` | 不讀 canonical target、不寫 rollback work item、不發 Telegram、不寫 KM / PlayBook trust / timeline / replay score;runtime verifier 仍未授權 | | P2-403J | 完成 | 100 | Hermes + OpenClaw | 報表真相、告警有效性、日週月報、每個 Agent 工作量、圖表化報告、AI 分析建議與風險自動化政策審查;高風險需審核,中低風險目前只定義 policy | `ai_agent_report_truth_actionability_review_v1` + `ai_agent_report_automation_review_v1` / snapshot / 只讀 API / governance UI;5 個真相缺口、3 個日週月契約、4 個 actionability lane、4 條 TG 旁路風險、3 個報表週期、3 個 Agent 工作量、4 個 chart package、5 個 recommendation | 不發 Telegram、不改 CronJob、不改 Prometheus / Alertmanager、不改 route / receiver、不讀 secret、不寫 work item / KM / PlayBook trust、不開 runtime worker、不排程實發、不啟動中低風險 auto worker、不執行生產優化 | | P2-403K | 本地完成,正式站待驗證 | 100 | OpenClaw | AwoooI SRE 戰情室路由程式收斂;移除 Gitea / API / ops script 舊群組與 private mirror fallback | Gitea workflow 使用 `SRE_GROUP_CHAT_ID`;CD 舊相容欄位取自 SRE group;Telegram Gateway / notification matrix / jobs / ops scripts SRE-only;CI guard 擋舊 `TELEGRAM_ALERT_CHAT_ID` / `TELEGRAM_CHAT_ID` 與非 SRE direct fallback | 未讀 secret value、未發 Telegram live 測試、未改 Prometheus / Alertmanager route、未開 Gateway queue write / receipt worker / runtime gate | +| P2-403L | 完成 | 86 | OpenClaw + Hermes + NemoTron | 報表派送、Telegram Gateway queue、讀報回執、AI 讀報後分析、中低風險自動處理、高風險審核與 post-action verifier 啟動前閘門 | `ai_agent_report_runtime_readiness_v1` / snapshot / 只讀 API / governance UI;7 個 runtime lane、3 個報表週期 gate、4 個風險政策、7 個 operator decision、SRE 戰情室路由 contract;live delivery / queue write / AI runtime / 中低風險執行全部 `0` | 不排程實發、不寫 Gateway queue、不呼叫 Bot API、不啟動 AI runtime worker、不啟動中低風險 auto worker、不執行生產優化、不讀 secret、不顯示內部對話內容 | | P2-101 | 待辦 | 0 | OpenClaw | 定義操作類別權限模型 | 操作政策 schema | HITL 關卡 | | P2-102 | 待辦 | 0 | OpenClaw | 所有候選操作都要有 dry-run 證據 | dry-run 合約 | 不直接 apply | | P2-103 | 待辦 | 0 | Hermes | 把任務結果接回 KM / LOGBOOK / 稽核軌跡 | 證據寫入器 | 不洩漏 secret | diff --git a/docs/ai/AI_AGENT_INTERACTION_LEARNING_PROOF_2026-06-11.md b/docs/ai/AI_AGENT_INTERACTION_LEARNING_PROOF_2026-06-11.md index e17293fb5..cab655be1 100644 --- a/docs/ai/AI_AGENT_INTERACTION_LEARNING_PROOF_2026-06-11.md +++ b/docs/ai/AI_AGENT_INTERACTION_LEARNING_PROOF_2026-06-11.md @@ -1,8 +1,8 @@ # AI Agent 互動、溝通、學習與成長證據報告 > 日期:2026-06-11(台北時間) -> 文件定位:P2-403A 證據面 + P2-403B AgentSession / Redis Streams live read model gate + P2-403C Redis dry-run gate + P2-403D learning writeback approval package + P2-403E Telegram receipt approval package + P2-403F owner-approved learning dry-run / fixture dry-run、P2-403G runtime write gate review、P2-403H post-write verifier package、P2-403I runtime verifier evidence implementation review、P2-403J 報表真相 / 日週月報 / Agent 工作量 / 風險自動化 review、API 與治理頁 UI。 -> 事實邊界:本波只建立可見證據面、read model gate 與報表治理 review,不啟動 runtime worker、不建立 DB migration、不開 Redis consumer group、不發 Telegram、不排程實發報告、不啟動中低風險 auto worker、不執行生產優化、不顯示工作視窗對話內容。 +> 文件定位:P2-403A 證據面 + P2-403B AgentSession / Redis Streams live read model gate + P2-403C Redis dry-run gate + P2-403D learning writeback approval package + P2-403E Telegram receipt approval package + P2-403F owner-approved learning dry-run / fixture dry-run、P2-403G runtime write gate review、P2-403H post-write verifier package、P2-403I runtime verifier evidence implementation review、P2-403J 報表真相 / 日週月報 / Agent 工作量 / 風險自動化 review、P2-403L 報表派送與自動處理啟動前閘門、API 與治理頁 UI。 +> 事實邊界:本波只建立可見證據面、read model gate、報表治理 review 與 runtime readiness gate,不啟動 runtime worker、不建立 DB migration、不開 Redis consumer group、不發 Telegram、不寫 Gateway queue、不排程實發報告、不啟動中低風險 auto worker、不執行生產優化、不顯示工作視窗對話內容。 ## 0. P2-403J 補記:報表真相、日週月報與風險自動化 Review @@ -10,9 +10,15 @@ 本段把週報全 0 固定為「低可信可處置異常」,不是健康訊號;同時把本產品正式 Telegram 告警目標固定為 **AwoooI SRE 戰情室**(`SRE_GROUP_CHAT_ID`),其他 TG Bot / 群組 / direct Telegram API 路徑都列為待收斂旁路風險。P2-403J 同步新增日報 / 週報 / 月報、每個 Agent 工作量、圖表化報告、AI 分析建議與高 / 中 / 低風險 policy review。此段仍只讀,不發 Telegram、不改 CronJob、不改 Alertmanager / Prometheus、不改 route / receiver、不讀 secret、不寫 work item / KM / PlayBook trust、不開 runtime worker、不排程實發報告、不啟動中低風險 auto worker。 +## 0.1 P2-403L 補記:報表派送與自動處理啟動前閘門 + +2026-06-12 已新增 P2-403L:`ai_agent_report_runtime_readiness_v1`、`docs/evaluations/ai_agent_report_runtime_readiness_2026-06-12.json`、`GET /api/v1/agents/agent-report-runtime-readiness` 與治理頁區塊。 + +本段把日週月報真正送出前需要的 runtime lane 拆成 7 個 gate:報表排程器、Telegram Gateway queue、送達與讀報回執、AI 讀報後分析、中低風險自動處理 guard、高風險統帥審核、post-action verifier。政策上低 / 中風險可在 guard 通過後自動處理,但目前 live delivery、Gateway queue write、AI runtime worker、中低風險 auto worker、高風險自動執行與生產優化仍全部為 `0 / false`。 + ## 1. 結論 -已完成 P2-403A、P2-403B、P2-403C、P2-403D、P2-403E、P2-403F、P2-403G、P2-403H、P2-403I 與 P2-403J:讓統帥能在治理頁看到 OpenClaw / Hermes / NemoTron 的互動、接手、學習與成長是否真的有證據,並看到 live read model、Redis dry-run、handoff envelope、ack / dead-letter / replay、learning writeback approval、Telegram receipt approval、fixture dry-run、runtime write gate review、post-write verifier package、runtime verifier evidence review、報表真相、日週月報、Agent 工作量、圖表化報告與風險自動化政策下一步要通過哪些 gate。 +已完成 P2-403A、P2-403B、P2-403C、P2-403D、P2-403E、P2-403F、P2-403G、P2-403H、P2-403I、P2-403J 與 P2-403L:讓統帥能在治理頁看到 OpenClaw / Hermes / NemoTron 的互動、接手、學習與成長是否真的有證據,並看到 live read model、Redis dry-run、handoff envelope、ack / dead-letter / replay、learning writeback approval、Telegram receipt approval、fixture dry-run、runtime write gate review、post-write verifier package、runtime verifier evidence review、報表真相、日週月報、Agent 工作量、圖表化報告、風險自動化政策與報表 runtime 啟動前閘門下一步要通過哪些 gate。 目前真相: @@ -31,6 +37,7 @@ | learning writeback | 未啟用,數量 `0` | | Telegram digest receipts | 未啟用,數量 `0` | | Report delivery / AI analysis / auto optimization | 未啟用,數量 `0` | +| Telegram Gateway queue / 中低風險 auto worker | 未啟用,數量 `0` | 這代表使用者現在可以看見「哪裡已準備好、哪裡仍未運作、被哪個 gate 阻擋、下一步要如何驗證」。但還不能宣稱三個 Agent 已經在 production runtime 主動互傳訊息或自主學習。 @@ -80,17 +87,20 @@ | `docs/schemas/ai_agent_report_automation_review_v1.schema.json` | P2-403J 日週月報、Agent 工作量、圖表化報告、AI 分析建議與高 / 中 / 低風險 policy review schema | | `docs/evaluations/ai_agent_report_automation_review_2026-06-12.json` | P2-403J committed snapshot,3 個報表週期、3 個 Agent 工作量、4 個 chart package、5 個 AI recommendation;live delivery / auto optimization 全為 `0` | | `GET /api/v1/agents/agent-report-automation-review` | 只讀 API;不排程實發、不送 Telegram、不啟動中低風險 auto worker、不執行生產優化 | +| `docs/schemas/ai_agent_report_runtime_readiness_v1.schema.json` | P2-403L 報表派送、Telegram Gateway queue、讀報回執、AI 讀報後分析、中低風險自動處理、高風險審核與 post-action verifier 啟動前閘門 schema | +| `docs/evaluations/ai_agent_report_runtime_readiness_2026-06-12.json` | P2-403L committed snapshot,7 個 runtime lane、3 個報表週期 gate、4 個風險政策、7 個 operator decision;live delivery / Gateway queue write / AI runtime / 中低風險 auto worker 全為 `0` | +| `GET /api/v1/agents/agent-report-runtime-readiness` | 只讀 API;不排程實發、不寫 Gateway queue、不呼叫 Bot API、不啟動 AI runtime worker、不執行生產優化 | | `apps/api/src/services/ai_agent_interaction_learning_proof.py` | 只讀 loader 與安全驗證 | | `apps/api/src/services/ai_agent_live_read_model_gate.py` | P2-403B 只讀 loader;拒絕 live DB query、Redis consumer、unsafe fields、Telegram 與 writeback | | `GET /api/v1/agents/agent-interaction-learning-proof` | 只讀 API,不啟動 worker、不碰 Redis / DB runtime、不發 Telegram | | `GET /api/v1/agents/agent-live-read-model-gate` | 只讀 API,不連 DB、不讀寫 Redis、不發 Telegram | -| governance UI | 新增證據階梯、目前真相、P2-403B live read gate、P2-403C Redis dry-run gate、P2-403D learning writeback approval package、P2-403E Telegram receipt approval package、P2-403F owner-approved learning dry-run / fixture dry-run、P2-403G runtime write gate review、P2-403H post-write verifier package、P2-403I runtime verifier evidence review、P2-403J 報表真相 / 日週月報 / Agent 工作量 / 圖表 / AI 建議、Agent lane、可觀測訊號、runtime gates、前端 redaction | +| governance UI | 新增證據階梯、目前真相、P2-403B live read gate、P2-403C Redis dry-run gate、P2-403D learning writeback approval package、P2-403E Telegram receipt approval package、P2-403F owner-approved learning dry-run / fixture dry-run、P2-403G runtime write gate review、P2-403H post-write verifier package、P2-403I runtime verifier evidence review、P2-403J 報表真相 / 日週月報 / Agent 工作量 / 圖表 / AI 建議、P2-403L 報表 runtime readiness、Agent lane、可觀測訊號、runtime gates、前端 redaction | ## 5. 後續優先順序 | 優先 | ID | 工作 | gate | |---:|---|---|---| -| 1 | P2-403K | unified report truth service / 中低風險 runtime guard / SRE 戰情室路由遷移批准包 | report runtime guard | +| 1 | P2-403M | no-write dry-run / SRE 戰情室 Gateway queue 草案 / readback verifier | report runtime dry-run | | 2 | P2-404 | runtime worker shadow / no-write execution evidence gate | runtime shadow evidence | ## 6. 紅線 diff --git a/docs/ai/AI_AGENT_PROACTIVE_OPERATIONS_2026-06-11.md b/docs/ai/AI_AGENT_PROACTIVE_OPERATIONS_2026-06-11.md index c42463850..7ad15e8f7 100644 --- a/docs/ai/AI_AGENT_PROACTIVE_OPERATIONS_2026-06-11.md +++ b/docs/ai/AI_AGENT_PROACTIVE_OPERATIONS_2026-06-11.md @@ -82,7 +82,7 @@ | Dockerfiles | Hermes | action_required | P2-402C 評估 Trivy / Syft / Grype / Docker Scout 採用,不 build / pull | | Committed evaluation snapshots | Hermes | action_required | 將 2026-06-04~06-05 舊基線列入 stale refs,不假裝是外部最新 | | Agent / model governance snapshots | NemoTron | action_required | 只做離線 freshness note,不進 shadow / canary / production route | -| K8s / Gitea / observability / Ansible / backup / web surfaces | OpenClaw + Hermes | baseline_ready / planned_next | 下一步進入 P2-403K unified report truth service / 中低風險 runtime guard / SRE 戰情室路由遷移批准包;現階段仍只讀 | +| K8s / Gitea / observability / Ansible / backup / web surfaces | OpenClaw + Hermes | baseline_ready / planned_next | P2-403K 已進 SRE 戰情室路由收斂;下一步接 P2-403L 報表 runtime 啟動前閘門與 P2-403M no-write dry-run;現階段仍只讀 | 本波只把「每天要看哪些 repo 內版本來源」定義成可驗證資料面。每日排程、外部 registry 查詢、主機/K3s live probe、Telegram digest 與 Gitea PR lane 都仍是下一階段 gate。 diff --git a/docs/evaluations/ai_agent_interaction_learning_proof_2026-06-11.json b/docs/evaluations/ai_agent_interaction_learning_proof_2026-06-11.json index 3a7094e38..2e91252ff 100644 --- a/docs/evaluations/ai_agent_interaction_learning_proof_2026-06-11.json +++ b/docs/evaluations/ai_agent_interaction_learning_proof_2026-06-11.json @@ -85,7 +85,7 @@ "completion_percent": 100, "operator_meaning": "已定義 AI Agent 日報、週報、月報、每個 Agent 工作量、圖表化報告、AI 分析建議與高/中/低風險自動化政策;尚未排程實發或啟動中低風險 runtime worker。", "source_of_truth": "ai_agent_report_automation_review_v1", - "next_gate": "P2-403K 中低風險自動處理 runtime guard。" + "next_gate": "P2-403K SRE 戰情室路由收斂後,接 P2-403L 報表 runtime 啟動前閘門。" }, { "level_id": "learning_growth", diff --git a/docs/evaluations/ai_agent_report_automation_review_2026-06-12.json b/docs/evaluations/ai_agent_report_automation_review_2026-06-12.json index b7f1b940f..1d6352779 100644 --- a/docs/evaluations/ai_agent_report_automation_review_2026-06-12.json +++ b/docs/evaluations/ai_agent_report_automation_review_2026-06-12.json @@ -32,7 +32,7 @@ "live_medium_low_auto_execution_count_24h": 0, "high_risk_requires_approval": true, "live_auto_optimization_count_24h": 0, - "truth_note": "目前已能在治理頁看到日/週/月報表、Agent 工作量與風險分級建議;但排程發送、報告讀取後 AI 自動分析、以及中低風險自動優化仍需 P2-403K runtime guard、Telegram receipt 與 verifier 通過後才可啟動。" + "truth_note": "目前已能在治理頁看到日/週/月報表、Agent 工作量與風險分級建議;但排程發送、報告讀取後 AI 自動分析、以及中低風險自動優化仍需 P2-403K SRE 路由收斂與 P2-403L runtime guard、Telegram receipt、verifier 通過後才可啟動。" }, "report_cadences": [ { diff --git a/docs/evaluations/ai_agent_report_runtime_readiness_2026-06-12.json b/docs/evaluations/ai_agent_report_runtime_readiness_2026-06-12.json new file mode 100644 index 000000000..004750031 --- /dev/null +++ b/docs/evaluations/ai_agent_report_runtime_readiness_2026-06-12.json @@ -0,0 +1,455 @@ +{ + "schema_version": "ai_agent_report_runtime_readiness_v1", + "generated_at": "2026-06-12T04:35:00+08:00", + "program_status": { + "overall_completion_percent": 86, + "current_priority": "P2", + "current_task_id": "P2-403L", + "next_task_id": "P2-403M", + "read_only_mode": true, + "runtime_authority": "report_runtime_readiness_only_no_live_delivery_or_optimization", + "status_note": "P2-403L 已建立日週月報派送、Telegram Gateway queue、讀報回執、AI 讀報後分析、中低風險自動處理、高風險審核與 post-action verifier 的啟動前閘門;目前仍未啟動 live 派送、queue write、AI runtime worker 或生產優化。" + }, + "source_refs": [ + "docs/evaluations/ai_agent_report_automation_review_2026-06-12.json", + "docs/evaluations/ai_agent_report_truth_actionability_review_2026-06-12.json", + "docs/evaluations/ai_agent_telegram_receipt_approval_package_2026-06-11.json", + "docs/evaluations/ai_agent_runtime_write_gate_review_2026-06-12.json", + "docs/evaluations/ai_agent_runtime_verifier_evidence_review_2026-06-12.json", + "docs/superpowers/specs/2026-04-15-MASTER-ai-autonomous-flywheel-v2.md" + ], + "activation_truth": { + "report_scheduler_contract_ready": true, + "telegram_gateway_queue_contract_ready": true, + "telegram_delivery_receipt_contract_ready": true, + "ai_readback_analysis_contract_ready": true, + "medium_low_auto_guard_contract_ready": true, + "high_risk_approval_gate_contract_ready": true, + "live_report_delivery_enabled": false, + "live_report_delivery_count_24h": 0, + "telegram_gateway_queue_write_enabled": false, + "telegram_gateway_queue_write_count_24h": 0, + "report_read_receipt_write_enabled": false, + "report_read_receipt_count_24h": 0, + "ai_analysis_runtime_enabled": false, + "ai_analysis_runtime_count_24h": 0, + "medium_low_auto_worker_enabled": false, + "medium_low_auto_execution_count_24h": 0, + "production_optimization_enabled": false, + "production_optimization_count_24h": 0, + "high_risk_auto_execution_enabled": false, + "high_risk_auto_execution_count_24h": 0, + "truth_note": "報表制度、風險政策與可視化已完成;P2-403L 補齊啟動前 runtime 閘門。下一步只能先做 dry-run / queue draft / readback verifier,不得直接發 Telegram 或改正式環境。" + }, + "runtime_lanes": [ + { + "lane_id": "report_scheduler", + "display_name": "日週月報排程器", + "owner_agent": "hermes", + "risk_tier": "low", + "target_runtime": "report_run snapshot generator", + "contract_status": "ready_for_owner_review", + "current_live_count_24h": 0, + "enablement_required": [ + "idempotent report_run_id", + "dry-run output hash", + "no external delivery in first run", + "daily / weekly / monthly cadence collision check" + ], + "blocked_actions": [ + "CronJob apply", + "Telegram send", + "AwoooP work item write" + ] + }, + { + "lane_id": "telegram_gateway_queue", + "display_name": "Telegram Gateway queue 草案", + "owner_agent": "hermes", + "risk_tier": "medium", + "target_runtime": "Telegram Gateway queue draft", + "contract_status": "ready_for_owner_review", + "current_live_count_24h": 0, + "enablement_required": [ + "SRE_GROUP_CHAT_ID injection verified", + "Gateway path only", + "failure-only immediate policy", + "daily digest noise budget" + ], + "blocked_actions": [ + "direct Telegram Bot API", + "bot logOut", + "secret payload read" + ] + }, + { + "lane_id": "telegram_delivery_receipt", + "display_name": "報表送達與讀報回執", + "owner_agent": "hermes", + "risk_tier": "medium", + "target_runtime": "delivery receipt read model", + "contract_status": "ready_for_owner_review", + "current_live_count_24h": 0, + "enablement_required": [ + "message_id redaction", + "ack timeout rule", + "retry ceiling", + "governance receipt readback" + ], + "blocked_actions": [ + "DB migration", + "live callback write", + "Telegram retry loop" + ] + }, + { + "lane_id": "ai_post_report_analysis", + "display_name": "AI 讀報後分析", + "owner_agent": "openclaw", + "risk_tier": "medium", + "target_runtime": "post-report analysis worker", + "contract_status": "ready_for_owner_review", + "current_live_count_24h": 0, + "enablement_required": [ + "sanitized report packet", + "OpenClaw risk arbitration", + "Hermes evidence dossier", + "NemoTron replay lane for non-live evaluation" + ], + "blocked_actions": [ + "production optimization", + "provider switch", + "private reasoning display" + ] + }, + { + "lane_id": "medium_low_auto_guard", + "display_name": "中低風險自動處理 guard", + "owner_agent": "openclaw", + "risk_tier": "high", + "target_runtime": "guarded medium / low auto worker", + "contract_status": "ready_for_owner_review", + "current_live_count_24h": 0, + "enablement_required": [ + "allow-list generated from risk policy", + "dry-run first", + "post-action verifier", + "rollback / no-op evidence", + "failure-only Telegram report" + ], + "blocked_actions": [ + "production write", + "service restart", + "workflow change", + "package upgrade" + ] + }, + { + "lane_id": "high_risk_approval", + "display_name": "高風險統帥審核", + "owner_agent": "openclaw", + "risk_tier": "high", + "target_runtime": "HITL approval packet", + "contract_status": "ready_for_owner_review", + "current_live_count_24h": 0, + "enablement_required": [ + "owner response", + "maintenance window when needed", + "rollback owner", + "post-deploy verification plan" + ], + "blocked_actions": [ + "auto approval", + "auto merge", + "production route change" + ] + }, + { + "lane_id": "post_action_verifier", + "display_name": "處理後 verifier 與回滾 lane", + "owner_agent": "nemotron", + "risk_tier": "high", + "target_runtime": "post-action verifier readback", + "contract_status": "blocked_by_runtime_gate", + "current_live_count_24h": 0, + "enablement_required": [ + "canonical readback target", + "NemoTron replay regression", + "rollback work item template", + "verifier failure Telegram draft" + ], + "blocked_actions": [ + "live verifier execution", + "rollback work item write", + "cluster readback" + ] + } + ], + "automation_policies": [ + { + "risk_id": "low", + "display_name": "低風險", + "approval_required": false, + "auto_allowed_after_guard": true, + "current_execution_enabled": false, + "required_guards": [ + "idempotency key", + "no production write", + "dry-run hash", + "daily digest report" + ], + "reporting_rule": "成功可進日報摘要;失敗或異常才即時告警。" + }, + { + "risk_id": "medium", + "display_name": "中風險", + "approval_required": false, + "auto_allowed_after_guard": true, + "current_execution_enabled": false, + "required_guards": [ + "OpenClaw risk arbitration", + "post-action verifier", + "rollback / no-op evidence", + "failure-only Telegram" + ], + "reporting_rule": "成功進日報 / 週報;verifier 失敗、重試耗盡或資料不一致才升級。" + }, + { + "risk_id": "high", + "display_name": "高風險", + "approval_required": true, + "auto_allowed_after_guard": false, + "current_execution_enabled": false, + "required_guards": [ + "統帥審核", + "owner response", + "回滾計畫", + "正式驗證" + ], + "reporting_rule": "AI 只能提出方案與風險,不得自動執行。" + }, + { + "risk_id": "critical", + "display_name": "關鍵阻擋", + "approval_required": true, + "auto_allowed_after_guard": false, + "current_execution_enabled": false, + "required_guards": [ + "break-glass 明確批准", + "secret redaction", + "audit trail", + "人工值班窗口" + ], + "reporting_rule": "預設禁止自動執行,僅能產生批准包。" + } + ], + "report_delivery_cadence_gates": [ + { + "cadence_id": "daily", + "display_name": "AI Agent 日報", + "scheduler_source": "daily_report_scheduler_contract", + "telegram_digest_policy": "action-required + failure-only immediate", + "recipient_room": "AwoooI SRE 戰情室", + "dry_run_required": true, + "current_delivery_enabled": false, + "live_delivery_count_24h": 0 + }, + { + "cadence_id": "weekly", + "display_name": "AI Agent 週報", + "scheduler_source": "weekly_report_scheduler_contract", + "telegram_digest_policy": "weekly owner packet", + "recipient_room": "AwoooI SRE 戰情室", + "dry_run_required": true, + "current_delivery_enabled": false, + "live_delivery_count_24h": 0 + }, + { + "cadence_id": "monthly", + "display_name": "AI Agent 月報", + "scheduler_source": "monthly_report_scheduler_contract", + "telegram_digest_policy": "monthly strategy packet", + "recipient_room": "AwoooI SRE 戰情室", + "dry_run_required": true, + "current_delivery_enabled": false, + "live_delivery_count_24h": 0 + } + ], + "telegram_route_readiness": { + "canonical_room": "AwoooI SRE 戰情室", + "secret_ref": "SRE_GROUP_CHAT_ID", + "gateway_required": true, + "direct_bot_api_allowed": false, + "bot_log_out_allowed": false, + "legacy_routes_must_converge": true, + "telegram_gateway_queue_write_enabled": false, + "e2e_delivery_verified": false, + "delivery_receipt_write_enabled": false, + "blocked_route_count": 3 + }, + "agent_post_report_actions": [ + { + "agent_id": "openclaw", + "display_name": "OpenClaw", + "after_report_responsibility": "讀取報表後進行風險仲裁、判斷哪些方案只能提批准包、哪些中低風險可在 guard 通過後自動處理。", + "allowed_without_approval": [ + "產出風險評分", + "整理高風險批准包", + "拒收不符合 guard 的自動化提案" + ], + "blocked_until_approval": [ + "production write", + "provider route change", + "high risk execution" + ], + "live_action_count_24h": 0 + }, + { + "agent_id": "hermes", + "display_name": "Hermes", + "after_report_responsibility": "整理日週月報、生成 Telegram 摘要草案、彙整工作量與處置回執。", + "allowed_without_approval": [ + "產出報表草案", + "更新只讀治理 snapshot", + "彙整告警摘要" + ], + "blocked_until_approval": [ + "Telegram queue write", + "KM canonical write", + "workflow change" + ], + "live_action_count_24h": 0 + }, + { + "agent_id": "nemotron", + "display_name": "NemoTron", + "after_report_responsibility": "對報表建議做離線 replay、回歸測試與失敗模式標籤,作為是否升級到 runtime 的證據。", + "allowed_without_approval": [ + "sanitized replay 評估", + "fixture regression 標籤", + "候選模型比較摘要" + ], + "blocked_until_approval": [ + "live verifier execution", + "production route", + "paid API call" + ], + "live_action_count_24h": 0 + } + ], + "operator_decisions": [ + { + "decision_id": "report_scheduler_dry_run", + "display_name": "允許日週月報排程 dry-run", + "risk_tier": "low", + "owner_agent": "hermes", + "approval_required": false, + "status": "ready_for_review", + "why_it_matters": "先讓系統產生可重放的 report_run snapshot,統帥才能每天看見 Agent 工作量與風險變化。", + "next_safe_step": "建立 no-delivery dry-run runbook 與 hash readback。" + }, + { + "decision_id": "telegram_gateway_queue_dry_run", + "display_name": "批准 Telegram Gateway queue dry-run", + "risk_tier": "medium", + "owner_agent": "hermes", + "approval_required": true, + "status": "approval_required", + "why_it_matters": "Telegram 是告警必到通道,但任何 queue write 都可能造成訊息洗版或錯群。", + "next_safe_step": "只寫 dry-run queue preview,不送 Bot API,並驗證 SRE_GROUP_CHAT_ID 注入。" + }, + { + "decision_id": "delivery_receipt_read_model", + "display_name": "批准讀報回執 read model", + "risk_tier": "medium", + "owner_agent": "hermes", + "approval_required": true, + "status": "approval_required", + "why_it_matters": "統帥要知道 AI Agent 是否真的發出、送達、讀過報告;但回執寫入需避免暴露 chat / message raw payload。", + "next_safe_step": "先建立 redacted receipt schema 與 API readback,不接 live callback。" + }, + { + "decision_id": "ai_post_report_analysis_worker", + "display_name": "批准 AI 讀報後分析 worker dry-run", + "risk_tier": "medium", + "owner_agent": "openclaw", + "approval_required": true, + "status": "approval_required", + "why_it_matters": "AI Agent 必須在看完報告後提出方案,而不是只顯示圖表;但第一階段只能用 sanitized packet。", + "next_safe_step": "以 committed report snapshot 做 offline worker dry-run,不寫 production。" + }, + { + "decision_id": "medium_low_auto_worker_no_write", + "display_name": "批准中低風險自動處理 no-write worker", + "risk_tier": "high", + "owner_agent": "openclaw", + "approval_required": true, + "status": "approval_required", + "why_it_matters": "中低風險將來可自動處理,但啟動 worker 本身是 runtime 能力,必須先限制為 no-write / dry-run。", + "next_safe_step": "建立 allow-list、idempotency key、post-action verifier 與 failure-only Telegram 草案。" + }, + { + "decision_id": "sre_room_route_convergence", + "display_name": "批准 SRE 戰情室路由收斂", + "risk_tier": "high", + "owner_agent": "openclaw", + "approval_required": true, + "status": "approval_required", + "why_it_matters": "所有正式告警與報表應進 AwoooI SRE 戰情室,旁路 chat / direct send 會讓送達證據失真。", + "next_safe_step": "只建立批准包,不改 Alertmanager / Telegram route。" + }, + { + "decision_id": "post_action_verifier_live_readback", + "display_name": "批准 post-action verifier live readback", + "risk_tier": "high", + "owner_agent": "nemotron", + "approval_required": true, + "status": "blocked_by_runtime_gate", + "why_it_matters": "沒有 verifier 就不能讓自動處理真正修改正式環境;但 live readback 會觸碰 canonical runtime target。", + "next_safe_step": "先完成 fixture replay 與 read-only canonical target 清單。" + } + ], + "display_redaction_contract": { + "redaction_required": true, + "raw_report_payload_display_allowed": false, + "private_reasoning_display_allowed": false, + "secret_value_display_allowed": false, + "work_window_transcript_display_allowed": false, + "allowed_display_fields": [ + "已提交 snapshot 摘要", + "runtime lane 狀態", + "風險分級與批准需求", + "Telegram 路由邊界", + "live count 彙總" + ], + "blocked_display_fields": [ + "內部對話逐字稿", + "prompt 或思考鏈", + "secret / token / authorization header", + "raw Telegram payload", + "未遮蔽 message_id / chat_id" + ] + }, + "rollups": { + "runtime_lane_count": 7, + "report_cadence_gate_count": 3, + "operator_decision_count": 7, + "automation_policy_count": 4, + "ready_contract_count": 6, + "blocked_contract_count": 1, + "approval_required_decision_ids": [ + "ai_post_report_analysis_worker", + "delivery_receipt_read_model", + "medium_low_auto_worker_no_write", + "post_action_verifier_live_readback", + "sre_room_route_convergence", + "telegram_gateway_queue_dry_run" + ], + "current_enabled_count": 0, + "live_report_delivery_count": 0, + "live_ai_analysis_count": 0, + "live_medium_low_auto_execution_count": 0, + "telegram_gateway_queue_write_count": 0, + "high_risk_auto_execution_count": 0 + } +} diff --git a/docs/schemas/ai_agent_report_runtime_readiness_v1.schema.json b/docs/schemas/ai_agent_report_runtime_readiness_v1.schema.json new file mode 100644 index 000000000..5290bb0d4 --- /dev/null +++ b/docs/schemas/ai_agent_report_runtime_readiness_v1.schema.json @@ -0,0 +1,329 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://awoooi.wooo.work/schemas/ai_agent_report_runtime_readiness_v1.schema.json", + "title": "AI Agent Report Runtime Readiness v1", + "type": "object", + "required": [ + "schema_version", + "generated_at", + "program_status", + "source_refs", + "activation_truth", + "runtime_lanes", + "automation_policies", + "report_delivery_cadence_gates", + "telegram_route_readiness", + "agent_post_report_actions", + "operator_decisions", + "display_redaction_contract", + "rollups" + ], + "properties": { + "schema_version": { "const": "ai_agent_report_runtime_readiness_v1" }, + "generated_at": { "type": "string" }, + "program_status": { + "type": "object", + "required": [ + "overall_completion_percent", + "current_priority", + "current_task_id", + "next_task_id", + "read_only_mode", + "runtime_authority", + "status_note" + ], + "properties": { + "overall_completion_percent": { "type": "integer", "minimum": 0, "maximum": 100 }, + "current_priority": { "enum": ["P0", "P1", "P2", "P3"] }, + "current_task_id": { "const": "P2-403L" }, + "next_task_id": { "type": "string" }, + "read_only_mode": { "const": true }, + "runtime_authority": { "const": "report_runtime_readiness_only_no_live_delivery_or_optimization" }, + "status_note": { "type": "string" } + }, + "additionalProperties": false + }, + "source_refs": { "type": "array", "items": { "type": "string" }, "minItems": 1 }, + "activation_truth": { + "type": "object", + "required": [ + "report_scheduler_contract_ready", + "telegram_gateway_queue_contract_ready", + "telegram_delivery_receipt_contract_ready", + "ai_readback_analysis_contract_ready", + "medium_low_auto_guard_contract_ready", + "high_risk_approval_gate_contract_ready", + "live_report_delivery_enabled", + "live_report_delivery_count_24h", + "telegram_gateway_queue_write_enabled", + "telegram_gateway_queue_write_count_24h", + "report_read_receipt_write_enabled", + "report_read_receipt_count_24h", + "ai_analysis_runtime_enabled", + "ai_analysis_runtime_count_24h", + "medium_low_auto_worker_enabled", + "medium_low_auto_execution_count_24h", + "production_optimization_enabled", + "production_optimization_count_24h", + "high_risk_auto_execution_enabled", + "high_risk_auto_execution_count_24h", + "truth_note" + ], + "properties": { + "report_scheduler_contract_ready": { "const": true }, + "telegram_gateway_queue_contract_ready": { "const": true }, + "telegram_delivery_receipt_contract_ready": { "const": true }, + "ai_readback_analysis_contract_ready": { "const": true }, + "medium_low_auto_guard_contract_ready": { "const": true }, + "high_risk_approval_gate_contract_ready": { "const": true }, + "live_report_delivery_enabled": { "const": false }, + "live_report_delivery_count_24h": { "const": 0 }, + "telegram_gateway_queue_write_enabled": { "const": false }, + "telegram_gateway_queue_write_count_24h": { "const": 0 }, + "report_read_receipt_write_enabled": { "const": false }, + "report_read_receipt_count_24h": { "const": 0 }, + "ai_analysis_runtime_enabled": { "const": false }, + "ai_analysis_runtime_count_24h": { "const": 0 }, + "medium_low_auto_worker_enabled": { "const": false }, + "medium_low_auto_execution_count_24h": { "const": 0 }, + "production_optimization_enabled": { "const": false }, + "production_optimization_count_24h": { "const": 0 }, + "high_risk_auto_execution_enabled": { "const": false }, + "high_risk_auto_execution_count_24h": { "const": 0 }, + "truth_note": { "type": "string" } + }, + "additionalProperties": false + }, + "runtime_lanes": { + "type": "array", + "minItems": 7, + "items": { + "type": "object", + "required": [ + "lane_id", + "display_name", + "owner_agent", + "risk_tier", + "target_runtime", + "contract_status", + "current_live_count_24h", + "enablement_required", + "blocked_actions" + ], + "properties": { + "lane_id": { + "enum": [ + "report_scheduler", + "telegram_gateway_queue", + "telegram_delivery_receipt", + "ai_post_report_analysis", + "medium_low_auto_guard", + "high_risk_approval", + "post_action_verifier" + ] + }, + "display_name": { "type": "string" }, + "owner_agent": { "enum": ["openclaw", "hermes", "nemotron"] }, + "risk_tier": { "enum": ["low", "medium", "high", "critical"] }, + "target_runtime": { "type": "string" }, + "contract_status": { "enum": ["ready_for_owner_review", "blocked_by_runtime_gate"] }, + "current_live_count_24h": { "const": 0 }, + "enablement_required": { "type": "array", "items": { "type": "string" }, "minItems": 1 }, + "blocked_actions": { "type": "array", "items": { "type": "string" }, "minItems": 1 } + }, + "additionalProperties": false + } + }, + "automation_policies": { + "type": "array", + "minItems": 4, + "items": { + "type": "object", + "required": [ + "risk_id", + "display_name", + "approval_required", + "auto_allowed_after_guard", + "current_execution_enabled", + "required_guards", + "reporting_rule" + ], + "properties": { + "risk_id": { "enum": ["low", "medium", "high", "critical"] }, + "display_name": { "type": "string" }, + "approval_required": { "type": "boolean" }, + "auto_allowed_after_guard": { "type": "boolean" }, + "current_execution_enabled": { "const": false }, + "required_guards": { "type": "array", "items": { "type": "string" }, "minItems": 1 }, + "reporting_rule": { "type": "string" } + }, + "additionalProperties": false + } + }, + "report_delivery_cadence_gates": { + "type": "array", + "minItems": 3, + "items": { + "type": "object", + "required": [ + "cadence_id", + "display_name", + "scheduler_source", + "telegram_digest_policy", + "recipient_room", + "dry_run_required", + "current_delivery_enabled", + "live_delivery_count_24h" + ], + "properties": { + "cadence_id": { "enum": ["daily", "weekly", "monthly"] }, + "display_name": { "type": "string" }, + "scheduler_source": { "type": "string" }, + "telegram_digest_policy": { "type": "string" }, + "recipient_room": { "type": "string" }, + "dry_run_required": { "const": true }, + "current_delivery_enabled": { "const": false }, + "live_delivery_count_24h": { "const": 0 } + }, + "additionalProperties": false + } + }, + "telegram_route_readiness": { + "type": "object", + "required": [ + "canonical_room", + "secret_ref", + "gateway_required", + "direct_bot_api_allowed", + "bot_log_out_allowed", + "legacy_routes_must_converge", + "telegram_gateway_queue_write_enabled", + "e2e_delivery_verified", + "delivery_receipt_write_enabled", + "blocked_route_count" + ], + "properties": { + "canonical_room": { "const": "AwoooI SRE 戰情室" }, + "secret_ref": { "const": "SRE_GROUP_CHAT_ID" }, + "gateway_required": { "const": true }, + "direct_bot_api_allowed": { "const": false }, + "bot_log_out_allowed": { "const": false }, + "legacy_routes_must_converge": { "const": true }, + "telegram_gateway_queue_write_enabled": { "const": false }, + "e2e_delivery_verified": { "const": false }, + "delivery_receipt_write_enabled": { "const": false }, + "blocked_route_count": { "type": "integer", "minimum": 0 } + }, + "additionalProperties": false + }, + "agent_post_report_actions": { + "type": "array", + "minItems": 3, + "items": { + "type": "object", + "required": [ + "agent_id", + "display_name", + "after_report_responsibility", + "allowed_without_approval", + "blocked_until_approval", + "live_action_count_24h" + ], + "properties": { + "agent_id": { "enum": ["openclaw", "hermes", "nemotron"] }, + "display_name": { "type": "string" }, + "after_report_responsibility": { "type": "string" }, + "allowed_without_approval": { "type": "array", "items": { "type": "string" }, "minItems": 1 }, + "blocked_until_approval": { "type": "array", "items": { "type": "string" }, "minItems": 1 }, + "live_action_count_24h": { "const": 0 } + }, + "additionalProperties": false + } + }, + "operator_decisions": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": [ + "decision_id", + "display_name", + "risk_tier", + "owner_agent", + "approval_required", + "status", + "why_it_matters", + "next_safe_step" + ], + "properties": { + "decision_id": { "type": "string" }, + "display_name": { "type": "string" }, + "risk_tier": { "enum": ["low", "medium", "high", "critical"] }, + "owner_agent": { "enum": ["openclaw", "hermes", "nemotron"] }, + "approval_required": { "type": "boolean" }, + "status": { "enum": ["ready_for_review", "blocked_by_runtime_gate", "approval_required"] }, + "why_it_matters": { "type": "string" }, + "next_safe_step": { "type": "string" } + }, + "additionalProperties": false + } + }, + "display_redaction_contract": { + "type": "object", + "required": [ + "redaction_required", + "raw_report_payload_display_allowed", + "private_reasoning_display_allowed", + "secret_value_display_allowed", + "work_window_transcript_display_allowed", + "allowed_display_fields", + "blocked_display_fields" + ], + "properties": { + "redaction_required": { "const": true }, + "raw_report_payload_display_allowed": { "const": false }, + "private_reasoning_display_allowed": { "const": false }, + "secret_value_display_allowed": { "const": false }, + "work_window_transcript_display_allowed": { "const": false }, + "allowed_display_fields": { "type": "array", "items": { "type": "string" }, "minItems": 1 }, + "blocked_display_fields": { "type": "array", "items": { "type": "string" }, "minItems": 1 } + }, + "additionalProperties": false + }, + "rollups": { + "type": "object", + "required": [ + "runtime_lane_count", + "report_cadence_gate_count", + "operator_decision_count", + "automation_policy_count", + "ready_contract_count", + "blocked_contract_count", + "approval_required_decision_ids", + "current_enabled_count", + "live_report_delivery_count", + "live_ai_analysis_count", + "live_medium_low_auto_execution_count", + "telegram_gateway_queue_write_count", + "high_risk_auto_execution_count" + ], + "properties": { + "runtime_lane_count": { "type": "integer", "minimum": 0 }, + "report_cadence_gate_count": { "type": "integer", "minimum": 0 }, + "operator_decision_count": { "type": "integer", "minimum": 0 }, + "automation_policy_count": { "type": "integer", "minimum": 0 }, + "ready_contract_count": { "type": "integer", "minimum": 0 }, + "blocked_contract_count": { "type": "integer", "minimum": 0 }, + "approval_required_decision_ids": { "type": "array", "items": { "type": "string" } }, + "current_enabled_count": { "const": 0 }, + "live_report_delivery_count": { "const": 0 }, + "live_ai_analysis_count": { "const": 0 }, + "live_medium_low_auto_execution_count": { "const": 0 }, + "telegram_gateway_queue_write_count": { "const": 0 }, + "high_risk_auto_execution_count": { "const": 0 } + }, + "additionalProperties": false + } + }, + "additionalProperties": false +} diff --git a/docs/superpowers/specs/2026-04-15-MASTER-ai-autonomous-flywheel-v2.md b/docs/superpowers/specs/2026-04-15-MASTER-ai-autonomous-flywheel-v2.md index ee82dee24..30c2b7d5e 100644 --- a/docs/superpowers/specs/2026-04-15-MASTER-ai-autonomous-flywheel-v2.md +++ b/docs/superpowers/specs/2026-04-15-MASTER-ai-autonomous-flywheel-v2.md @@ -634,7 +634,7 @@ Alert / Sentry / SigNoz / Gitea / Market Watch / Operator | `docs/evaluations/ai_agent_communication_learning_contract_2026-06-11.json` | 2026-06-11 committed snapshot;完成度 `35%`,runtime worker / DB migration / Telegram direct send 全部 false | | `apps/api/src/services/ai_agent_communication_learning_contract.py` | 只讀 loader;強制驗證 runtime / migration / Telegram / SDK / route 權限都未開 | | `GET /api/v1/agents/agent-communication-learning-contract` | 治理 API;只回傳 committed contract,不啟動 worker、不碰 DB/Redis、不呼叫外部服務 | -| `docs/evaluations/ai_agent_interaction_learning_proof_2026-06-11.json` + `GET /api/v1/agents/agent-interaction-learning-proof` | P2-403A / P2-403B / P2-403C / P2-403D / P2-403E / P2-403F / P2-403G / P2-403H / P2-403I / P2-403J 互動、接手、學習、成長、read model gate、Redis dry-run gate、learning writeback approval package、Telegram receipt approval package、owner-approved learning dry-run、fixture dry-run、runtime write gate review、post-write verifier package、runtime verifier evidence review、報表真相、日週月報、Agent 工作量、圖表化報告與風險自動化政策證據面;目前 live session、message、handoff、learning write、Gateway queue、Telegram send、report delivery、auto optimization、verifier execution 全部 `0`,下一步 P2-403K | +| `docs/evaluations/ai_agent_interaction_learning_proof_2026-06-11.json` + `GET /api/v1/agents/agent-interaction-learning-proof` | P2-403A / P2-403B / P2-403C / P2-403D / P2-403E / P2-403F / P2-403G / P2-403H / P2-403I / P2-403J / P2-403L 互動、接手、學習、成長、read model gate、Redis dry-run gate、learning writeback approval package、Telegram receipt approval package、owner-approved learning dry-run、fixture dry-run、runtime write gate review、post-write verifier package、runtime verifier evidence review、報表真相、日週月報、Agent 工作量、圖表化報告、風險自動化政策與報表 runtime readiness 證據面;目前 live session、message、handoff、learning write、Gateway queue、Telegram send、report delivery、auto optimization、verifier execution 全部 `0`,下一步 P2-403M | | `docs/evaluations/ai_agent_live_read_model_gate_2026-06-11.json` + `GET /api/v1/agents/agent-live-read-model-gate` | P2-403B AgentSession / Redis Streams live read model gate;定義 safe fields、Redis envelope、worker gate、rollback plan 與 no-write smoke,不連 DB、不讀寫 Redis、不啟動 worker | #### 3.2.1c 2026-06-11 AI Agent 主動營運委派與版本生命週期契約 @@ -719,7 +719,8 @@ Repo / registry / release notes / K8s / host / observability / backup evidence 14. 建立 runtime write gate review,固定雙重批准、dry-run hash、post-write verifier、rollback 與 redaction 欄位。✅ P2-403G 已完成;KM / PlayBook trust / timeline / replay score / Telegram live write 仍為 `0 / false`。 15. 建立 post-write verifier implementation package,固定 canonical readback、rollback lane、failure lane 與人工操作選項。✅ P2-403H 已完成;canonical readback、rollback work item、Telegram failure receipt 與 verifier execution 仍為 `0 / false`。 16. 建立 runtime verifier evidence implementation review,固定 implementation 前的 evidence checks、redaction review、rollback template、failure receipt template、NemoTron replay fixture 與人工操作選項。✅ P2-403I 已完成;verifier implementation、canonical readback、rollback work item、Telegram failure receipt、learning writeback 與 verifier execution 仍為 `0 / false`。 -17. 建立報表真相、日報、週報、月報、Agent 工作量、圖表化報告、AI 分析建議與高 / 中 / 低風險自動化 policy review。✅ P2-403J 已完成;report delivery、Telegram queue、AI analysis runtime、中低風險 auto worker、生產優化與 route change 仍為 `0 / false`。下一步 P2-403K unified report truth service / 中低風險 runtime guard / SRE 戰情室路由遷移批准包。 +17. 建立報表真相、日報、週報、月報、Agent 工作量、圖表化報告、AI 分析建議與高 / 中 / 低風險自動化 policy review。✅ P2-403J 已完成;report delivery、Telegram queue、AI analysis runtime、中低風險 auto worker、生產優化與 route change 仍為 `0 / false`。 +18. 建立報表派送、Telegram Gateway queue、讀報回執、AI 讀報後分析、中低風險自動處理、高風險審核與 post-action verifier 啟動前閘門。✅ P2-403L 已完成;live delivery、Gateway queue write、AI runtime worker、中低風險 auto worker、高風險自動執行與 production optimization 仍為 `0 / false`。下一步 P2-403M no-write dry-run / SRE 戰情室 Gateway queue 草案 / readback verifier。 #### 3.2.1d 2026-06-11 Agent 互動、學習與成長證據面 @@ -742,9 +743,10 @@ Repo / registry / release notes / K8s / host / observability / backup evidence | 檔案 / API | 用途 | |---|---| | `docs/schemas/ai_agent_interaction_learning_proof_v1.schema.json` | 互動、接手、學習、成長、Telegram receipt 與前端 redaction schema | -| `docs/evaluations/ai_agent_interaction_learning_proof_2026-06-11.json` | P2-403A + P2-403B + P2-403C + P2-403D + P2-403E + P2-403F + P2-403G + P2-403H + P2-403I + P2-403J committed snapshot;完成度 `100%`,live truth counts 全部 `0` | +| `docs/evaluations/ai_agent_interaction_learning_proof_2026-06-11.json` | P2-403A + P2-403B + P2-403C + P2-403D + P2-403E + P2-403F + P2-403G + P2-403H + P2-403I + P2-403J + P2-403L committed snapshot;完成度 `100%`,live truth counts 全部 `0` | | `docs/evaluations/ai_agent_report_truth_actionability_review_2026-06-12.json` + `GET /api/v1/agents/agent-report-truth-actionability-review` | P2-403J 報表真相與告警有效性審查;全 0 週報列為低可信可處置異常,日週月報需共用 truth gate,Telegram 正式告警需收斂到 AwoooI SRE 戰情室;不發 Telegram、不改 route、不讀 secret | | `docs/evaluations/ai_agent_report_automation_review_2026-06-12.json` + `GET /api/v1/agents/agent-report-automation-review` | P2-403J 日報 / 週報 / 月報、每個 Agent 工作量、圖表化報告、AI 分析建議與高 / 中 / 低風險自動化 policy review;高風險需人工審核,中低風險目前只定義 policy,不啟動 runtime auto worker | +| `docs/evaluations/ai_agent_report_runtime_readiness_2026-06-12.json` + `GET /api/v1/agents/agent-report-runtime-readiness` | P2-403L 報表派送、Telegram Gateway queue、讀報回執、AI 讀報後分析、中低風險自動處理、高風險審核與 post-action verifier 啟動前閘門;不排程實發、不寫 Gateway queue、不啟動 runtime worker、不執行生產優化 | | `apps/api/src/services/ai_agent_interaction_learning_proof.py` | 只讀 loader;強制 live flags / DB / Redis / Telegram / transcript / 私有推理全部關閉 | | `GET /api/v1/agents/agent-interaction-learning-proof` | 治理 API;只回傳證據面,不啟動 worker、不碰 live DB/Redis、不發 Telegram | | `docs/schemas/ai_agent_live_read_model_gate_v1.schema.json` | P2-403B live read model gate schema;強制 DB / Redis / worker / Telegram / learning writeback 仍需批准 | @@ -1877,6 +1879,13 @@ Phase 6 完成後 - 更新 `ai_agent_proactive_operations_contract_2026-06-11.json`:新增 rollout task `P2-403I`,blocked runtime actions 包含 runtime verifier implementation、canonical readback、rollback work item、Telegram failure receipt、runtime learning write 與 agent replay score write。 - 本波仍不實作或執行 verifier、不讀 canonical target、不寫 rollback work item、不發 Telegram、不寫 KM、不更新 PlayBook trust、不寫 timeline learning、不寫 replay score、不啟動 runtime worker、不讀取或輸出 secret;後續已由 P2-403J 接續處理報表真相、日週月報、Agent 工作量與風險自動化 policy review。 +### 2026-06-12 04:35 (台北) — §3.2 / §5 — 完成 P2-403L 報表派送與自動處理啟動前閘門 — 把「何時可啟動」拆成可審核 runtime lanes + +- 新增 `ai_agent_report_runtime_readiness_v1` schema / committed snapshot / loader / API / 測試,定義日週月報派送、Telegram Gateway queue、讀報回執、AI 讀報後分析、中低風險自動處理、高風險統帥審核與 post-action verifier 啟動前閘門。 +- `apps/web/src/app/[locale]/governance/tabs/automation-inventory-tab.tsx` 接入 `GET /api/v1/agents/agent-report-runtime-readiness`,治理頁顯示 7 個 runtime lane、3 個報表週期 gate、4 個風險政策、7 個 operator decision、SRE 戰情室路由 contract 與 live count。 +- 政策裁決:低 / 中風險可在 guard、dry-run、post-action verifier、rollback/no-op evidence 與 failure-only Telegram 草案都通過後自動處理;高 / 關鍵風險仍必須統帥或 owner 審核。 +- 本波仍不排程實發報告、不寫 Telegram Gateway queue、不呼叫 Bot API、不啟動 AI runtime worker、不啟動中低風險 auto worker、不執行生產優化、不讀 secret、不回傳工作視窗對話內容;下一步 P2-403M 才進 no-write dry-run / SRE 戰情室 Gateway queue 草案 / readback verifier。 + ### 2026-06-12 03:20 (台北) — §3.2 / §5 — 完成 P2-403J 日週月報與風險自動化 Review — 把報表可信度、Agent 工作量與高 / 中 / 低風險政策固定成可見報告 - 新增 `ai_agent_report_automation_review_v1` schema / committed snapshot / loader / API / 測試,定義日報、週報、月報、每個 Agent 工作量、圖表化報告、AI 分析建議與高 / 中 / 低風險自動化 policy review。