fix(agent): retain correlated runtime stage receipts
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 1m20s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled

This commit is contained in:
ogt
2026-07-10 18:10:54 +08:00
parent 94143d364f
commit 4e9615c2c3
2 changed files with 50 additions and 6 deletions

View File

@@ -7,6 +7,8 @@ from src.services.ai_agent_autonomous_runtime_control import (
_RUNTIME_ALERT_OPERATION_COUNTS_SQL,
_RUNTIME_ALERTMANAGER_EVENT_COUNTS_SQL,
_RUNTIME_GROUPED_ALERT_EVENT_COUNTS_SQL,
_RUNTIME_OPERATION_LATEST_DIRECT_SQL,
_RUNTIME_OPERATION_LATEST_SQL,
_RUNTIME_PLAYBOOK_TRUST_COUNTS_FALLBACK_SQL,
_RUNTIME_TELEGRAM_COUNTS_SQL,
_RUNTIME_TELEGRAM_LATEST_SQL,
@@ -2360,6 +2362,14 @@ def test_runtime_telegram_receipt_queries_include_alert_notifications() -> None:
assert "controlled_apply_result" in _RUNTIME_TELEGRAM_LATEST_SQL
def test_runtime_operation_latest_queries_prioritize_latest_apply_chain() -> None:
for sql in (_RUNTIME_OPERATION_LATEST_SQL, _RUNTIME_OPERATION_LATEST_DIRECT_SQL):
assert "WITH latest_apply_chain AS" in sql
assert "operation_row.op_id::text = latest_apply_chain.apply_op_id" in sql
assert "operation_row.op_id::text = latest_apply_chain.check_mode_op_id" in sql
assert "operation_row.op_id::text = latest_apply_chain.candidate_op_id" in sql
def test_runtime_execution_loop_ledger_does_not_mix_unrelated_check_mode_rows():
apply_op_id = "db3f12ce-08fc-4289-8c93-338305d5850c"
readback = build_runtime_receipt_readback_from_rows(