fix: stop azd completely when user declines preflight warnings#7329
fix: stop azd completely when user declines preflight warnings#7329
Conversation
There was a problem hiding this comment.
Pull request overview
Stops azd workflows cleanly when a user declines preflight warnings by introducing a dedicated sentinel error (ErrAbortedByUser) that propagates through provisioning/workflow layers and is treated as a non-failure (exit code 0) at the top-level UX middleware.
Changes:
- Add
internal.ErrAbortedByUserand map it for telemetry/error-classification. - Detect
PreflightAbortedSkippedinProvisionActionand abort immediately (prevents nil deref and stopsazd upfrom continuing to deploy). - Teach workflow runner and middleware layers to propagate/swallow user aborts appropriately; add coverage for runner + UX middleware behaviors.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/internal/errors.go | Adds ErrAbortedByUser sentinel used for control-flow aborts. |
| cli/azd/internal/cmd/provision.go | Converts PreflightAbortedSkipped into a user-abort + prints cancellation message. |
| cli/azd/cmd/middleware/ux.go | Swallows ErrAbortedByUser for non-child actions to yield exit code 0. |
| cli/azd/cmd/middleware/error.go | Skips AI error analysis for user aborts. |
| cli/azd/pkg/workflow/runner.go | Stops workflows on ErrAbortedByUser without adding step-wrapping context. |
| cli/azd/internal/cmd/errors.go | Maps ErrAbortedByUser to internal.operation_aborted for telemetry classification. |
| cli/azd/internal/cmd/errors_test.go | Extends sentinel classification coverage to include ErrAbortedByUser. |
| cli/azd/cmd/middleware/error_test.go | Adds test cases ensuring user aborts skip AI error analysis (including wrapped). |
| cli/azd/cmd/middleware/ux_test.go | Adds tests verifying swallow vs pass-through behavior based on child-action context. |
| cli/azd/pkg/workflow/runner_test.go | Adds tests ensuring workflow halts and error wrapping behavior is correct for user aborts. |
| cli/azd/internal/cmd/provision_test.go | Adds a test file, but it currently doesn’t exercise ProvisionAction.Run behavior. |
jongio
left a comment
There was a problem hiding this comment.
Clean fix for both the nil dereference and the azd up workflow-continues-after-decline bug. The sentinel error pattern with unwrapped propagation through the workflow runner is well designed - it cleanly separates the "user said no" signal from real failures while preserving errors.Is checks at every layer.
The test coverage for the new error flow (runner, UX middleware, error middleware, telemetry classification) is solid. One organizational nit on where the sentinel lives - see inline comment.
When the user selects 'N' to preflight validation warnings, azd now stops immediately with exit code 0 instead of continuing (which caused a nil panic with custom service targets or proceeded to deploy without provisioned resources). Changes: - Add ErrAbortedByUser sentinel error for user-initiated aborts - ProvisionAction detects PreflightAbortedSkipped and returns the error - UX middleware swallows ErrAbortedByUser to produce exit code 0 - Workflow runner returns ErrAbortedByUser unwrapped to stop workflows - Error middleware skips AI error analysis for user aborts - Telemetry maps abort to internal.operation_aborted Fixes #7305 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
a42686d to
601cd48
Compare
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Add release history entries for versions 1.23.11, 1.23.12, and 1.23.13 that were merged in the last 24 hours to the Azure/azure-dev upstream. Key v1.23.13 features documented: - remoteBuild suggestion when Docker is missing (Azure#7247) - azd auth status --output json agent-friendly mode (Azure#7236) - Preflight warning abort fix (Azure#7329) - Extension IPv4/IPv6 fix + timeout increase (Azure#7346) - Container Apps and ARM error suggestions (Azure#7250) - azure.yaml SchemaStore catalog entry (Azure#7330) Also add an 'Agent Auth Validation' section to external-authentication.md documenting the new azd auth status --output json behavior for AI agents. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…#7329) When the user selects 'N' to preflight validation warnings, azd now stops immediately with exit code 0 instead of continuing (which caused a nil panic with custom service targets or proceeded to deploy without provisioned resources). Changes: - Add ErrAbortedByUser sentinel error for user-initiated aborts - ProvisionAction detects PreflightAbortedSkipped and returns the error - UX middleware swallows ErrAbortedByUser to produce exit code 0 - Workflow runner returns ErrAbortedByUser unwrapped to stop workflows - Error middleware skips AI error analysis for user aborts - Telemetry maps abort to internal.operation_aborted Fixes Azure#7305 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…#7329) When the user selects 'N' to preflight validation warnings, azd now stops immediately with exit code 0 instead of continuing (which caused a nil panic with custom service targets or proceeded to deploy without provisioned resources). Changes: - Add ErrAbortedByUser sentinel error for user-initiated aborts - ProvisionAction detects PreflightAbortedSkipped and returns the error - UX middleware swallows ErrAbortedByUser to produce exit code 0 - Workflow runner returns ErrAbortedByUser unwrapped to stop workflows - Error middleware skips AI error analysis for user aborts - Telemetry maps abort to internal.operation_aborted Fixes Azure#7305 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…#7329) When the user selects 'N' to preflight validation warnings, azd now stops immediately with exit code 0 instead of continuing (which caused a nil panic with custom service targets or proceeded to deploy without provisioned resources). Changes: - Add ErrAbortedByUser sentinel error for user-initiated aborts - ProvisionAction detects PreflightAbortedSkipped and returns the error - UX middleware swallows ErrAbortedByUser to produce exit code 0 - Workflow runner returns ErrAbortedByUser unwrapped to stop workflows - Error middleware skips AI error analysis for user aborts - Telemetry maps abort to internal.operation_aborted Fixes Azure#7305 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…#7329) When the user selects 'N' to preflight validation warnings, azd now stops immediately with exit code 0 instead of continuing (which caused a nil panic with custom service targets or proceeded to deploy without provisioned resources). Changes: - Add ErrAbortedByUser sentinel error for user-initiated aborts - ProvisionAction detects PreflightAbortedSkipped and returns the error - UX middleware swallows ErrAbortedByUser to produce exit code 0 - Workflow runner returns ErrAbortedByUser unwrapped to stop workflows - Error middleware skips AI error analysis for user aborts - Telemetry maps abort to internal.operation_aborted Fixes Azure#7305 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…#7329) When the user selects 'N' to preflight validation warnings, azd now stops immediately with exit code 0 instead of continuing (which caused a nil panic with custom service targets or proceeded to deploy without provisioned resources). Changes: - Add ErrAbortedByUser sentinel error for user-initiated aborts - ProvisionAction detects PreflightAbortedSkipped and returns the error - UX middleware swallows ErrAbortedByUser to produce exit code 0 - Workflow runner returns ErrAbortedByUser unwrapped to stop workflows - Error middleware skips AI error analysis for user aborts - Telemetry maps abort to internal.operation_aborted Fixes Azure#7305 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add CHANGELOG entry for azd 1.23.13 (2026-03-26) including features, bug fixes, and other changes from PRs Azure#7247, Azure#7236, Azure#7329, Azure#7346, Azure#7311, Azure#7250, Azure#7235, and Azure#7330. - Document AZD_EXT_TIMEOUT environment variable in environment-variables.md. This variable was introduced in PR Azure#7346 (fix: use 127.0.0.1 for gRPC server address and increase extension timeout) but was not previously documented for users. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Problem
When local preflight runs and the user selects N to decline warnings:
azure.ai.agent):ProvisionAction.Run()only checked forDeploymentStateSkipped, missingPreflightAbortedSkipped. Code fell through to accessdeployResult.Deployment.OutputswhereDeploymentis nil.azd up: Even without the panic, provision was just "skipped" and the workflow continued to deploy, which fails because resources weren't provisioned.Root Cause
bicep_provider.Deploy()returnsDeployResult{SkippedReason: PreflightAbortedSkipped}with a nilDeploymentfield. The provision action at line 427 only checkeddeployResult.SkippedReason == DeploymentStateSkipped, so thePreflightAbortedSkippedcase fell through to code accessing the nilDeployment.Fix
Instead of just fixing the nil dereference, this PR addresses the root issue: when the user declines preflight warnings, azd should stop completely with exit code 0.
Changes
internal/errors.goErrAbortedByUsersentinel errorinternal/cmd/provision.goPreflightAbortedSkipped→ print message → returnErrAbortedByUsercmd/middleware/ux.goErrAbortedByUser→ exit code 0cmd/middleware/error.gopkg/workflow/runner.goErrAbortedByUserunwrapped to stop workflowsinternal/cmd/errors.gointernal.operation_abortedBehavior after fix
azd provision+ user says No → prints "Provisioning was cancelled." → exits 0azd up+ user says No → prints "Provisioning was cancelled." → stops workflow (deploy never runs) → exits 0Error flow
azd provision(standalone):PreflightAbortedSkipped→ returnsErrAbortedByUserazd up:ErrAbortedByUser→ UX middleware passes through (child)ErrAbortedByUser→ returns unwrapped → stops workflowup(non-child) → swallows error → exit 0Fixes #7305