Re-read an open-incident list that returns no incident before the Z.ai gate passes or the monitor opens one, and log each read

Merged
DS
1mo ago
+241-31

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

No issue.

Why we make these changes

On 2026-10-22 the Z.ai provider_health gate passed while provider incidents were open, and the monitor opened duplicates of an open incident: #11024, #11025, #11027, #11032 and #11033, which #11041 closes. The misses match a GitHub Issues degradation: from about 14:50Z to 17:25Z, 34% of gate reads returned HTTP 200 with no readable incident of any age or scope. The gate and _create_or_reuse_incident now re-read a list that returns no readable incident, up to five reads 2 s apart, decide on the union, and log what each read returned.

Evidence
  • 1,060 gate logs (CI Review and UI Security Review), 14:00–17:57Z: no misses before ~14:50Z or after ~17:25Z. In between, 34% of reads missed, interleaved with hits within the same minute.
  • A miss holds no incident of any age or scope. CI Review gates missed 3–5 provider incidents at once (job), and UI Security Review gates missed #10367, a week-old workflow incident (job).
  • A read within 5 s of a miss missed 41% of the time, so re-reads are close to independent. Five reads cut a miss to about 1% (estimate).
  • The gate prints ready only after a read that did not raise, so the degraded responses were HTTP 200.
  • Not reproduced: the degradation ended before a probe could run, and user-token reads after recovery were 276/276 complete. Whether a miss was an empty list or entries without a readable body is unknown; the new log line shows it next time.

New public surface: none.

User-visible behavior

A gate during a degraded read, before and after:

-ready: Provider health check passed
+Open-incident read: page 1 HTTP 200 with 0 issues, 0 unreadable (request 1C2D:3E4F); incidents: none
+Open-incident read: page 1 HTTP 200 with 45 issues, 0 unreadable (request 5A6B:7C8D); incidents: #11035, #11033, …
+blocked: Open operational incident #11035 blocks inference

A read that returns any incident is complete, so a healthy gate still makes one read while incidents of other scopes are open (about 40 today).

Verification

  • test_agent_provider_health.py: test_gate_rereads_an_incident_less_read_before_passing, test_gate_trusts_a_read_that_returns_another_scopes_incident, test_gate_passes_only_after_every_read_finds_no_incident, test_incident_reuse_rereads_until_it_finds_the_open_incident, test_open_incidents_records_each_page_and_the_incidents_it_returned.

What changes for existing users

Nothing outside CI; with no incident of any scope open, a passing gate makes five reads and waits 8 s.

Scope decisions
  • Deliberately unchanged: the exact-marker read in _monitor_workflow_outcome and the manual recover_issue lookup stay single reads. A miss in the first falls through to _create_or_reuse_incident, which re-reads. A miss in the second fails with "not found".
  • No dedup after creation. At an estimated 1% residual it adds a close path for little gain.
  • No Logfire span. The gate runs stdlib python3 in the job that holds ZAI_API_KEY. The job log and step summary carry the evidence.
  • Not addressed here: re-running a failed agent job reuses the attempt's original gate output. Attempt 2 of run 39811629975 started agent at 18:02Z on a 16:10Z pass while #11035 was open.
  • Conflicts with #11041 in the same three files. Whichever lands second rebases.
PR decisions

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

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

2026-10-22 · re-read only a read with no readable incident · iter -

  • Decision: stop re-reading once a read returns any marked incident, even one that does not match
  • Why: UI Security Review gates passed while 7-day-old workflow incident #10367 was open, so degraded reads held no incident of any age or scope; keeps healthy gates at one read on a tight GITHUB_TOKEN budget (#10874)
  • Source: https://github.com/pydantic/pydantic-ai/actions/runs/39811001426

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

2026-10-22 · pre-push review 2 of 3 at cc7084f3beb9491dc75b23fc452205b69f2ef452 · 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.