Open Z.ai provider-health incidents only for provider-wide evidence, not fork-PR gates or transient `1302` rate limits

Merged
DS
1mo ago
+126-34

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

Why we make these changes

Since quota diagnostics landed (#10125), every CI Review provider incident has had one of three causes. None of them was a provider outage. Each incident still blocked every Z.ai workflow for 1–2 h.

CauseIncidentsStatus
Gate ran without ZAI_API_KEY: GitHub withholds secrets from pull_request_review on fork PRs#10986, #10995, #10999, #11003, #11019, #11024, #11025, #11033fixed here
Z.ai 1302 request-rate 429 that outlasted the runner's 60 s retry#10921, #11008, #11027, #11032 (and #10310 in UI Security Review)fixed here
CREDIT_LIMIT quota rows#10582, #10583, #10637fixed by #10678

#9756 and #10213 handled the missing key one event shape at a time. This PR handles it for the whole pull request event family:

  • The monitor opens no incident when a pull_request, pull_request_review or pull_request_review_comment gate ran without the key. Gates on other events and the scheduled check still open one, so a broken key binding still surfaces.
  • The runner reports a 429 whose Z.ai code is a documented account or plan limit (1113, 1308–1311, 1313–1321) as a new plan_limit kind. plan_limit opens the provider incident that rate_limit used to open. Any other 429 stays rate_limit and is now local to its run, like a timeout or a 529. The same code set decides what the retry transport gives up on.
  • Runners on older PR branches report every 429 as rate_limit. An exhausted plan still blocks the next run at its quota check.

In the last 14 days of runner telemetry, most 1302 hits recovered inside the retry window. Runs also succeeded during the same throttling windows.

New public surface

none

User-visible behavior

Run outcomeBeforeAfter
Fork PR review, gate has no keyprovider incidentrun blocked, no incident
1302/1305 429 outlasts retryprovider incident (rate_limit)run fails, no incident
1310, 1316, … 429provider incident (rate_limit)provider incident (plan_limit)

Verification

What changes for existing users

Nothing; this is repository CI tooling.

PR decisions

2026-10-22 · missing key: skip by diagnostic, not event shape · iter -

  • Decision: Monitor opens no incident when the gate ran without ZAI_API_KEY; the scheduled check owns that alert
  • Why: Third secretless event shape (fork pull_request_review) after #9756 and #10213 patched one shape each; the gate job reads the same repo secret as the scheduled check
  • Source: https://github.com/pydantic/pydantic-ai/issues/11025

2026-10-22 · 429 split: rate_limit transient, plan_limit provider · iter -

  • Decision: Shim reports Z.ai 1302/1305/no-code 429 as rate_limit (local to run) and other Z.ai codes as plan_limit (provider incident)
  • Why: Z.ai documents 1302/1305 as transient; the shim runs from the PR head, so rate_limit must become transient for old branches; an exhausted plan still blocks at the next quota check
  • Source: https://docs.z.ai/api-reference/api-code

2026-10-22 · drop the concurrency rationale for the 1h hold · iter -

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

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

2026-10-22 · missing key: event-scoped after review · iter -

  • Decision: Skip run-level missing_api_key incidents only for pull_request, pull_request_review, pull_request_review_comment
  • Why: agentic_workflow_guard.py does not pin the gate's ZAI_API_KEY binding, so a global skip would hide a broken binding; non-PR gates and the scheduled check still alert
  • Source: https://github.com/pydantic/pydantic-ai/issues/11025
  • Supersedes: missing key: skip by diagnostic, not event shape

2026-10-22 · 429 split: documented plan-limit codes only · iter -

  • Decision: plan_limit only for documented Z.ai account/plan codes (1308-1311, 1313-1321); unknown and code-less 429s are rate_limit; the transport stops retrying 1311 and 1313-1315
  • Why: an unknown code carries no evidence of a plan limit; an exhausted plan still blocks at the next quota check; one list cannot drift
  • Source: https://docs.z.ai/api-reference/api-code
  • Supersedes: 429 split: rate_limit transient, plan_limit provider

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

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

2026-10-22 · pre-push review 3 of 3 at 121c6cd1db04a5087f226d9e4cb103db763cb78e · iter -

2026-10-22 · pre-push review 3 of 3 at 121c6cd1db04a5087f226d9e4cb103db763cb78e · iter -

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.