Skip to content

[VM] Fix #34083: az vm create: Preserve deployment errors when response content is consumed - #34102

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

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

Conversation

@a0x1ab

@a0x1ab Aditya Pujara (a0x1ab) commented Sep 19, 2026

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

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

Related command

az vm create

Description

Fixes #34083.

Implemented by X Engineering Agent using Azure AI Foundry. This is an AI-generated change, published by the configured operator.

Testing Guide

  • Run az vm create.
  • Focused regression coverage: src/azure-cli-core/azure/cli/core/commands/tests/test_arm.py.
  • Repository CI and the authorized live-test workflow validate the published revision.

History Notes

[VM] az vm create: Preserve deployment errors when response content is consumed


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

… response content is consumed

AI-generated by X Engineering Agent via Azure AI Foundry.
Foundry-Job: 1db2cabf7ddac34b0dfa941480fa60a4fcdefa80d11ad8ef5b07539efede9034
@x-engineering-agent x-engineering-agent Bot added the Request X Engineering Agent Request X Engineering Agent testing and review label Sep 19, 2026
@x-engineering-agent
x-engineering-agent Bot marked this pull request as ready for review September 19, 2026 08:26
@x-engineering-agent
x-engineering-agent Bot requested review from a team as code owners September 19, 2026 08:26
Copilot AI lite review requested due to automatic review settings September 19, 2026 08:26
@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

🟡 Changes recommended

Two moderate findings and one test setup nit remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Fixes az vm create deployment error handling when response content has already been consumed.

Changes:

  • Preserves parsed or cached deployment error details.
  • Adds regression coverage for consumed and malformed responses.
File Summary
src/​azure-cli-core/​azure/​cli/​core/​commands/​arm.py Updates deployment exception formatting; two moderate findings remain regarding nested errors and broad RuntimeError handling.
src/​azure-cli-core/​azure/​cli/​core/​commands/​tests/​test_arm.py Adds regression coverage; one test setup nit remains regarding response caching.

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

Comment on lines +120 to +123
error = getattr(ex, 'error', None)
# Retain parsed details if the body is consumed, but preserve a readable body in full:
# ODataV4Format omits ARM-specific fields such as additionalInfo.
error_message = str(error) if isinstance(error, ODataV4Format) else None
@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 added the X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent label Sep 19, 2026

@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 of deployment-error preservation

No confirmed changed-line defect was found at bbd7d8781673517fd080f12c409aaa0fe716dbb3. This is a non-approval review.

Scope and evidence

  • Reviewed the shared production handler in src/azure-cli-core/azure/cli/core/commands/arm.py:107-137 and all 422 added lines in src/azure-cli-core/azure/cli/core/commands/tests/test_arm.py, alongside VM/VMSS/availability-set registration, CLI polling/error propagation, and the pinned Azure Core 1.39.0 response/error implementations.
  • Traced readable-body retention (including ARM additionalInfo), parsed/cached fallbacks for consumed streams, nested diagnostics, InvalidTemplateDeployment classification, missing/falsey responses, and optional body-read failures. The retained legacy branch handles SDK error= through inner_exception; no regression in that branch was established. The added assertions include SDK polling through the CLI, but were not executed in this review.
  • All seven skills accounted for: release wording matches the fix; generated ownership and command/help have no relevant edits; test strength, scope consistency, and changed core domain behavior were inspected; no parameter/token mapping change affects user intent. Deterministic findings: 0; confirmed semantic findings: 0.

Upstream CI

The coordinator's head-matched snapshot reports 53/53 checks completed successfully, with no failed, cancelled, or pending checks. CI was not re-polled. No local tests, builds, PR code, or live-test dispatch were run in this review.

Test validation

  • Live test: Skipped: no runnable changed test files were found.
  • Regression coverage: Not applicable to the changed files.

The reused live result was neutral, skipped because the changed runnable test coverage consists of azure-cli-core unit tests, which are not runnable by azdev --live. This is not a passed live test.

Coverage limits

The focused regression file is src/azure-cli-core/azure/cli/core/commands/tests/test_arm.py. No recording changes or live-service validation accompanied the changed error presentation; the inspected coverage is offline core regression coverage, not proof of complete integration coverage. Rerun this focused suite after any revisions before merge.

The deterministic coverage/risk heuristics are command-module-oriented and do not count this shared core production file. Their not-applicable/zero-production signals below do not mean this is a test-only PR.

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: 2 changed files, 457 changed lines (+451 / -6), 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.

@yonzhan

Copy link
Copy Markdown
Collaborator

VM

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

Labels

X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az vm create: RuntimeError('already consumed') masks the real deployment error (SkuNotAvailable/QuotaExceeded)

4 participants