fix(agent99): move dispatch reconciler to signal worker

This commit is contained in:
ogt
2026-07-14 09:56:29 +08:00
parent 26ef7de7e2
commit 5cae7c93cf
3 changed files with 113 additions and 34 deletions

View File

@@ -465,37 +465,6 @@ async def lifespan(_app: FastAPI) -> AsyncGenerator[None, None]:
handoff="awoooi-worker deployment owns Redis stream consumption",
)
# Agent99 durable dispatch outcome reconciler. The worker reads only the
# authenticated public-safe relay outcome and closes the same PG run after
# verifier, KM/PlayBook, Telegram, and incident receipts are durable.
if (
settings.AGENT99_SRE_ALERT_RELAY_URL
and settings.AGENT99_SRE_ALERT_RELAY_TOKEN
):
try:
from src.jobs.agent99_controlled_dispatch_reconciler_job import (
run_agent99_controlled_dispatch_reconciler_loop,
)
scheduled_task = schedule_api_background_task(
run_agent99_controlled_dispatch_reconciler_loop()
)
logger.info(
"agent99_controlled_dispatch_reconciler_schedule_evaluated",
scheduled_in_process=scheduled_task is not None,
interval_seconds=15,
)
except Exception as exc:
logger.warning(
"agent99_controlled_dispatch_reconciler_schedule_failed",
error=str(exc),
)
else:
logger.info(
"agent99_controlled_dispatch_reconciler_skipped",
reason="authenticated_relay_not_configured",
)
# BUG-005 修復 2026-04-11: 啟動時掃描 Redis 中所有 state=ready 但未送 Telegram 的 token
# dedup TTL 10 分鐘過期後ready decisions 就沒有補送機制 → 長期卡在 ready 無人審核
try: