Add `CODEOWNERS` for dependency and CI config paths, and a `PR Gates` check requiring `compatibility impact` on new API waivers
This pull request was posted by codex-tui using gpt-6.1-sol on behalf of David.
Why we make these changes
Dependency and CI configuration changes need code-owner approval, and new API compatibility waivers need a release-note label. This PR adds native review enforcement and a metadata gate:
.github/CODEOWNERSowns everypyproject.tomlanduv.lock,.github/workflows/,.github/actions/,.github/scripts/,.pre-commit-config.yaml,Makefile, and itself. The owners are thepydantic/pydantic-ai-adminandpydantic/pydantic-ai-maintainteams. Once themainruleset requires code-owner review (steps below), a PR that changes these paths needs an approval from an owner other than its author, and GitHub dismisses it when a later push changes the diff.Gate: compatibility waiver labeledfails when a PR adds a waiver to.github/api-compatibility-allowlist.jsonwithoutcompatibility impact, so a waived break always reaches the release notes. It runs onpull_requestwith a read-only token and skips onmerge_group, which GitHub reports as success, so it can be made required without stalling the merge queue.
An earlier revision gated these paths on approved:<scope> labels that a workflow removed after later pushes. That removal could fail open (a failed API call, a PR over 3000 files, two quick pushes), so GitHub's own review enforcement replaces it.
New public surface
None. CI only.
Verification
test_pr_gates.pycovers the waiver gate, API parsing, annotations, fail-closed errors, triggers and the queue skip. Targeted pytest and Pyright passed after mergingmain; commit hooks passed.gh api 'repos/pydantic/pydantic-ai/codeowners/errors?ref=ci-review-gates'returns{"errors": []}.
After merge: repo admin steps and open rollout checks
- Run
gh api repos/pydantic/pydantic-ai/codeowners/errors. It must return{"errors": []}. - In the
mainruleset, enable Require a pull request before merging with 0 required approvals, Dismiss stale pull request approvals when new commits are pushed, and Require review from Code Owners. Leave conversation resolution and Require approval of the most recent reviewable push off (open item below). - Check the ruleset's bypass list. Anyone on it can merge without owner review.
- Confirm nothing pushes to
maindirectly, since the rule requires a PR for every change. No workflow does; release tooling was not checked. - Open two throwaway PRs. A comment-only edit to
.pre-commit-config.yamlshould request the owners and block until another owner approves, and a second push should dismiss that approval. Adocs/-only PR should merge with no approval. - Delete the retired
approved:dependenciesandapproved:ci-configlabels. - Once the waiver check has run successfully, add Gate: compatibility waiver labeled to the ruleset's required status checks, with GitHub Actions as its expected source. Verify an unlabeled waiver blocks a test PR and adding
compatibility impactclears it.
Merging before step 2 lets step 1 validate the file before it is enforced.
Open items
- Require approval of the most recent reviewable push. With it off, an owner who pushes to someone else's PR can approve their own change. Whether it binds every PR at 0 required approvals is unverified; the step 5 test PR can show it.
- Overlapping gate runs (unverified). A
synchronizerun that read the labels before a label removal could finish last and leave the waiver gate green. Settle this before the gate becomes required.
What changes for existing users
Nothing in the library. After step 2, a PR that touches an owned path waits for an owner's approval.
PR decisions
2026-10-22 · Protected paths
- Decision:
pyproject.toml,uv.lock,.github/workflows/,.github/actions/,.github/scripts/,.pre-commit-config.yaml,Makefile. - Why: maintainer decision on the gate design.
2026-10-22 · Griffe packages out of scope
- Decision: adding the harness and clai2 to the griffe check is a separate PR.
- Why: that change is already in flight.
2026-10-22 · Overlapping runs (unverified, rollout note)
- Decision: the possible race is recorded under "Open items", not fixed here and not filed as an issue.
- Why: maintainer decision. It matters only once the gate is required.
2026-10-23 · Code owners replace approval labels
- Decision: a self-owned
.github/CODEOWNERSfor the paths above, owned by the admin and maintain teams, enforced by themainruleset's code-owner review with stale approvals dismissed. Theapproved:<scope>labels and the workflow that removed them are retired..github/dependabot.ymlstays unowned. - Why: maintainer decision. Label removal ran as a workflow on each push, and four ways for it to fail open were reproduced; GitHub dismisses a stale approval as part of the push.
- Supersedes: the label scope, the
approved:<scope>standard, agents applying approval labels, and both Macroscope voiding threads.
2026-10-23 · Waiver gate on pull_request
- Decision:
Gate: compatibility waiver labeledruns onpull_requestwith a read-only token. - Why: maintainer decision. Code-owner review already covers any edit to the gate. First-time-contributor fork runs wait for approval.
2026-10-23 · Most-recent-push approval left off
- Decision: the admin steps leave Require approval of the most recent reviewable push off and list it as an open item.
- Why: its reach at 0 required approvals is unverified; the throwaway test PR shows it.
2026-10-23 · Pre-push reviews of the reshape
- Decision: review 1 found five issues. Four were fixed: the AGENTS.md wording on self-approval, a note that
CODEOWNERSis what keeps the gate from being edited to pass itself,openedin the trigger test, and a trimmed test fixture. The fifth, dropping thefinal-reviewcatalog row, was skipped. Review 2 found nothing. - Why:
final-reviewis a live repo label missing frommain's catalog, so dropping the row reintroduces that drift.
2026-10-27 · Refresh from main
- Decision: merge current
mainwithout rewriting the branch; preserve current CI Review trigger documentation. - Why: validate the code-owner and waiver gates against current CI before enabling repository rules.
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.