Let forks and copies of the repository run the `CI` gate

Merged
DS
23d ago
+55-30

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

Why we make these changes

A fork or other copy of this repository should be able to run the CI gate. Three parts of it assume they run in pydantic/pydantic-ai:

  • Releases. A tag starts deploy-docs, release-build and release (PyPI trusted publishing), and a dispatch starts deploy-docs-manual, in any repository. They now run only in pydantic/pydantic-ai.
  • Runners. Every Linux gate job names a GitHub runner, and the gate is sized for it: Pyright runs 3 workers with a 6 GB heap, and the test-all-extras shards fit 20 minutes with one xdist worker per CPU. A copy whose standard runners have 2 CPUs cannot pick bigger ones without editing the workflow. check, every Linux job it needs, and the jobs of clai2-web.yml and latest-versions-canary.yml now read their label from the CI_LINUX_RUNNER repository variable and fall back to today's label.
  • One test. test_healthy_census_does_not_require_a_slack_mention let main() read GITHUB_REPOSITORY, which Actions sets to the running repository's name. Under any other name every case raised KeyError, because the fake client answers only pydantic/pydantic-ai queries. It now pins the repository like its sibling main() tests.

New public surface

None in the packages. CI gains the CI_LINUX_RUNNER repository variable, documented in .github/workflows/AGENTS.md.

User-visible behavior

   quality:
-    runs-on: ubuntu-latest
+    runs-on: ${{ vars.CI_LINUX_RUNNER || 'ubuntu-latest' }}
   release:
-    if: ${{ !cancelled() && github.ref_type == 'tag' && needs.release-build.result == 'success' }}
+    if: ${{ !cancelled() && github.repository == 'pydantic/pydantic-ai' && github.ref_type == 'tag' && needs.release-build.result == 'success' }}

In pydantic/pydantic-ai the guard is always true and CI_LINUX_RUNNER is unset, so every job runs as before on the same runner (ubuntu-24.04 for test-all-extras, ubuntu-latest for the rest). In a copy, a tag skips the release and docs-deploy jobs, and gh-aw-engine-pin and gh-aw-engine-pin-bump skip with release. check needs none of those jobs. GitHub passes no variables to a run for a pull request from a fork, so those runs keep the fallback labels.

clai2-bleeding.yml stays as it is: it deliberately lets a fork publish a clai2-bleeding prerelease to its own releases, for CLAI_BLEEDING_URL (#9872).

Verification

  • test_healthy_census_does_not_require_a_slack_mention fails on main with GITHUB_REPOSITORY=someone/pydantic-ai-copy and passes with this PR; its whole file passes under that name.
  • check-yaml and zizmor pass, and so do the tests that parse ci.yml. This PR's own CI runs every gate job on its fallback label.

What changes for existing users

Nothing.

PR decisions

2026-11-10 · leave clai2-bleeding fork condition · iter -

  • Decision: Keep 'github.ref == refs/heads/main || github.repository != pydantic/pydantic-ai' in clai2-bleeding.yml unchanged
  • Why: Deliberate: a fork publishes its own clai2-bleeding prerelease to its own repo for CLAI_BLEEDING_URL
  • Source: https://github.com/pydantic/pydantic-ai/pull/9872
  • Session: 75c5c90b-6b84-4bf9-be09-e7c9b1db5d12

2026-11-10 · guard release as well as release-build · iter -

2026-11-10 · post-release jobs inherit the skip · iter -

2026-11-10 · guard deploy-docs-manual too · iter -

2026-11-10 · pre-push review 1 of 3 at 589ff8a0a0825cd29e61080d62af49f6c41b3222 · iter -

2026-11-10 · pre-push review 1 of 3 at 589ff8a0a0825cd29e61080d62af49f6c41b3222 · iter -

2026-11-10 · extend PR to cover running the CI gate in a copy · iter -

  • Decision: Add a configurable Linux runner label and the census test fix to PR 13030
  • Why: Maintainer decision: one PR for everything a copy of the repository needs to run the CI gate
  • Source: https://github.com/pydantic/pydantic-ai/pull/13030
  • Session: 75c5c90b-6b84-4bf9-be09-e7c9b1db5d12

2026-11-10 · runner variable name and fallback · iter -

  • Decision: runs-on: ${{ vars.CI_LINUX_RUNNER || '<today's label>' }} on check and every Linux job it needs, plus the jobs of clai2-web.yml and latest-versions-canary.yml
  • Why: Unset vars evaluate to an empty string, so pydantic/pydantic-ai keeps ubuntu-latest / ubuntu-24.04; no repo or org-visible variable has this name; name follows the subsystem-prefixed UPPER_SNAKE vars
  • Source: https://docs.github.com/en/actions/reference/workflows-and-actions/contexts
  • Session: 75c5c90b-6b84-4bf9-be09-e7c9b1db5d12

2026-11-10 · plain label, not a vendor expression · iter -

  • Decision: Accept one static label; no run-id expression upstream
  • Why: RunsOn documents static pool and fleet labels without github.run_id (runs-on/pool=small-x64, runs-on/fleet=linux-small/env=production)
  • Source: https://runs-on.com/docs/runners/labels/
  • Session: 75c5c90b-6b84-4bf9-be09-e7c9b1db5d12

2026-11-10 · census test pins GITHUB_REPOSITORY · iter -

  • Decision: Pin GITHUB_REPOSITORY=pydantic/pydantic-ai in test_healthy_census_does_not_require_a_slack_mention only
  • Why: Reproduced: KeyError only when GITHUB_REPOSITORY names another repo (Actions sets it to the copy's name); CensusClient counts are keyed on pydantic/pydantic-ai; the two sibling main() tests already pin it
  • Source: https://github.com/pydantic/pydantic-ai/pull/13030
  • Session: 75c5c90b-6b84-4bf9-be09-e7c9b1db5d12

2026-11-10 · document the variable in workflows AGENTS.md · iter -

  • Decision: Add a short section to .github/workflows/AGENTS.md
  • Why: That file is where workflow configuration is documented; CONTRIBUTING.md covers local development only
  • Source: https://github.com/pydantic/pydantic-ai/pull/13030
  • Session: 75c5c90b-6b84-4bf9-be09-e7c9b1db5d12

2026-11-10 · pre-push review 2 of 3 at d120ec685bfd67c95e3aa26de46defb50735f039 · iter -

2026-11-10 · pre-push review 2 of 3 at d120ec685bfd67c95e3aa26de46defb50735f039 · iter -

2026-11-10 · pre-push review 3 of 3 at a44c408678ca55effc40338ba27c6aa062a0abe7 · iter -

2026-11-10 · pre-push review 3 of 3 at a44c408678ca55effc40338ba27c6aa062a0abe7 · iter -

2026-11-10 · exempt delta: merge main at c824535ab · iter -

2026-11-10 · douwebot optional finding on c824535a addressed · iter -

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.

https://claude.ai/code/session_01NXARKfpBN7mC1m4JdkMQ9R