Skip to content

ci: install PGO host interpreter to avoid clobbering windows Python - #959

Merged
davidhewitt merged 3 commits into
mainfrom
dh/pgo-python
Oct 1, 2026
Merged

davidhewitt merged 3 commits into
mainfrom
dh/pgo-python

Conversation

@davidhewitt

@davidhewitt davidhewitt commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

My understanding of the build failure in https://github.com/pydantic/monty/actions/runs/36858478859/job/110375062900 is that setup-python installing 3.14t caused maturin to select that 3.14t interpreter for -i 3.14 (might be a bug but it's kind of messy).

Using uv, only installing interpreter if needed, and refactoring a little, should avoid that crash.


Summary by cubic

Fixes PGO wheel builds crashing on non-Linux runners where setup-python's 3.14t interpreter overrode the uv-managed Python maturin was targeting.

  • Replaces actions/setup-python with astral-sh/setup-uv for non-Linux PGO runs and installs the host interpreter via uv python.
  • Linux PGO runs now symlink the container interpreter to a stable path instead of a hardcoded uv path.
  • Drops the per-matrix pgo-args entries; the --pgo -i flags are built from the matrix runtime flag.
  • Disables LLVM select counters during PGO and threads RUSTFLAGS into the container to work around LLVM corrupting them (see Failure to run PGO instrumentation on Rust 1.99.0 rust-lang/rust#163616).

Written for commit 9190f64. Summary will update on new commits.

Review in cubic

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Branch diff: dh/pgo-python

Commit Message Production Test Other
372f589 ci: install PGO host interpre… +0 -0 +0 -0 +21 -11
54cb9ff attempt to workaround crash +0 -0 +0 -0 +3 -1
9190f64 link to upstream report +0 -0 +0 -0 +2 -1
TOTAL +0 -0 +0 -0 +25 -12

@davidhewitt

Copy link
Copy Markdown
Contributor Author

(I think #958 is blocked by the same failure.)

Comment thread .github/workflows/ci.yml
id: pgo-python
shell: bash
run: |
uv python install 3.14

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High workflows/ci.yml:774

The non-Linux wheel builds fail when Maturin resolves 3.14t (and potentially 3.15t) because those host interpreters are no longer installed; uv python install 3.14 provides only the regular interpreter and runs only for the macOS PGO entry, while Windows installs none. Restore provisioning for the free-threaded interpreters required by the -i 3.14t ... 3.15t arguments before the wheel build.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @.github/workflows/ci.yml around line 774:

The non-Linux wheel builds fail when Maturin resolves `3.14t` (and potentially `3.15t`) because those host interpreters are no longer installed; `uv python install 3.14` provides only the regular interpreter and runs only for the macOS PGO entry, while Windows installs none. Restore provisioning for the free-threaded interpreters required by the `-i 3.14t ... 3.15t` arguments before the wheel build.

@macroscopeapp

macroscopeapp Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This CI-only PR changes the PGO toolchain and compiler inputs used to build runtime wheels that are later published to PyPI, including floating interpreter resolution. Because it materially changes release artifact construction and reproducibility, it warrants human review.

Notes:

  • Your custom eligibility rules tell Macroscope not to weigh correctness findings, so they do not block approval.

You can add or adjust custom eligibility rules. Learn more.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/workflows/ci.yml">

<violation number="1" location=".github/workflows/ci.yml:774">
P3: The new PGO interpreter provisioning floats versions on every run: `uv python install 3.14` resolves the latest 3.14 patch, the container installs the *latest* uv via the curl script while the host side uses setup-uv's uv, and `--managed-python` then picks whichever managed 3.14 exists. This PR exists because interpreter-selection non-determinism broke the build, so pinning the exact interpreter (e.g. `uv python install 3.14.1` and a fixed uv version) would make the PGO profile inputs reproducible across runs.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread .github/workflows/ci.yml
id: pgo-python
shell: bash
run: |
uv python install 3.14

@cubic-dev-ai cubic-dev-ai Bot Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The new PGO interpreter provisioning floats versions on every run: uv python install 3.14 resolves the latest 3.14 patch, the container installs the latest uv via the curl script while the host side uses setup-uv's uv, and --managed-python then picks whichever managed 3.14 exists. This PR exists because interpreter-selection non-determinism broke the build, so pinning the exact interpreter (e.g. uv python install 3.14.1 and a fixed uv version) would make the PGO profile inputs reproducible across runs.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/ci.yml, line 774:

<comment>The new PGO interpreter provisioning floats versions on every run: `uv python install 3.14` resolves the latest 3.14 patch, the container installs the *latest* uv via the curl script while the host side uses setup-uv's uv, and `--managed-python` then picks whichever managed 3.14 exists. This PR exists because interpreter-selection non-determinism broke the build, so pinning the exact interpreter (e.g. `uv python install 3.14.1` and a fixed uv version) would make the PGO profile inputs reproducible across runs.</comment>

<file context>
@@ -768,21 +761,38 @@ jobs:
+        id: pgo-python
+        shell: bash
+        run: |
+          uv python install 3.14
+          echo "python=$(uv python find --managed-python 3.14)" >> "$GITHUB_OUTPUT"
+
</file context>
Fix with cubic

@codspeed

codspeed Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 45 untouched benchmarks
⏩ 16 skipped benchmarks1


Comparing dh/pgo-python (9190f64) with main (505f104)2

Open in CodSpeed

Footnotes

  1. 16 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (fb4d0d1) during the generation of this report, so 505f104 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 47863 uncovered lines.
✅ Project coverage is 63.98%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    63.83%    63.98%    +0.15%
==========================================
  Files          522       524        +2
  Lines       130356    132888     +2532
  Branches    277824    283043     +5219
==========================================
+ Hits         83210     85025     +1815
- Misses       47146     47863      +717
- Partials      5657      5763      +106

Generated by Codecov Action

@codecov

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@davidhewitt
davidhewitt enabled auto-merge (squash) October 1, 2026 16:39
@davidhewitt
davidhewitt merged commit 3f9d6ef into main Oct 1, 2026
76 checks passed
@davidhewitt
davidhewitt deleted the dh/pgo-python branch October 1, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant