Serialize only incident-reconciling completions in `agent-provider-health.yml` so its queue stops overflowing

Merged
DS
1mo ago
+519-62

This pull request was posted by Claude Code using claude-opus-5-5 on behalf of David.

Why we make these changes

agent-provider-health.yml queued every completion of every Z.ai workflow in one workflow-level group with queue: max. CI Review alone completes several times a minute, so the group hit GitHub's 100-pending limit and new runs were cancelled in 3 s (run 39816847357): 129 of the last 500 runs. Those runs lost their reconciliation. The hourly recovery waited behind the queue: run 39814375293 was created at 16:28 and finished at 17:26. Open provider incidents block every Z.ai workflow, so late recovery extends outages.

Almost no completion needs serializing. Of 60 recent successful monitor runs, 53 stopped at "blocked by an existing incident", 2 at "concluded success", and 5 had no health artifact. None read the incident list.

  • A new triage job runs for each completion without a concurrency group. It runs agent_provider_health.py triage, which stops before it reads incidents and outputs reconcile=true when the outcome needs them.
  • The monitor job now holds the group at job level and runs only those outcomes plus scheduled and manual recovery. A job skipped by if: takes no queue slot. GitHub does not document this; .github/workflows/AGENTS.md cites the CI Review runs that show it.
  • Scheduled recovery stays in the group: it can open the same provider/zai incident a completion opens.
  • triage gets only actions: read and contents: read. The guard pins it to the monitor's checkout, downloads and controller inputs, so the two cannot classify different data.

New public surface

none

User-visible behavior

CompletionBeforeAfter
Healthy, or blocked by an open incidentWaits in the group for a no-optriage only; monitor skipped
Needs an incident (failed host stage, typed failure, blocked quota with no incident)Waits in the grouptriage, then queued monitor reconciles
Hourly or manual recoveryBehind every queued completionBehind incident work only

Verification

What changes for existing users

Nothing; this is repository CI tooling.

PR decisions

2026-10-22 · triage job instead of an event-only job if: · iter -

  • Decision: Unserialized triage job runs the controller and hands over only outcomes that reach the incident list
  • Why: CI Review's provider_health job runs on every run and ineligible runs conclude success, so no workflow_run field marks a completion with nothing to reconcile; a conclusion filter would drop blocked-quota incident creation
  • Source: https://github.com/pydantic/pydantic-ai/actions/runs/39816847357

2026-10-22 · scheduled recovery shares the reconciliation group · iter -

2026-10-22 · triage is a subcommand, not a monitor flag · iter -

  • Decision: agent_provider_health.py triage shares _monitor_command via functools.partial(triage=True)
  • Why: 31 tests build monitor Namespaces by hand; a new monitor attribute breaks them and any added by PR 11041
  • Source: https://github.com/pydantic/pydantic-ai/pull/11041

2026-10-22 · pre-push review 1 of 3 at e0013a7d4d9fd6b35374b798154564fd1246b5df · iter -

2026-10-22 · pre-push review 1 of 3 at e0013a7d4d9fd6b35374b798154564fd1246b5df · iter -

2026-10-22 · pre-push review 2 of 3 at 6f7876227ced893054dd2490f9979d6172b48184 · iter -

2026-10-22 · pre-push review 2 of 3 at 6f7876227ced893054dd2490f9979d6172b48184 · iter -

2026-10-22 · pre-push review 3 of 3 at 7245a8dd6e54b291713c75ea244e5ca8fa6e8b79 · iter -

2026-10-22 · pre-push review 3 of 3 at 7245a8dd6e54b291713c75ea244e5ca8fa6e8b79 · iter -

2026-10-22 · CodeQL cache-poisoning alert 44 is a false positive · iter -

  • Decision: Leave triage read-only; alert 44 needs a false-positive dismissal by David
  • Why: CachePoisoningViaPoisonableStep skips privileged jobs (not job.isPrivileged()); the identical monitor steps escape it only through issues: write; triage runs only on workflow_run and parses artifacts as data
  • Source: https://github.com/pydantic/pydantic-ai/pull/11051#discussion_r4352088760

2026-10-22 · CodeQL alert 44 dismissed · iter -

2026-10-22 · no closing issue link · iter -

2026-10-22 · second opinion: douwebot · iter -

2026-10-22 · douwebot anchor suggestion declined · iter -

2026-10-22 · merge of main after 11048 at f7908295f9 · iter -

  • Decision: Resolved the provider-health-* AGENTS.md table row keeping both sides; pushed without pre-push review
  • Why: review budget exhausted (3 of 3); the conflict was one prose row; scripts auto-merged and the guard passes on the merged tree
  • Source: https://github.com/pydantic/pydantic-ai/pull/11051

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.