Stop repeated agent workflow failures with shared provider health gates

Merged
DS
2mo ago
+4794-223

This pull request was posted by Codex Desktop using gpt-6-luna on behalf of David.

MiniMax failures continued across independent CI and scheduled runs because per-run request limits did not persist a stop condition. Add a shared provider-health gate and incident state so those events skip inference while a matching failure remains unresolved.

New public surface: none.

All 13 MiniMax workflows check native quota health and open incidents before activation. A non-model monitor creates one incident assigned to dsfaccini, with both agentic-workflows and pydanty:meta labels. Provider failures block the shared provider; execution failures block the affected workflow or stable task/revision. Repeated deliveries reuse the incident. Known quota windows recover only after the reset and a fresh healthy check; other incidents require explicit recovery.

 .github/workflows/pydantic-ai-pr-review.lock.yml :: workflow_run
+  └─ .github/scripts/agent_provider_health.py :: _check_command()
+      └─ unknown quota or matching incident → skip inference
   └─ .github/scripts/pydantic_ai_gh_aw_shim/cli.py :: run()
-      └─ terminal failure → generic repeated failure reports
+      └─ emit_result() → partial usage + typed provider failure
+ .github/workflows/agent-provider-health.yml :: monitor
+  └─ .github/scripts/agent_provider_health.py :: _monitor_command()
+      └─ _create_or_reuse_incident() → one assigned incident

Preserve partial usage on timeout and failure. Double the configured request limits: main agents 200 → 400, delegates 75 → 150, attention triage 25 → 50. Exclude operational alerts from automatic attention and @claude issue/comment entry points. Correlate downloaded artifacts with the current workflow run attempt so a blocked rerun cannot reuse stale agent output.

Verification: terminal shim failure → deduplicated assigned incident → cross-workflow block, native quota and secret-free gate artifacts, recovery boundaries, stale-attempt success control, and shim/workflow-policy/attention regression tests pass. All 13 lockfiles were compiled with the existing pinned gh-aw version. Strict script-project Pyright and commit hooks pass.

Existing library users see no API or runtime changes. Repository MiniMax automation fails closed when quota cannot be verified. Subscription accounts require MINIMAX_QUOTA_RESOURCE to match a verified native plan row; a native no-active-plan response falls back to the account-balance endpoint. See operator recovery.

The affected workflows remain manually disabled during containment. This controller never re-enables workflows; enable each deliberately after this change is merged and provider health is healthy. Rollout also requires Pydanty's webhook exclusion for bot-authored incidents carrying both operational labels, so creating an alert cannot start automatic triage.

Checklist

  • No breaking changes in accordance with the version policy.
  • Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver.
  • PR title is fit for the release changelog.