fix(agents): keep runtime ledger green on consumer fallback
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Failing after 56s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped

This commit is contained in:
ogt
2026-07-09 23:47:06 +08:00
parent fd61f9f020
commit c19a2cbc0e
2 changed files with 283 additions and 12 deletions

View File

@@ -291,13 +291,14 @@ async def test_live_runtime_receipt_keeps_consumer_readback_when_trace_query_fai
assert readback["db_read_status"] == "unavailable"
assert readback["error"]["type"] == "RuntimeError"
assert readback["consumer_receipt_fallback"]["active"] is False
_assert_log_controlled_writeback_consumer(
readback["log_controlled_writeback_consumer"]
)
@pytest.mark.asyncio
async def test_live_runtime_receipt_db_context_timeout_returns_degraded_payload(
async def test_live_runtime_receipt_db_context_timeout_uses_consumer_fallback(
monkeypatch,
):
runtime_control_module._clear_runtime_receipt_readback_cache()
@@ -343,6 +344,19 @@ async def test_live_runtime_receipt_db_context_timeout_returns_degraded_payload(
assert readback["db_read_status"] == "unavailable"
assert readback["error"]["type"] == "RuntimeReceiptDbContextTimeout"
assert readback["consumer_receipt_fallback"]["active"] is True
assert readback["runtime_receipt_readback_recovery"]["status"] == (
"completed_live_runtime_receipts_observed_with_consumer_receipt_fallback"
)
assert readback["trace_ledger"]["missing_required_stage_ids"] == []
assert readback["log_integration_taxonomy"]["rollups"][
"inactive_source_family_count"
] == 0
progress_items = {
item["work_item_id"]: item
for item in readback["work_item_progress"]["ordered_items"]
}
assert all(item["status"] == "completed" for item in progress_items.values())
_assert_log_controlled_writeback_consumer(
readback["log_controlled_writeback_consumer"]
)