fix(alerts): prevent executor queue starvation
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 2m32s
CD Pipeline / build-and-deploy (push) Successful in 6m50s
CD Pipeline / post-deploy-checks (push) Successful in 2m22s

This commit is contained in:
ogt
2026-07-11 13:23:40 +08:00
parent 0f67494cf9
commit f0f6eee7a5
6 changed files with 42 additions and 3 deletions

View File

@@ -2832,6 +2832,8 @@ def test_ansible_claim_query_honors_bounded_execution_priority_before_fifo() ->
source = inspect.getsource(claim_pending_check_modes)
assert "candidate.input ->> 'work_item_id' LIKE 'P0-%'" in source
assert "alert_webhook_controlled_router" in source
assert "ELSE 30" in source
assert "candidate.input ->> 'execution_priority'" in source
assert "LEAST(" in source
assert "100" in source

View File

@@ -117,7 +117,10 @@ async def test_webhook_router_writes_queue_receipt_without_side_effect(
)
append = AsyncMock()
async def queue(**_kwargs):
queue_kwargs: dict = {}
async def queue(**kwargs):
queue_kwargs.update(kwargs)
return {
"schema_version": "ai_decision_controlled_executor_handoff_v1",
"status": "controlled_check_mode_queued",
@@ -149,8 +152,11 @@ async def test_webhook_router_writes_queue_receipt_without_side_effect(
assert handoff["queued"] is True
assert handoff["side_effect_performed"] is False
assert handoff["execution_priority"] == 30
assert queue_kwargs["proposal_data"]["execution_priority"] == 30
append.assert_awaited_once()
assert append.await_args.kwargs["context"]["side_effect_performed"] is False
assert append.await_args.kwargs["context"]["execution_priority"] == 30
@pytest.mark.asyncio

View File

@@ -62,6 +62,12 @@ def test_execution_broker_is_only_workload_with_ssh_transport() -> None:
assert "mountPath: /etc/ssh-mcp/known_hosts" in manifest
assert "secretName: ssh-mcp-key" in manifest
deployment = yaml.safe_load(manifest)
broker_env = {
item["name"]: item.get("value")
for item in deployment["spec"]["template"]["spec"]["containers"][0]["env"]
}
assert broker_env["AWOOOP_ANSIBLE_CHECK_MODE_INTERVAL_SECONDS"] == "60"
assert broker_env["AWOOOP_ANSIBLE_CHECK_MODE_BATCH_LIMIT"] == "3"
ssh_volume = next(
volume
for volume in deployment["spec"]["template"]["spec"]["volumes"]