Run CI's `pyright` with 3 workers and a 6 GB Node heap so no worker empties its type cache
Why we make these changes
The full Pyright step in quality checks grew from a median of about 178 s (2026-10-08 to 14) to about 244 s (2026-10-26 to 28), up to 327 s, as the checked Python grew from 851k to 1,095k lines. Item 4 of #8182 predicted the cause of the extra cost: each Pyright process empties its whole type cache once its heap passes 90% of Node's default limit (about 4 GB on the runners), then re-evaluates everything it still needs. #8182 suggested raising the heap on CI but had not tested it. This PR tests it and applies it. It does not close #8182, which covers other levers.
Measured on ubuntu-latest (4 vCPU, 16 GB) with a temporary --verbose profiling workflow (runs 1, 2, 3). The workflow is not part of this PR:
| config | cache evictions per run | wall | memory |
|---|---|---|---|
--threads auto (4 workers), default heap: today | 7 to 33 | 159 to 253 s | fits |
| 4 workers, 6 or 8 GB heap | 0 | 145 to 249 s | 1 to 3 GB of swap |
| 3 workers, default heap | 27 to 33 | 227 to 311 s | fits |
| 3 workers, 6 GB heap | 0 | 141 to 221 s | fits, about 15 GB peak |
| 1 process, 8 GB heap | 22 | 239 to 314 s | fits |
Runner speed varies widely, so the decision rests on paired ABBA runs: today's config and the candidate ran twice each on the same runner, across 6 runners. The candidate was faster on every runner, by 9 to 14% (18 to 32 s) of the per-runner mean. All 12 candidate runs beat both baseline runs on their runner. Every run in every configuration reported 0 errors.
The growth itself is legitimate: tests went from 562k to 758k lines and pydantic_ai_slim from 154k to 189k. No single file explains it, though tests/test_embeddings.py costs 5 to 15 s because it pulls in transformers. This PR leaves PYRIGHT_TIME_BUDGET at the 320 s that #11652 set; this saving goes on top of that.
New public surface
None.
What changed
.github/workflows/ci.yml: the Pyright step setsPYRIGHT_THREADS: "3"instead ofautoand addsNODE_OPTIONS: --max-old-space-size=6144, which every worker process inherits.docs/contributing.md: states CI's setting and explains the type-cache eviction, with the measured single-process numbers.
Verification
- The CI profiling runs linked above. No full Pyright run was done locally.
pre-commiton the changed files (YAML,zizmor, codespell).- This PR's own
quality checksrun used the new settings, becauseci.ymlis apyright_changedinput. Its Pyright step passed in 229 s. That is one sample, inside the runners' spread.
What changes for existing users
Nothing; only CI's Pyright step changes.
PR decisions
- 2026-10-29: three pre-push reviews (budget exhausted). Review 1 could not read the policy base and contributed only a wording note. Review 2 caught that
mainhad already raised the budget to 320 s (#11652). The branch was rebased and the budget sentence dropped. Review 3 asked for measured numbers in the docs, which were added. - 2026-10-29: the budget is kept at 320 s rather than lowered on the strength of this saving. That is a maintainer call.
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.