fix(api): backfill ansible repair candidates
All checks were successful
Code Review / ai-code-review (push) Successful in 20s
CD Pipeline / tests (push) Successful in 1m45s
CD Pipeline / build-and-deploy (push) Successful in 4m46s
CD Pipeline / post-deploy-checks (push) Successful in 1m43s

This commit is contained in:
Your Name
2026-06-27 13:36:23 +08:00
parent bdee5e97e1
commit f88d89fc38
5 changed files with 353 additions and 2 deletions

View File

@@ -558,9 +558,25 @@ async def lifespan(_app: FastAPI) -> AsyncGenerator[None, None]:
except Exception as e:
logger.warning("incident_lifecycle_reconciler_schedule_failed", error=str(e))
# AwoooP Ansible candidate backfill worker.
# 把近期已命中 allowlisted PlayBook、但缺 durable candidate row 的事故補進
# ansible_candidate_matched 佇列,讓 check-mode worker 可以主動認領。
try:
from src.jobs.awooop_ansible_candidate_backfill_job import (
run_awooop_ansible_candidate_backfill_loop,
)
asyncio.create_task(run_awooop_ansible_candidate_backfill_loop())
logger.info(
"awooop_ansible_candidate_backfill_worker_scheduled",
enabled=settings.ENABLE_AWOOOP_ANSIBLE_CANDIDATE_BACKFILL_WORKER,
interval_seconds=settings.AWOOOP_ANSIBLE_CANDIDATE_BACKFILL_INTERVAL_SECONDS,
)
except Exception as e:
logger.warning("awooop_ansible_candidate_backfill_worker_schedule_failed", error=str(e))
# AwoooP Ansible check-mode worker.
# 執行 ansible-playbook --check --diff 並回寫 automation_operation_log
# apply 仍必須走 approval gate本 worker 不寫 auto_repair_executions
# 執行 ansible-playbook --check --diff 並回寫 automation_operation_log
# 通過後由 controlled apply guard 依 catalog/risk/verifier 進一步接管
try:
from src.jobs.awooop_ansible_check_mode_job import (
run_awooop_ansible_check_mode_loop,