Problem
In packages/durabletask-js/src/tracing/trace-helper.ts, the setOrchestrationStatusFromActions() function reads the error message for failed orchestration spans from completeAction.getResult()?.getValue() (line 695).
However, when an orchestration fails, the runtime sets failure information in failureDetails, not in result:
setFailed() in runtime-orchestration-context.ts (line 230) calls newCompleteOrchestrationAction(id, FAILED, undefined, failureDetails) — the result parameter is undefined.
- The worker's error handler in
task-hub-grpc-worker.ts similarly creates the action with result = undefined.
This means completeAction.getResult() is always undefined for failed orchestrations, and the span error message always falls through to the generic "Orchestration failed" fallback — losing the actual error message.
Root Cause
The tracing code was written to read from the result field, but the orchestration runtime stores failure information in the failureDetails field (via TaskFailureDetails.errorMessage). These are separate protobuf fields on CompleteOrchestrationAction.
Proposed Fix
Update setOrchestrationStatusFromActions() to read the error message from failureDetails.getErrormessage() first, falling back to result.getValue() for backwards compatibility, then to the default.
Fix the existing test (which artificially set result on the failed action instead of failureDetails) and add tests for the fallback chain.
Impact
Severity: Medium. Every failed orchestration produces a generic "Orchestration failed" OpenTelemetry span message instead of the actual error. This reduces the diagnostic value of traces significantly for debugging orchestration failures.
Problem
In
packages/durabletask-js/src/tracing/trace-helper.ts, thesetOrchestrationStatusFromActions()function reads the error message for failed orchestration spans fromcompleteAction.getResult()?.getValue()(line 695).However, when an orchestration fails, the runtime sets failure information in
failureDetails, not inresult:setFailed()inruntime-orchestration-context.ts(line 230) callsnewCompleteOrchestrationAction(id, FAILED, undefined, failureDetails)— theresultparameter isundefined.task-hub-grpc-worker.tssimilarly creates the action withresult = undefined.This means
completeAction.getResult()is alwaysundefinedfor failed orchestrations, and the span error message always falls through to the generic"Orchestration failed"fallback — losing the actual error message.Root Cause
The tracing code was written to read from the
resultfield, but the orchestration runtime stores failure information in thefailureDetailsfield (viaTaskFailureDetails.errorMessage). These are separate protobuf fields onCompleteOrchestrationAction.Proposed Fix
Update
setOrchestrationStatusFromActions()to read the error message fromfailureDetails.getErrormessage()first, falling back toresult.getValue()for backwards compatibility, then to the default.Fix the existing test (which artificially set
resulton the failed action instead offailureDetails) and add tests for the fallback chain.Impact
Severity: Medium. Every failed orchestration produces a generic "Orchestration failed" OpenTelemetry span message instead of the actual error. This reduces the diagnostic value of traces significantly for debugging orchestration failures.