Skip to content

[Packaging] Fix #34103: az version: Bind relocated Windows launchers to the installed interpreter - #34122

Open
Aditya Pujara (a0x1ab) wants to merge 1 commit into
Azure:devfrom
a0x1ab:agent-assist/azure-azure-cli-issue-34103-86afa8e79cb6
Open

Aditya Pujara (a0x1ab) wants to merge 1 commit into
Azure:devfrom
a0x1ab:agent-assist/azure-azure-cli-issue-34103-86afa8e79cb6

Conversation

@a0x1ab

@a0x1ab Aditya Pujara (a0x1ab) commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

Breaking Changes Tests
️✔️ None ️✔️ 130/130

Related command

az version

Description

Fixes #34103.

Bind relocated Windows launchers to the installed interpreter.

Testing Guide

  • Run az version.
  • Focused regression coverage: src/azure-cli-core/azure/cli/core/tests/test_launchers.py, src/azure-cli-core/azure/cli/core/tests/test_util.py.
  • Repository CI and the authorized live-test workflow validate the published revision.

History Notes

[Packaging] az version: Bind relocated Windows launchers to the installed interpreter


This checklist is used to make sure that common guidelines for a pull request are followed.

@x-engineering-agent x-engineering-agent Bot added the Request X Engineering Agent Request X Engineering Agent testing and review label Sep 23, 2026
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Aditya Pujara (@a0x1ab),
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@x-engineering-agent
x-engineering-agent Bot marked this pull request as ready for review September 23, 2026 12:59
@x-engineering-agent
x-engineering-agent Bot requested review from a team as code owners September 23, 2026 12:59
Copilot AI lite review requested due to automatic review settings September 23, 2026 12:59
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI 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.

Copilot review overview

🔵 Needs a closer look

Avoid the RuntimeWarning caused by the current launcher execution path.

Review effort: Lite
Findings: None

What changed in this PR

Fixes relocated Windows az launchers so they use the installed interpreter.

Changes:

  • Adds and packages the az-cli launcher.
  • Updates az.bat and process detection.
  • Adds packaging, relocation, and launcher regression tests.
File Reviewed changes
src/​azure-cli/​setup.py Registers the helper console entry point.
src/​azure-cli/​setup.cfg Includes the launcher in wheel builds.
src/​azure-cli/​MANIFEST.in Includes the launcher in source distributions.
src/​azure-cli/​azure/​cli/​_launcher.py Runs the CLI through the bound interpreter; currently emits a RuntimeWarning on invocation.
src/​azure-cli/​azure_cli_bdist_wheel.py Supports multiple extra build sources.
src/​azure-cli/​az.bat Delegates to the bound launcher with explicit errors.
src/​azure-cli-core/​azure/​cli/​core/​util.py Skips launcher processes during parent detection.
src/​azure-cli-core/​azure/​cli/​core/​tests/​test_util.py Tests launcher process traversal.
src/​azure-cli-core/​azure/​cli/​core/​tests/​test_launchers.py Tests packaging and launcher relocation scenarios.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@a0x1ab

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test skipped

⏭️ Skipping the live test for this revision because the only test file(s) changed are azure-cli-core unit tests, which the live-test pipeline (azdev test --live) does not run — it covers command-module and extension tests only.

These azure-cli-core tests are exercised by upstream CI's unit-test jobs instead. This is informational; no action is required.

@x-engineering-agent x-engineering-agent 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.

Aditya Pujara (@a0x1ab)

Confirmed launcher defect: the console entry point imports azure.cli._launcher, which imports the azure.cli package before runpy.run_module("azure.cli", run_name="main") executes it. Python therefore emits a RuntimeWarning that azure.cli is already present in sys.modules before execution. Run the actual azure.cli.main module instead, preserving argv, exit status, finalization, installer identity, and the bound interpreter. Add focused regression coverage asserting launcher stderr has no RuntimeWarning while retaining the existing finalization assertion.

@x-engineering-agent x-engineering-agent Bot added the X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent label Sep 23, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @Azure/act-platform-engineering-squad.

@a0x1ab
Aditya Pujara (a0x1ab) force-pushed the agent-assist/azure-azure-cli-issue-34103-86afa8e79cb6 branch from 37b4d7e to 521104b Compare September 23, 2026 14:40
@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test skipped

⏭️ Skipping the live test for this revision because the only test file(s) changed are azure-cli-core unit tests, which the live-test pipeline (azdev test --live) does not run — it covers command-module and extension tests only.

These azure-cli-core tests are exercised by upstream CI's unit-test jobs instead. This is informational; no action is required.

@x-engineering-agent x-engineering-agent 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.

Aditya Pujara (@a0x1ab)

Review: infrastructure timeout; no source change requested

Non-blocking COMMENT: no confirmed source or policy defect was found, but Python 3.12 validation remains incomplete.

Reviewed head: 521104bab644c92c4505ab49ae56dc60dd286075. The sensitive-information gate passed, and no outstanding formal human change request was found.

Summary

  • Failure groups: 0 PR-related, 1 not PR-related, 0 uncertain.
  • The canceled Python 3.12 job and failed aggregate check represent the same underlying timeout, not two findings.
  • No live-test failure occurred: the dispatcher returned a reused neutral skip, not a passing test run.

Upstream CI

Completed snapshot: 48/50 passed, 1 failed, 1 canceled, 0 pending; one failed build/check group.

Azure.azure-cli

  • Result: failure
  • Failure details:
    • Unit Test for Core Python312 (Not PR-related)
      • Evidence: The job running on agent pool-ubuntu-2204 4 ran longer than the maximum time of 10 minutes. For more information, see https://go.microsoft.com/fwlink/?linkid=2077134
      • Next action: Re-run the timed-out job. If it times out again at the same setup or checkout step, escalate to the pipeline owner instead of changing unrelated PR source.
      • Verify: Re-run Unit Test for Core Python312 and confirm the job completes within its limit.
      • Attribution: The task timeline records checkout from 14:40:58.640 to 14:49:46.890 UTC—8m48s of the 10-minute job budget. azdev setup was then canceled, with the message “The operation was canceled.” The azdev test task was skipped, so neither changed test file ran in this job. The diff does not modify checkout, agent-pool, or pipeline configuration. This is a checkout/setup budget exhaustion, not evidence of a launcher assertion or source regression.

Test validation

  • Live test: Skipped: no runnable changed test files were found.

  • Regression coverage: Not applicable to the changed files.

  • Skip detail: The reused neutral result says “PR changes only azure-cli-core unit tests (not runnable by azdev --live)”. This describes the changed tests' live-test eligibility, not the entire PR scope. No workflow was dispatched during this review.

  • Focused coverage inspected: src/azure-cli-core/azure/cli/core/tests/test_launchers.py checks installed and relocated launchers, interpreter identity despite an unrelated Python on PATH, arguments/quoting, empty arguments, nonzero exit status, CLI finalization, missing helper/interpreter failures, and wheel/sdist contents. src/azure-cli-core/azure/cli/core/tests/test_util.py covers the added launcher/virtualenv parent-process chain.

  • Recording scope: No outgoing service request or response mapping changed; no recording update is indicated. The command-module coverage detector reports no gap, but its “not applicable” result is not proof of Windows launcher validation.

Review skills

All seven deterministic skills were accounted for; no deterministic findings or confirmed semantic defects were found.

Skill Result
Release artifact validator Not applicable per helper; packaging History Notes are present and generated HISTORY files are unchanged.
Generated code ownership checker Not applicable; no generated output changes.
Command and help convention checker Not applicable; no command-module/help changes.
Test semantic-strength reviewer Reviewed: assertions check actual interpreter/prefix, forwarded arguments, module execution, exit status and negative paths rather than merely successful import.
No-silent-user-intent reviewer Not applicable per helper; launcher argument forwarding is covered by the focused tests above.
Scope-consistency reviewer Reviewed: the nine changed files align with interpreter-bound Windows launchers, their packaging, parent-shell detection and regression tests.
Domain edge-case reviewer Not applicable per helper; launcher error, quoting and exit paths were inspected with the test-strength target.

Next action and validation limits

No source change is requested and no implementation repair job is warranted. Have the Azure Pipelines owner rerun Unit Test for Core Python312 and confirm azdev setup, azdev test and test-result publication complete. If checkout again consumes most of the budget, escalate build 352874 and its linked job to the pipeline/agent-pool owner rather than modifying unrelated source.

For focused Windows assurance, rerun TestInstalledLaunchers in src/azure-cli-core/azure/cli/core/tests/test_launchers.py on a Windows worker with cmd.exe and PowerShell; exercise its uv install/upgrade case when uv is available. Also rerun the parent-process cases in src/azure-cli-core/azure/cli/core/tests/test_util.py. Upstream CI is authoritative; no local tests or builds were run.

The learned human-review guidance lookup was unavailable; this assessment uses the deterministic checks and current source/task evidence directly.

Classifier limitation: This is not a test-only diff: it also changes src/azure-cli-core/azure/cli/core/util.py, src/azure-cli/az.bat, src/azure-cli/azure/cli/_launcher.py and packaging files. The deterministic coverage/risk classifiers did not identify those as production components. Their low-confidence output below must not be read as evidence that Windows installation behavior is unchanged or fully validated.

Risk assessment

0/100 · Low · Low confidence

The Low rating reflects the detected change scope with no elevated security, reliability, customer, operational, dependency, sovereign-cloud, generated-output, or cross-component signal.

  • Change scope: 9 changed files, 452 changed lines (+435 / -17), including 0 production files.
  • Affected components: No production component was identified.
  • Risk drivers: No elevated risk signal was detected.
  • Regression evidence: No production-code regression-test signal applies.
  • Confidence: Low because no production changed-line evidence was available.
  • Required review: No additional owning-squad review signal was detected.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-platform-engineering-squad Auto-Assign Auto assign by bot Packaging X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent

Projects

None yet

3 participants