fix(agent): advance program ledger from runtime truth
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 1m21s
CD Pipeline / build-and-deploy (push) Has started running
CD Pipeline / post-deploy-checks (push) Has been cancelled

This commit is contained in:
ogt
2026-07-10 18:28:02 +08:00
parent da1c836c0b
commit e5417e383f
3 changed files with 141 additions and 7 deletions

View File

@@ -82,6 +82,28 @@ def _gitea_bundle_ready() -> dict:
}
def _autonomous_runtime_control_closed() -> dict:
return {
"generated_at": "2026-07-10T10:22:56+00:00",
"strict_runtime_completion": {
"schema_version": "ai_agent_strict_runtime_completion_v1",
"completion_percent": 100,
"required_stage_count": 7,
"present_stage_count": 7,
"missing_stage_ids": [],
"latest_flow_closed": True,
"latest_loop_closed": True,
"same_run_correlation": True,
"automation_run_id": "run-p0-001-closed",
"closed": True,
},
}
async def _autonomous_runtime_control_closed_async() -> dict:
return _autonomous_runtime_control_closed()
def test_awoooi_priority_work_order_readback_loader_returns_mainline_order():
payload = load_latest_awoooi_priority_work_order_readback()
@@ -1758,6 +1780,7 @@ def test_ai_automation_live_closure_readbacks_close_node_receipts():
verifier_readback=verifier,
consumer_readback=_consumer_readback_ready(),
telegram_alert_context_verifier_readback=_telegram_alert_context_verifier_ready(),
autonomous_runtime_control=_autonomous_runtime_control_closed(),
)
receipts_by_id = {
@@ -1797,6 +1820,22 @@ def test_ai_automation_live_closure_readbacks_close_node_receipts():
assert payload["summary"][
"ai_automation_telegram_alert_post_apply_verifier_ready"
] is True
program = payload["ai_automation_program_ledger"]
program_items = {item["id"]: item for item in program["work_items"]}
assert program["summary"]["next_work_item_id"] == "AIA-P0-002"
assert program["summary"]["completion_percent"] == 12
assert program_items["AIA-P0-001"]["status"] == "done"
assert program_items["AIA-P0-001"]["completion_evidence"] == {
"source": "agent-autonomous-runtime-control",
"generated_at": "2026-07-10T10:22:56+00:00",
"automation_run_id": "run-p0-001-closed",
"completion_percent": 100,
"required_stage_count": 7,
"present_stage_count": 7,
"same_run_correlation": True,
"latest_flow_closed": True,
"latest_loop_closed": True,
}
assert payload["summary"][
"ai_automation_telegram_alert_post_apply_verified_context_receipt_count"
] == 6
@@ -1835,6 +1874,11 @@ def test_awoooi_priority_work_order_readback_endpoint_returns_snapshot(
"load_latest_telegram_alert_learning_context_post_apply_verifier",
_telegram_alert_context_verifier_ready_async,
)
monkeypatch.setattr(
agents,
"build_ai_agent_autonomous_runtime_control_with_live_readback",
_autonomous_runtime_control_closed_async,
)
app = FastAPI()
app.include_router(router, prefix="/api/v1")
client = TestClient(app)