fix(azd): preserve system error attribution - #9810
Conversation
|
Azure Pipelines: Successfully started running 4 pipeline(s). 23 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Add direct extension invocation metadata, structured error transport, typed tool failures, and stable core classifications so hosted-agent deployment failures can be attributed without inferring ownership from installed-extension inventory. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
29ce68f to
f5d44a8
Compare
|
Azure Pipelines: Successfully started running 1 pipeline(s). 21 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
Relayed gRPC metadata is lost on reserialization, and telemetry bounds and validation are incomplete.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Preserves extension failure attribution and structured error metadata across azd’s gRPC and telemetry boundaries.
Changes:
- Adds extension invocation, error-chain, mapper, gRPC, and tool-failure attribution.
- Extends the protobuf error contract with cause and tool details.
- Updates tests, telemetry documentation, and privacy records.
File summaries
| File | Description |
|---|---|
docs/specs/metrics-audit/telemetry-schema.md |
Documents new telemetry contracts. |
docs/specs/metrics-audit/privacy-review-checklist.md |
Records privacy decisions. |
docs/specs/metrics-audit/feature-telemetry-matrix.md |
Maps extension failure telemetry. |
docs/reference/telemetry-data.md |
Updates public telemetry reference. |
cli/azd/pkg/extensions/runner.go |
Adds extension version attribution. |
cli/azd/pkg/extensions/runner_test.go |
Tests runner attribution. |
cli/azd/pkg/extensions/invocation_error.go |
Introduces invocation metadata wrappers. |
cli/azd/pkg/extensions/invocation_error_test.go |
Tests wrapper behavior. |
cli/azd/pkg/extensions/extension.go |
Attributes reported extension errors. |
cli/azd/pkg/extensions/extension_test.go |
Tests reported-error metadata. |
cli/azd/pkg/exec/command_name.go |
Extracts normalized tool names. |
cli/azd/pkg/errorchain/errorchain.go |
Adds public error-chain utilities. |
cli/azd/pkg/errorchain/errorchain_test.go |
Tests error-chain normalization. |
cli/azd/pkg/azdext/run.go |
Supports structured tool errors. |
cli/azd/pkg/azdext/run_test.go |
Tests tool error helpers. |
cli/azd/pkg/azdext/extension_error.go |
Extends structured error transport. |
cli/azd/pkg/azdext/extension_error_test.go |
Tests transport round trips. |
cli/azd/pkg/azdext/errors.pb.go |
Regenerates protobuf bindings. |
cli/azd/internal/tracing/fields/fields.go |
Defines mapper telemetry fields. |
cli/azd/internal/tracing/errchain/errchain.go |
Delegates to public utilities. |
cli/azd/internal/tracing/errchain/errchain_test.go |
Updates cycle-safety tests. |
cli/azd/internal/mapper/errors.go |
Exposes mapper type diagnostics. |
cli/azd/internal/mapper/errors_test.go |
Tests mapper diagnostics. |
cli/azd/internal/grpcserver/server_test.go |
Tests tool-error relay. |
cli/azd/internal/grpcserver/event_service.go |
Adds lifecycle invocation attribution. |
cli/azd/internal/grpcserver/event_service_test.go |
Tests lifecycle metadata. |
cli/azd/internal/grpcserver/errors.go |
Relays structured tool details. |
cli/azd/internal/grpcserver/container_service.go |
Maps container tool failures. |
cli/azd/internal/grpcserver/container_service_test.go |
Tests container error mapping. |
cli/azd/internal/cmd/errors.go |
Expands telemetry classification. |
cli/azd/internal/cmd/errors_test.go |
Tests new classifications. |
cli/azd/grpc/proto/errors.proto |
Adds cause and tool error messages. |
cli/azd/docs/extensions/extensions-style-guide.md |
Documents structured tool errors. |
cli/azd/docs/extensions/extension-sdk-reference.md |
Updates SDK error reference. |
cli/azd/.vscode/cspell.yaml |
Adds errorchain spelling. |
Review details
Files not reviewed (1)
- cli/azd/pkg/azdext/errors.pb.go: Generated file
- Files reviewed: 34/35 changed files
- Comments generated: 7
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
There was a problem hiding this comment.
🟡 Changes recommended
Relayed cause metadata can be lost, process telemetry remains insufficiently bounded, and the protobuf contract has compatibility and scaffold gaps.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Files not reviewed (1)
- cli/azd/pkg/azdext/errors.pb.go: Generated file
Suppressed comments (1)
cli/azd/grpc/proto/errors.proto:39
int32cannot represent every Windows process exit status: Windows exposes a 32-bit unsigned code, and common values such as0xC0000135exceedmath.MaxInt32. The conversion inWrapErrortherefore changes these codes into negative values during transport. Use anint64wire field and regenerate/update the Go mapping so the SDK'sintvalue round-trips losslessly on supported 64-bit platforms.
optional int32 exit_code = 3; // Process exit code when the tool ran and failed
- Files reviewed: 36/37 changed files
- Comments generated: 6
- Review effort level: Balanced
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Summary
extension.id,extension.version, and lifecycle event.Local,Service, andToolerror metadata now crosses the extension gRPC boundary. This includes bounded cause types and tool failure details.extension.installedremains an inventory and cohort signal, not proof of runtime ownership.Why this change
Hosted-agent System Errors do not include enough producer or root-cause information to tell whether a failure came from azd, an extension, a service, or a local tool. This PR adds bounded diagnostic metadata without customer content and leaves user-facing error messages unchanged.
The existing classification ladder remains. The new metadata is added at the transport and span boundaries. The protobuf changes are additive and wire-compatible. Typed errors keep their structured details across gRPC, while invocation metadata travels in a wrapper that does not change classification or UX. Cause types and mapper names are validated and bounded before telemetry emission.
The Agents extension currently depends on released azd
v1.32.0, which does not include these SDK APIs. This PR does not make the extension consume them. After the core change is released, a follow-up can update the dependency and add Agents-specific attribution without a temporaryreplacedirective or breaking extension builds.Closes: #9845