Problem
The client-facing OrchestrationStatus enum in packages/durabletask-js/src/orchestration/enum/orchestration-status.enum.ts (line 27-35) is missing the CANCELED member, even though the protobuf definition includes ORCHESTRATION_STATUS_CANCELED = 4.
This causes fromProtobuf() to throw "Unknown protobuf OrchestrationStatus value: 4" when encountering any orchestration with the CANCELED status. Since fromProtobuf() is called by newOrchestrationState(), this crashes every client operation that reads orchestration state:
getOrchestration()
waitForOrchestrationCompletion()
getAllInstances() / listInstances()
Additionally:
InMemoryOrchestrationBackend.toClientStatus() silently maps CANCELED to RUNNING (incorrect)
isTerminalStatus() in both InMemoryOrchestrationBackend and TestOrchestrationClient does not include CANCELED, so waitForCompletion() never returns for canceled orchestrations in the test backend
Root Cause
When the OrchestrationStatus enum was defined, the CANCELED member was omitted. All other proto status values (RUNNING, COMPLETED, CONTINUED_AS_NEW, FAILED, TERMINATED, PENDING, SUSPENDED) have corresponding client enum members, but ORCHESTRATION_STATUS_CANCELED = 4 does not.
Proposed Fix
- Add
CANCELED = pb.OrchestrationStatus.ORCHESTRATION_STATUS_CANCELED to the OrchestrationStatus enum (the existing initialization loop auto-registers it in conversion maps)
- Add CANCELED case to
InMemoryOrchestrationBackend.toClientStatus()
- Add CANCELED to
isTerminalStatus() in both InMemoryOrchestrationBackend and TestOrchestrationClient
- Add comprehensive tests for OrchestrationStatus enum conversions
Impact
Severity: Medium-High. Any orchestration that enters the CANCELED state (via the sidecar, another SDK, or future API) would cause the JS client to crash with an unhandled error when querying or listing orchestrations. This prevents interop with other SDKs that may use the CANCELED status.
Problem
The client-facing
OrchestrationStatusenum inpackages/durabletask-js/src/orchestration/enum/orchestration-status.enum.ts(line 27-35) is missing theCANCELEDmember, even though the protobuf definition includesORCHESTRATION_STATUS_CANCELED = 4.This causes
fromProtobuf()to throw"Unknown protobuf OrchestrationStatus value: 4"when encountering any orchestration with the CANCELED status. SincefromProtobuf()is called bynewOrchestrationState(), this crashes every client operation that reads orchestration state:getOrchestration()waitForOrchestrationCompletion()getAllInstances()/listInstances()Additionally:
InMemoryOrchestrationBackend.toClientStatus()silently maps CANCELED to RUNNING (incorrect)isTerminalStatus()in bothInMemoryOrchestrationBackendandTestOrchestrationClientdoes not include CANCELED, sowaitForCompletion()never returns for canceled orchestrations in the test backendRoot Cause
When the
OrchestrationStatusenum was defined, theCANCELEDmember was omitted. All other proto status values (RUNNING, COMPLETED, CONTINUED_AS_NEW, FAILED, TERMINATED, PENDING, SUSPENDED) have corresponding client enum members, butORCHESTRATION_STATUS_CANCELED = 4does not.Proposed Fix
CANCELED = pb.OrchestrationStatus.ORCHESTRATION_STATUS_CANCELEDto theOrchestrationStatusenum (the existing initialization loop auto-registers it in conversion maps)InMemoryOrchestrationBackend.toClientStatus()isTerminalStatus()in bothInMemoryOrchestrationBackendandTestOrchestrationClientImpact
Severity: Medium-High. Any orchestration that enters the CANCELED state (via the sidecar, another SDK, or future API) would cause the JS client to crash with an unhandled error when querying or listing orchestrations. This prevents interop with other SDKs that may use the CANCELED status.