fix(agent): prioritize live closure readback
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 1m12s
CD Pipeline / build-and-deploy (push) Successful in 7m23s
CD Pipeline / post-deploy-checks (push) Successful in 1m53s

This commit is contained in:
ogt
2026-07-11 15:36:37 +08:00
parent 526cb5af8c
commit aba8ff474e
4 changed files with 61 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
import asyncio
import inspect
import pytest
@@ -3504,6 +3505,22 @@ def test_retry_rollback_terminal_fails_closed_on_run_mismatch_or_missing_proof()
assert "stderr_feed_back" not in retry_sql
def test_runtime_receipt_queries_prioritize_closure_and_bound_latest_window():
source = inspect.getsource(
runtime_control_module._load_ai_agent_autonomous_runtime_receipt_readback_uncached
)
assert source.index('"retry_terminal_latest"') < source.index(
'"operation_latest"'
)
assert source.index('"operation_latest"') < source.index(
'"operation_counts"'
)
assert ":lookback_hours * INTERVAL '1 hour'" in (
runtime_control_module._RUNTIME_OPERATION_LATEST_SQL
)
def test_retry_rollback_terminal_rejects_unbounded_retry_or_unverified_rollback():
row = _closed_retry_terminal_row()
row["max_retry_attempts"] = "99"