fix(agent): verify retry incident lifecycle
This commit is contained in:
@@ -46,6 +46,9 @@ def _closed_retry_terminal_row() -> dict[str, object]:
|
||||
"retry_receipt_schema_version": "ai_automation_stage_receipt_v1",
|
||||
"retry_receipt_stage_id": "retry_or_rollback",
|
||||
"retry_receipt_automation_run_id": run_id,
|
||||
"retry_receipt_incident_id": "INC-RETRY-1",
|
||||
"retry_receipt_failed_apply_op_id": apply_op_id,
|
||||
"retry_receipt_retry_op_id": retry_op_id,
|
||||
"retry_terminal_schema_version": "ansible_controlled_retry_terminal_v2",
|
||||
"terminal_type": "no_write_replay_passed_waiting_repair_candidate",
|
||||
"retry_attempt": "1",
|
||||
@@ -77,6 +80,12 @@ def _closed_retry_terminal_row() -> dict[str, object]:
|
||||
"no_write_replay_passed_waiting_repair_candidate"
|
||||
),
|
||||
"incident_no_write_terminal": "true",
|
||||
"incident_lifecycle_event_id": "alert-lifecycle-retry-1",
|
||||
"incident_lifecycle_incident_id": "INC-RETRY-1",
|
||||
"incident_lifecycle_event_type": "EXECUTION_COMPLETED",
|
||||
"incident_lifecycle_success": "false",
|
||||
"incident_lifecycle_automation_run_id": run_id,
|
||||
"incident_lifecycle_apply_op_id": apply_op_id,
|
||||
"learning_operation_id": "learning-retry-1",
|
||||
"learning_status": "success",
|
||||
"learning_automation_run_id": run_id,
|
||||
@@ -3444,6 +3453,9 @@ def test_retry_rollback_terminal_closes_from_same_run_public_safe_receipts():
|
||||
assert terminal["status"] == "verified_no_write_terminal"
|
||||
assert terminal["closed"] is True
|
||||
assert terminal["automation_run_id"] == "retry-run-1"
|
||||
assert terminal["incident_lifecycle_event_id"] == (
|
||||
"alert-lifecycle-retry-1"
|
||||
)
|
||||
assert terminal["retry_attempt"] == 1
|
||||
assert terminal["max_retry_attempts"] == 1
|
||||
assert terminal["retry_backoff_seconds"] == {"min": 15, "max": 30}
|
||||
@@ -3509,9 +3521,9 @@ def test_retry_rollback_terminal_rejects_unbounded_retry_or_unverified_rollback(
|
||||
assert terminal["operation_boundaries"]["verified_rollback_terminal"] is False
|
||||
|
||||
|
||||
def test_retry_rollback_terminal_requires_durable_incident_stage_receipt():
|
||||
def test_retry_rollback_terminal_requires_immutable_incident_lifecycle():
|
||||
row = _closed_retry_terminal_row()
|
||||
row["incident_receipt_durable"] = "false"
|
||||
row["incident_lifecycle_event_id"] = None
|
||||
|
||||
terminal = build_runtime_receipt_readback_from_rows(
|
||||
retry_terminal_latest_rows=[row]
|
||||
@@ -3525,3 +3537,4 @@ def test_retry_rollback_terminal_requires_durable_incident_stage_receipt():
|
||||
assert "incident_terminal_repository_readback_not_verified" in (
|
||||
terminal["active_blockers"]
|
||||
)
|
||||
assert terminal["operation_boundaries"]["explicit_no_write_terminal"] is False
|
||||
|
||||
@@ -274,6 +274,7 @@ def _autonomous_runtime_control_retry_rollback_closed() -> dict:
|
||||
"failed_apply_op_id": "failed-apply-p0-005",
|
||||
"retry_op_id": "retry-op-p0-005",
|
||||
"incident_id": "INC-P0-005",
|
||||
"incident_lifecycle_event_id": "alert-lifecycle-p0-005",
|
||||
"catalog_id": "ansible:awoooi-auto-repair-canary",
|
||||
"terminal_type": "no_write_replay_passed_waiting_repair_candidate",
|
||||
"incident_status": "MITIGATING",
|
||||
@@ -2371,6 +2372,9 @@ def test_ai_automation_retry_rollback_terminal_advances_order() -> None:
|
||||
)
|
||||
assert retry["completion_evidence"]["retry_attempt"] == 1
|
||||
assert retry["completion_evidence"]["max_retry_attempts"] == 1
|
||||
assert retry["completion_evidence"]["incident_lifecycle_event_id"] == (
|
||||
"alert-lifecycle-p0-005"
|
||||
)
|
||||
assert retry["completion_evidence"]["retry_backoff_seconds"] == {
|
||||
"min": 15,
|
||||
"max": 30,
|
||||
|
||||
Reference in New Issue
Block a user