Move `Package Label` and `PR Review Gates` off `pull_request_target`
Merged
DS
25d ago+46+46+01234567890123456789-44-44-01234567890123456789
This pull request was posted by Claude Code using claude-opus-5-5 on behalf of David.
Why we make these changes
GitHub blocks pull_request_target by default in public repositories from 2026-12-02. This is step 1 of the plan on #12961, which this PR does not close. Neither workflow here needs the event:
Package Labelonly reads the PR's labels.pull_requestgives fork PRs a read-only token, which is enough.PR Review Gatesalready wakes throughworkflow_runfromPR BotsandPR Review Gates Events. That observer now also fires on PR opens, pushes, reopening, edits and label changes, so thepull_request_targettrigger goes. Thereview-targetjob acceptspull_requestfrom the observer and rejects any other direct event.
bots.yml, pr-guard.yml, protect-github-dir.yml, docs-navigation.yml and ci-duration-report.yml stay on pull_request_target under the admin event policy.
New public surface
None.
User-visible behavior
# .github/workflows/package-label.yml
on:
- pull_request_target:
+ pull_request:
- A fork PR whose runs GitHub holds for approval gets
Package Labelonce a maintainer approves the run, as it already getsCI. Here that hold applies to first-time contributors new to GitHub. - A PR runs its own copy of
package-label.yml.
Verification
test_review_observer_is_read_only_and_schema_matches_the_trusted_publisherasserts the observer'spull_requesttypes.test_observer_cannot_choose_the_status_targetadds apull_requestwake-up that resolves the PR, and a direct event that now fails.
What changes for existing users
Nothing for library users; only repository CI changes.
Deliberate scope:
PR Botsstill wakesPR Review Gateson opens, pushes, edits and label changes, so a held fork PR keeps gettingGate:statuses untilbots.ymlmoves.- An edit or label change on a closed PR now fails one more
PR Review Gatesrun ("Requires one open PR at the observed workflow head"). ThePR Botswake-up already fails that way; the failure writes no status. - The #12961 policy comment drops these two workflows after merge.
PR decisions
2026-11-09 · tracking issue route · iter -
- Decision: Filed #12961 assigned dsfaccini with pydanty:skip (immediate-work route); admin event policy is David's action outside the repo
- Why: Manager dispatch named the route; the policy change is not a repo change
- Source: https://github.com/pydantic/pydantic-ai/issues/12961
- Session: cff95ae3-d1dc-4cd7-ac42-fd30b183471c
2026-11-09 · policy now, redesign plan, no moves yet · iter -
- Decision: David: admin event policy before 2026-12-02 plus a pull_request + workflow_run redesign plan posted on #12961; no workflow edits yet
- Why: Manager dispatch 2026-11-09T19:13Z
- Source: https://github.com/pydantic/pydantic-ai/issues/12961#issuecomment-6749256306
- Session: cff95ae3-d1dc-4cd7-ac42-fd30b183471c
2026-11-09 · two path-scoped event policies · iter -
- Decision: Policy 1 allows only pull_request_target for 6 PRT-only files; policy 2 allows pull_request_target, workflow_run, merge_group for pr-review-gates.yml and pr-review-checks.yml
- Why: restrict_action_events is an allowlist, so a targeted file runs only on listed events
- Source: https://github.com/pydantic/pydantic-ai/issues/12961#issuecomment-6749255839
- Session: cff95ae3-d1dc-4cd7-ac42-fd30b183471c
2026-11-09 · step 1 scope · iter -
- Decision: One small PR: Package Label to pull_request; PR Review Gates woken by pull_request in pr-review-gates-events.yml via existing workflow_run; review-target map, test_pr_gates.py, AGENTS.md. Drop the two from the #12961 policy comment only after merge. bots.yml and pr-review-checks wait for #12859 merge and the admin policy
- Why: David's answer to the audit (manager dispatch 2026-11-09T19:47Z)
- Source: https://github.com/pydantic/pydantic-ai/issues/12961#issuecomment-6749256306
- Session: cff95ae3-d1dc-4cd7-ac42-fd30b183471c
2026-11-09 · pr-guard and protect-github-dir stay on pull_request_target · iter -
- Decision: Do not touch pr-guard.yml or protect-github-dir.yml; manager researches better primitives
- Why: David (manager dispatch 2026-11-09T19:47Z): moving them weakens the guard (approval hold, suppressible verdict)
- Source: https://github.com/pydantic/pydantic-ai/issues/12961#issuecomment-6749256306
- Session: cff95ae3-d1dc-4cd7-ac42-fd30b183471c
2026-11-09 · code-owner claim in AGENTS.md left as is · iter -
- Decision: David enforces code-owner review in the ruleset (admin change) instead of editing .github/workflows/AGENTS.md
- Why: David (manager dispatch 2026-11-09T19:47Z): make the documented control real
- Source: https://github.com/pydantic/pydantic-ai/issues/12961
- Session: cff95ae3-d1dc-4cd7-ac42-fd30b183471c
2026-11-09 · pre-push review 1 of 3 at ad89e3288d67d9148f893b3eaf6849eb2941ee5f · iter -
- Decision: Reserved: fresh no-history Haiku reviewer via claude -p from detached policy-base checkout b24c2a474b, read/search tools only, no fan-out; outcome pending
- Why: tree 2f6a14198c36de6c1f2ce355e8a2ff08bfae8c0e; scope b24c2a474babc6d3819110e7c7056c2bcf998222..ad89e3288d67d9148f893b3eaf6849eb2941ee5f (full branch); policy-base b24c2a474babc6d3819110e7c7056c2bcf998222; first review
- Source: https://github.com/pydantic/pydantic-ai/tree/chore/pull-request-target-audit
- Session: cff95ae3-d1dc-4cd7-ac42-fd30b183471c
2026-11-09 · pre-push review 1 of 3 at ad89e3288d67d9148f893b3eaf6849eb2941ee5f · iter -
- Decision: remediated in 8db8637e9a62ad95b2d8abc03e23ff0eefc351d4: package-label.yml comment states the PR's own copy runs, Protect .github flags non-maintainer edits, held forks get the check after approval; AGENTS.md paragraph rewrapped. Approval wait for Package Label was already accepted in the approved plan
- Why: reviewed tree 2f6a14198c36de6c1f2ce355e8a2ff08bfae8c0e; scope b24c2a474b..ad89e3288d full branch; 3 findings, all addressed
- Source: https://github.com/pydantic/pydantic-ai/issues/12961#issuecomment-6749256306
- Session: cff95ae3-d1dc-4cd7-ac42-fd30b183471c
2026-11-09 · exempt delta ad89e3288d..8db8637e9a62ad95b2d8abc03e23ff0eefc351d4 · iter -
- Decision: No re-review: package-label.yml change is comment-only; AGENTS.md change is a rewrap with an identical word sequence
- Why: Rubric rungs (API, behavior, docs meaning, tests) untouched: no YAML key, test or instruction wording changed; verified by comment-only diff and word-sequence diff. Chains from reviewed ad89e3288d
- Source: https://github.com/pydantic/pydantic-ai/tree/chore/pull-request-target-audit
- Session: cff95ae3-d1dc-4cd7-ac42-fd30b183471c
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
- PR title is fit for the release changelog.