{CI} Fix macOS build: Use libexec/bin/python instead of libexec/bin/python3#33538
Merged
YangAn-microsoft merged 1 commit intoJun 12, 2026
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
The Homebrew python@X.Y formula only creates the unversioned 'python' symlink in libexec/bin unconditionally. The 'python3' symlink is created only for altinstalls (when the formula is NOT Homebrew's default python3 alias). After bumping to 3.14, python@3.14 is an altinstall (3.13 remains the python3 alias), so .../python@3.14/libexec/bin/python3 does not exist, breaking the macOS build/sign/cask pipelines. Use the always-present 'python' symlink instead.
188b08e to
126239f
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a macOS packaging pipeline break caused by Homebrew python@X.Y formulae not always providing libexec/bin/python3 (notably for 3.14), by switching to the always-present libexec/bin/python. It also introduces a new automated “Python Upgrade Agent” (scripts, tests, and a scheduled GitHub Actions workflow) plus associated documentation.
Changes:
- Fix macOS pipeline and packaging scripts to use
.../libexec/bin/pythoninstead of.../libexec/bin/python3for Homebrew-managed Python. - Add a Python minor-version upgrade automation agent (
scripts/python_upgrade_agent/) with validation, post-checking, and unit tests. - Add a scheduled GitHub Actions workflow to run the agent, plus playbook/docs and log-file gitignore entry.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
.azure-pipelines/templates/macos/macos-build-jobs.yml |
Switches Homebrew Python path usage to libexec/bin/python in macOS build/test steps. |
.azure-pipelines/templates/macos/macos-cask-generation-and-tests.yml |
Switches AZ_PYTHON to libexec/bin/python for cask generation/tests. |
.azure-pipelines/templates/macos/macos-sign-notarize-jobs.yml |
Switches AZ_PYTHON to libexec/bin/python for functional tests in sign/notarize jobs. |
scripts/release/macos/build_binary_tar_gz.py |
Updates Homebrew Python discovery to prefer libexec/bin/python (candidates + brew --prefix fallback). |
.github/workflows/PythonUpgradeAgent.yml |
Adds scheduled + manual workflow to run the new Python upgrade agent using an app token and models token. |
scripts/python_upgrade_agent/agent.py |
Orchestrates detect → discover → LLM → validate → post-check → apply → draft PR creation. |
scripts/python_upgrade_agent/ai.py |
Implements GitHub Models call, prompt construction, and reference-PR few-shot retrieval. |
scripts/python_upgrade_agent/detect.py |
Detects current embedded Python from build.cmd and selects next-minor target from python.org feed. |
scripts/python_upgrade_agent/discover.py |
Uses git grep with exclusions to discover candidate version references with context. |
scripts/python_upgrade_agent/validate.py |
Validates LLM-proposed edits against candidate set, uniqueness, and size caps. |
scripts/python_upgrade_agent/post_check.py |
Simulates edits in-memory and flags leftover current-minor hits not listed as skipped. |
scripts/python_upgrade_agent/github_ops.py |
Thin wrappers around git/gh for branching, applying edits, pushing, and PR creation. |
scripts/python_upgrade_agent/README.md |
Documents the agent’s flow, configuration, and local testing. |
scripts/python_upgrade_agent/pr_template.md |
PR body template emitted by the agent. |
scripts/python_upgrade_agent/next_steps_template.md |
“Next steps” content embedded into the agent-opened PR body. |
scripts/python_upgrade_agent/__init__.py |
Marks the agent as a package. |
scripts/python_upgrade_agent/tests/__init__.py |
Test package marker. |
scripts/python_upgrade_agent/tests/test_validate.py |
Unit tests for validation logic (paths, uniqueness, caps, additive classifier rule). |
scripts/python_upgrade_agent/tests/test_post_check.py |
Unit tests for deterministic post-check behavior. |
scripts/python_upgrade_agent/tests/test_discover.py |
Unit tests for discovery regex/path exclusion behavior using a mini git repo. |
scripts/python_upgrade_agent/tests/test_detect.py |
Unit tests for version detection/decision logic. |
doc/presentations/python-upgrade-campaign-playbook.md |
Adds a playbook describing the operational workflow for Python minor bumps. |
.gitignore |
Ignores the agent’s verbose log file (python_upgrade_agent.log). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
CI |
naga-nandyala
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After bumping the embedded Python to 3.14, the macOS build pipeline fails at the
Install Homebrew Pythonstep:Root cause
The Homebrew
python@X.Yformula creates the unversionedpythonsymlink inlibexec/binunconditionally, but creates the major-versionedpython3symlink inlibexec/binonly for altinstalls (i.e. when the formula is not Homebrew's current defaultpython3):python@3.14is currently Homebrew's defaultpython3(altinstall? == false; it is installed as/opt/homebrew/bin/python3). For the default formula the realpython3lives inHOMEBREW_PREFIX/bin, so nopython3symlink is added underlibexec/bin-- only the unversionedpython. Hence.../python@3.14/libexec/bin/python3does not exist.This is confirmed by the formulae caveats: 3.14 says
Python is installed as .../bin/python3and lists only unversioned libexec symlinks (python,pip); 3.13 (the altinstall) says.../bin/python3.13and lists bothpythonandpython3in libexec. This is why the pipeline worked on 3.13 and broke after the bump to 3.14.Fix
Use the always-present unversioned
libexec/bin/pythonsymlink instead oflibexec/bin/python3. This is robust regardless of which minor version is Homebrew's defaultpython3.Files changed
.azure-pipelines/templates/macos/macos-build-jobs.yml(2 occurrences).azure-pipelines/templates/macos/macos-cask-generation-and-tests.yml.azure-pipelines/templates/macos/macos-sign-notarize-jobs.ymlscripts/release/macos/build_binary_tar_gz.py(candidate list +brew --prefixfallback)