Recheck Z.ai provider health when a queued agent job starts, so incidents opened during the wait stop inference

Merged
DS
1mo ago
+704-21

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

Why we make these changes

Every Z.ai workflow decides provider health in provider_health when it starts, but its agent job then queues for the engine concurrency slot: over the last 14 days that decision was a median 5.1 h old when a CI Review agent started. During provider incident #10572, 16 queued CI Review runs still reached the model and failed on 1310, and 31 sent their detection pass to the blocked provider. Run 38967083667 passed its gate at 21:07Z and started its agent at 03:13Z, six minutes after #10572 opened.

Every Z.ai agent job now reruns the default-branch agent_provider_health.py check as its first pre-agent step, replaces the provider-health artifact, and fails before the engine step unless ready. A noop would not stop inference: detection runs on any agent output.

New public surface

none

User-visible behavior

A queued run whose provider is blocked by the time its agent startsBeforeAfter
Model and detectionrun against the blocked providernot started
Run conclusionfailurefailure, before the engine step
Incidentfrom the shim result, if anyreuses the blocking incident, or opens one quota_exhausted incident

Healthy runs add one quota call and a few GitHub API reads at agent start; the first model request follows the decision by about a minute.

Verification

What changes for existing users

Nothing; this is repository CI tooling.

PR decisions

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

2026-10-22 · agent-start block fails the job, not a noop · iter -

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

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

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

2026-10-22 · agent-start block fails the job, not a noop · iter -

  • Decision: A blocked agent-start recheck exits 1 before the engine step instead of writing a noop to safe outputs
  • Why: detection runs on any agent output_types, noop included; during incident #10572 the detection jobs of 31 stale-head noop runs each retried against the blocked provider (65-66 rejected 1310 requests in each of 3 sampled logs). Run 39817057326 failed in a pre-agent step and its detection skipped Execute
  • Source: https://github.com/pydantic/pydantic-ai/actions/runs/39817057326
  • Supersedes: agent-start block fails the job, not a noop

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

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

2026-10-22 · douwebot finding: single source for agent-start step names · iter -

  • Decision: AGENT_START_HEALTH_STEPS constant in agent_provider_health.py; guard requires the compiled steps carry those names
  • Why: the monitor matches the steps by name; a rename in shared/provider-health.md passed the guard and would reclassify a block as a setup failure. Review budget exhausted (3 of 3); pushed on local checks
  • Source: https://github.com/pydantic/pydantic-ai/pull/11048#discussion_r4352312257

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.