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
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 ReviewandUI 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 Reviewgates missed 3–5 provider incidents at once (job), andUI Security Reviewgates 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
readyonly 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_outcomeand the manualrecover_issuelookup 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
python3in the job that holdsZAI_API_KEY. The job log and step summary carry the evidence. - Not addressed here: re-running a failed
agentjob reuses the attempt's original gate output. Attempt 2 of run 39811629975 startedagentat 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 -
- Decision: reserved; outcome pending
- Why: tree 1b81bca443f4ffafec8e27e3458f5e3ed921b379; scope 767f526777..0d19504f0f (full branch); first review
- Source: https://github.com/pydantic/pydantic-ai/tree/provider-incident-read
2026-10-22 · pre-push review 1 of 3 at 0d19504f0fcc737bebf0fce8a6fc3d21b8a420de · iter -
- Decision: remediated: 4 findings — re-read cost/residual, unverified empty-list wording, unconditional AGENTS.md rule, CI step-summary leak in tests
- Why: tree 1b81bca443f4ffafec8e27e3458f5e3ed921b379; scope 767f526777..0d19504f0f (full branch); dedup-after-create skipped: ~1% residual makes it net-neutral
- Source: https://github.com/pydantic/pydantic-ai/tree/provider-incident-read
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 -
- Decision: reserved; outcome pending
- Why: tree 057ce0840934e61ff1d73c4e1c8a3100661f9c1d; follow-up scope 0d19504f0f..cc7084f3be plus callers; verifies review-1 findings
- Source: https://github.com/pydantic/pydantic-ai/tree/provider-incident-read
2026-10-22 · pre-push review 2 of 3 at cc7084f3beb9491dc75b23fc452205b69f2ef452 · iter -
- Decision: remediated: 1 finding (docstring dropped the read bound); 8a137f41d2 is a docstring-only exempt delta chained from cc7084f3be
- Why: tree 057ce0840934e61ff1d73c4e1c8a3100661f9c1d; all four review-1 findings verified fixed
- Source: https://github.com/pydantic/pydantic-ai/tree/provider-incident-read
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.