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"

View File

@@ -2,6 +2,7 @@ from __future__ import annotations
# ruff: noqa: E402
import asyncio
import inspect
import json
import os
import urllib.error
@@ -2731,6 +2732,18 @@ def test_awoooi_priority_work_order_readback_endpoint_returns_static_fallback_on
assert "priority_work_order_live_overlay_timeout" in data["active_blockers"]
def test_priority_live_overlay_resolves_ai_runtime_before_secondary_sources() -> None:
source = inspect.getsource(
agents._build_awoooi_priority_work_order_readback_with_live_overlays
)
runtime_call = (
"await build_ai_agent_autonomous_runtime_control_with_live_readback()"
)
assert source.index(runtime_call) < source.index("await asyncio.gather(")
assert 'priority_work_order_live_overlay_status"] = "ready"' in source
def test_awoooi_priority_work_order_readback_endpoint_redacts_ai_loop_queue(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,