fix(automation): enforce durable alert closure
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 8m2s
CD Pipeline / post-deploy-checks (push) Successful in 2m22s

Restore D037 durable incident readback without weakening database failure semantics.

Fence Agent99 dispatch and terminal learning to canonical identities, durable leases, verifier receipts, and reconciler-owned checkpoints.

Drain backup and restore legacy receipts in bounded cohorts with strict transport, claim, projection, and no-false-green controls.

Keep SSH service refusal visible while separating it from broker network-policy reachability.
This commit is contained in:
ogt
2026-07-14 09:40:53 +08:00
parent 72a167a322
commit 6cf8429d17
56 changed files with 15100 additions and 227 deletions

View File

@@ -465,6 +465,37 @@ 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: