feat(agent): expose harbor receipt input contract
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 33s
CD Pipeline / build-and-deploy (push) Failing after 2m36s
CD Pipeline / post-deploy-checks (push) Has been skipped

This commit is contained in:
Your Name
2026-06-30 23:14:13 +08:00
parent b726289142
commit a7b79b7b20
5 changed files with 172 additions and 1 deletions

View File

@@ -106,6 +106,10 @@ def load_latest_ai_agent_log_controlled_writeback_executor_readback() -> dict[st
"current_blocker_local_recovery_package_count": sum(
1 for item in current_blocker_queue if item["controlled_recovery_package"]
),
"current_blocker_harbor_recovery_receipt_input_count": sum(
item["harbor_recovery_receipt_input_count"]
for item in current_blocker_queue
),
"runtime_dispatch_performed": False,
},
"active_blockers": active_blockers,
@@ -331,6 +335,13 @@ def _current_blocker_queue_item(recovery: dict[str, Any]) -> dict[str, Any]:
recovery.get("controlled_recovery_package") or ""
),
"post_apply_verifier": str(recovery.get("post_apply_verifier") or ""),
"harbor_recovery_receipt_endpoint": (
"/api/v1/agents/harbor-registry-controlled-recovery-receipt"
),
"harbor_recovery_receipt_inputs": _harbor_recovery_receipt_inputs(),
"harbor_recovery_receipt_input_count": len(
_harbor_recovery_receipt_inputs()
),
"controlled_local_console_execution_plan": _list_of_dicts(
recovery.get("controlled_local_console_execution_plan")
),
@@ -355,6 +366,61 @@ def _current_blocker_queue_item(recovery: dict[str, Any]) -> dict[str, Any]:
}
def _harbor_recovery_receipt_inputs() -> list[dict[str, Any]]:
metadata_boundary = {
"metadata_only": True,
"raw_output_allowed": False,
"secret_value_allowed": False,
}
return [
{
"input_id": "gitea_actions_queue_readback",
"source": "read-public-gitea-actions-queue.py --json",
"required_when": "before_and_after_110_controlled_recovery",
"purpose": (
"classify cd run status, harbor repair waiting state, "
"awoooi-host no-matching runner, and stale job payloads"
),
**metadata_boundary,
},
{
"input_id": "ssh_local_repair_output",
"source": "recover-110-control-path-and-harbor-local.sh --check/apply",
"required_when": "after_diagnose_ssh_publickey_phase",
"purpose": "prove 110 ssh control-channel metadata and permissions",
**metadata_boundary,
},
{
"input_id": "watchdog_check_output",
"source": "harbor-watchdog.sh --check",
"required_when": "before_harbor_repair_once_phase",
"purpose": "prove check-mode harbor local registry /v2/ state",
**metadata_boundary,
},
{
"input_id": "watchdog_repair_output",
"source": "harbor-watchdog.sh --repair-once",
"required_when": "only_if_check_mode_proves_v2_unhealthy",
"purpose": "prove bounded repair-once result without daemon restart",
**metadata_boundary,
},
{
"input_id": "public_registry_v2_http_status",
"source": "public registry /v2/ verifier",
"required_when": "post_apply_verifier",
"purpose": "prove external registry route is 200/401 before CD retry",
**metadata_boundary,
},
{
"input_id": "internal_registry_v2_http_status",
"source": "internal 110 registry /v2/ verifier",
"required_when": "post_apply_verifier",
"purpose": "prove local registry route is 200/401 before CD retry",
**metadata_boundary,
},
]
def _list_of_dicts(value: Any) -> list[dict[str, Any]]:
if not isinstance(value, list):
return []

View File

@@ -533,6 +533,15 @@ def apply_ai_loop_current_blocker_execution_queue(
post_recovery_readback_commands = _strings(
first_item.get("post_recovery_readback_commands")
)
harbor_recovery_receipt_inputs = [
_dict(item)
for item in _list(first_item.get("harbor_recovery_receipt_inputs"))
]
harbor_recovery_receipt_input_ids = [
str(item.get("input_id") or "")
for item in harbor_recovery_receipt_inputs
if item.get("input_id")
]
forbidden_runtime_actions = _strings(first_item.get("forbidden_runtime_actions"))
external_blocker = str(first_item.get("external_control_path_blocker") or "")
runtime_write_gate = str(first_item.get("runtime_write_gate") or "")
@@ -559,6 +568,12 @@ def apply_ai_loop_current_blocker_execution_queue(
state["ai_loop_current_blocker_post_recovery_readback_command_count"] = len(
post_recovery_readback_commands
)
state["ai_loop_current_blocker_harbor_recovery_receipt_input_count"] = len(
harbor_recovery_receipt_inputs
)
state["ai_loop_current_blocker_harbor_recovery_receipt_input_ids"] = (
harbor_recovery_receipt_input_ids
)
state["ai_loop_current_blocker_forbidden_runtime_action_count"] = len(
forbidden_runtime_actions
)
@@ -610,6 +625,18 @@ def apply_ai_loop_current_blocker_execution_queue(
evidence["ai_loop_current_blocker_post_recovery_readback_commands"] = (
post_recovery_readback_commands
)
evidence["ai_loop_current_blocker_harbor_recovery_receipt_endpoint"] = str(
first_item.get("harbor_recovery_receipt_endpoint") or ""
)
evidence["ai_loop_current_blocker_harbor_recovery_receipt_input_count"] = len(
harbor_recovery_receipt_inputs
)
evidence["ai_loop_current_blocker_harbor_recovery_receipt_input_ids"] = (
harbor_recovery_receipt_input_ids
)
evidence["ai_loop_current_blocker_harbor_recovery_receipt_inputs"] = (
harbor_recovery_receipt_inputs
)
evidence["ai_loop_current_blocker_forbidden_runtime_actions"] = (
forbidden_runtime_actions
)
@@ -651,7 +678,8 @@ def apply_ai_loop_current_blocker_execution_queue(
"P0-006-AI-LOOP-CURRENT-BLOCKER-EXECUTION-QUEUE: execute the "
f"{blocker_id} queue item through 110 control-path readback, "
f"{len(local_console_plan)} ordered local-console phases, post-recovery "
"readback commands, and metadata-only KM/RAG/MCP/PlayBook writeback."
"readback commands, Harbor receipt inputs, and metadata-only "
"KM/RAG/MCP/PlayBook writeback."
),
(
"P0-006-HARBOR-REGISTRY-CONTROLLED-RECOVERY-PREFLIGHT: after the "
@@ -684,6 +712,12 @@ def apply_ai_loop_current_blocker_execution_queue(
summary["ai_loop_current_blocker_post_recovery_readback_command_count"] = len(
post_recovery_readback_commands
)
summary["ai_loop_current_blocker_harbor_recovery_receipt_input_count"] = len(
harbor_recovery_receipt_inputs
)
summary["ai_loop_current_blocker_harbor_recovery_receipt_input_ids"] = (
harbor_recovery_receipt_input_ids
)
summary["ai_loop_current_blocker_forbidden_runtime_action_count"] = len(
forbidden_runtime_actions
)