Serialize only incident-reconciling completions in `agent-provider-health.yml` so its queue stops overflowing
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
triagejob runs for each completion without a concurrency group. It runsagent_provider_health.py triage, which stops before it reads incidents and outputsreconcile=truewhen the outcome needs them. - The
monitorjob now holds the group at job level and runs only those outcomes plus scheduled and manual recovery. A job skipped byif:takes no queue slot. GitHub does not document this;.github/workflows/AGENTS.mdcites the CI Review runs that show it. - Scheduled recovery stays in the group: it can open the same
provider/zaiincident a completion opens. triagegets onlyactions: readandcontents: 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
| Completion | Before | After |
|---|---|---|
| Healthy, or blocked by an open incident | Waits in the group for a no-op | triage only; monitor skipped |
| Needs an incident (failed host stage, typed failure, blocked quota with no incident) | Waits in the group | triage, then queued monitor reconciles |
| Hourly or manual recovery | Behind every queued completion | Behind incident work only |
Verification
triagehands over exactly the completionsmonitoropens incidents for, and never reads incidents:test_triage_hands_over_exactly_the_completions_monitor_opens_incidents_fortriagecannot reach recovery:test_triage_cannot_reach_recovery- The guard rejects the overflowing workflow-level group, a
triagegroup, an ungated monitor, a privilegedtriage, andtriageinputs that drift from the monitor's:test_provider_health_monitor_serializes_only_triaged_incident_work
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 -
- Decision: Keep schedule and dispatch in agent-provider-health-reconciliation
- Why: _reconcile_recovery opens provider/zai quota incidents, the same scope a completion opens; a separate group allows duplicates
- Source: https://github.com/pydantic/pydantic-ai/tree/provider-health-queue-overflow
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 -
- Decision: reserved
- Why: tree 272d9795f9f13ceab3d8d3431bb26fab710f29e4; full branch 767f5267778e24a6f227dbf4f91017aedc43e220..e0013a7d4d9fd6b35374b798154564fd1246b5df
- Source: https://github.com/pydantic/pydantic-ai/tree/provider-health-queue-overflow
2026-10-22 · pre-push review 1 of 3 at e0013a7d4d9fd6b35374b798154564fd1246b5df · iter -
- Decision: remediated: guard pins triage inputs to monitor inputs; skipped-job queue evidence cited in AGENTS.md; concurrency clause and --run-id tests tightened
- Why: tree 272d9795f9f13ceab3d8d3431bb26fab710f29e4; full branch 767f5267778e24a6f227dbf4f91017aedc43e220..e0013a7d4d9fd6b35374b798154564fd1246b5df; first review
- Source: https://github.com/pydantic/pydantic-ai/tree/provider-health-queue-overflow
2026-10-22 · pre-push review 2 of 3 at 6f7876227ced893054dd2490f9979d6172b48184 · iter -
- Decision: reserved
- Why: tree a2ed7fa9c12ab186afa1a174edb98459cc08f556; delta e0013a7d4d9fd6b35374b798154564fd1246b5df..6f7876227ced893054dd2490f9979d6172b48184 plus review 1 findings
- Source: https://github.com/pydantic/pydantic-ai/tree/provider-health-queue-overflow
2026-10-22 · pre-push review 2 of 3 at 6f7876227ced893054dd2490f9979d6172b48184 · iter -
- Decision: remediated: AGENTS.md evidence sentence names the queued job correctly; guard test covers triage conclusion run-arg and env drift
- Why: tree a2ed7fa9c12ab186afa1a174edb98459cc08f556; delta e0013a7d4d9fd6b35374b798154564fd1246b5df..6f7876227ced893054dd2490f9979d6172b48184; all review 1 findings verified fixed
- Source: https://github.com/pydantic/pydantic-ai/tree/provider-health-queue-overflow
2026-10-22 · pre-push review 3 of 3 at 7245a8dd6e54b291713c75ea244e5ca8fa6e8b79 · iter -
- Decision: reserved
- Why: tree 47c085a2eb79aaf54c3c19e01e0e0527624b3838; delta 6f7876227ced893054dd2490f9979d6172b48184..7245a8dd6e54b291713c75ea244e5ca8fa6e8b79 plus review 2 findings
- Source: https://github.com/pydantic/pydantic-ai/tree/provider-health-queue-overflow
2026-10-22 · pre-push review 3 of 3 at 7245a8dd6e54b291713c75ea244e5ca8fa6e8b79 · iter -
- Decision: remediated: guard test covers a triage step if: narrower than the monitor's; budget exhausted, no fourth review
- Why: tree 47c085a2eb79aaf54c3c19e01e0e0527624b3838; delta 6f7876227ced893054dd2490f9979d6172b48184..7245a8dd6e54b291713c75ea244e5ca8fa6e8b79; review 2 findings verified
- Source: https://github.com/pydantic/pydantic-ai/tree/provider-health-queue-overflow
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 -
- Decision: David approved dismissing alert 44 as a false positive; dismissed as dsfaccini
- Why: triage stays read-only; the evidence is the thread reply
- Source: https://github.com/pydantic/pydantic-ai/security/code-scanning/44
2026-10-22 · no closing issue link · iter -
- Decision: David accepted the PR without an issue link
- Why: no issue exists for this CI fix
- Source: https://github.com/pydantic/pydantic-ai/pull/11051
2026-10-22 · second opinion: douwebot · iter -
- Decision: David chose douwebot as the additional review surface
- Why: author dsfaccini has write access, so the agent-config guard on .github/workflows/AGENTS.md is skipped
- Source: https://github.com/pydantic/pydantic-ai/pull/11051
2026-10-22 · douwebot anchor suggestion declined · iter -
- Decision: Keep the duplicated triage and monitor steps; no YAML anchors
- Why: no workflow in the repo uses anchors; the guard's triage_reads_monitor_inputs check already fails on one-sided drift
- Source: https://github.com/pydantic/pydantic-ai/pull/11051#discussion_r4353887676
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.