Skip to content

feat(wasm/host): set capability_id on error responses#1934

Closed
vreff wants to merge 1 commit intomainfrom
add-capability-id-to-error-response
Closed

feat(wasm/host): set capability_id on error responses#1934
vreff wants to merge 1 commit intomainfrom
add-capability-id-to-error-response

Conversation

@vreff
Copy link
Contributor

@vreff vreff commented Mar 26, 2026

Summary

Set CapabilityResponse.capability_id when a capability call returns an error in the WASM host.

Motivation

The workflow engine needs to attribute execution failures to specific capabilities in the platform_engine_workflow_execution_failed_count OTel metric. The capability ID is lost when errors cross the WASM boundary because CapabilityResponse_Error was previously just a string. With the new capability_id field added to the proto (smartcontractkit/chainlink-protos#332), the host can now tag error responses.

Changes

  • pkg/workflows/wasm/host/execution.go: Set CapabilityId: req.Id on error responses in callCapAsync
  • go.mod/go.sum: Bump chainlink-protos/cre/go to include the new field

Depends on

Populate the new CapabilityResponse.capability_id field when a capability
call returns an error. This allows the workflow engine to attribute
execution failures to the specific capability that caused them.

Depends on: smartcontractkit/chainlink-protos#332
@vreff vreff requested review from a team as code owners March 26, 2026 18:29
Copilot AI review requested due to automatic review settings March 26, 2026 18:29
@github-actions
Copy link

👋 vreff, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link

📊 API Diff Results

No changes detected for module github.com/smartcontractkit/chainlink-common

View full report

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ensures capability error responses generated by the WASM host preserve the originating capability ID, enabling downstream workflow-engine metrics (e.g., platform_engine_workflow_execution_failed_count) to attribute failures to specific capabilities.

Changes:

  • Populate CapabilityResponse.capability_id when CallCapability returns an error in callCapAsync.
  • Bump github.com/smartcontractkit/chainlink-protos/cre/go to a revision that includes the new proto field.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
pkg/workflows/wasm/host/execution.go Adds CapabilityId: req.Id to host-generated error CapabilityResponses.
go.mod Updates chainlink-protos/cre/go dependency to a newer pseudo-version.
go.sum Updates checksums for the bumped chainlink-protos/cre/go version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 47 to +51
resp = &sdkpb.CapabilityResponse{
Response: &sdkpb.CapabilityResponse_Error{
Error: err.Error(),
},
CapabilityId: req.Id,
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New behavior (wrapping CallCapability errors into a CapabilityResponse and setting CapabilityId) isn’t covered by existing tests. Please add a unit test that mocks ExecutionHelper.CallCapability to return a non-nil err and asserts the awaited response contains Response_Error and CapabilityId == req.Id.

Copilot uses AI. Check for mistakes.
@vreff vreff closed this Mar 26, 2026
@vreff vreff deleted the add-capability-id-to-error-response branch March 26, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants