Skip to content

Revisit UserContextError and MachineContextError categories for fixable errors after Copilot SDK implementation #7104

Description

@hemarina

Summary

After the Copilot SDK is implemented, we need to revisit the error categorization in classifyError() (cmd/middleware/error.go) for UserContextError and MachineContextError.

Currently, errors classified under these two categories are not sent for full agentic analysis and automated fix (only AzureContextAndOtherError is eligible). However, some of these errors are actually fixable by the agent and should be reconsidered once the Copilot SDK provides richer capabilities.

Details

UserContextError (potentially fixable)

Some user-context errors that could be auto-remediated:

  • auth.ReLoginRequiredError / auth.AuthFailedError — agent could guide or trigger re-authentication
  • auth.ErrNoCurrentUser / azapi.ErrAzCliNotLoggedIn / azapi.ErrAzCliRefreshTokenExpired — agent could prompt login flow
  • environment.ErrNotFound / environment.ErrNameNotSpecified / environment.ErrDefaultEnvironmentNotFound — agent could help create or select an environment
  • pipeline.ErrAuthNotSupported / pipeline.ErrRemoteHostIsNotAzDo / pipeline.ErrRemoteHostIsNotGitHub — agent could suggest configuration changes

MachineContextError (potentially fixable)

Some machine-context errors that could be auto-remediated:

  • tools.MissingToolErrors — agent could suggest or run install commands
  • tools.ErrSemver (version mismatch) — agent could suggest upgrade commands
  • maven.ErrPropertyNotFound — agent could help fix Maven configuration

Action Items

  • Review each error in UserContextError and MachineContextError categories
  • Determine which errors the Copilot SDK agent can realistically fix or guide the user through
  • Introduce a sub-classification (e.g., Fixable vs NonFixable) or promote fixable errors to AzureContextAndOtherError
  • Update classifyError() logic and corresponding tests in error_test.go

Context

  • Error classification: cli/azd/cmd/middleware/error.go (lines 55-116)
  • Tests: cli/azd/cmd/middleware/error_test.go
  • The three categories today: AzureContextAndOtherError (agentic fix), MachineContextError (local env), UserContextError (user config/auth)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions