fix: guard setFailed after orchestration completion#267
Merged
YunchuWang merged 1 commit intoJun 12, 2026
Merged
Conversation
…after setComplete() When a NonDeterminismError occurs during replay after the orchestrator generator has already finished (and setComplete was called), setFailed() now removes the previously added completeOrchestration action before adding the FAILED action. This ensures exactly one completion action is returned to the sidecar. Previously, setFailed() would unconditionally add a second completion action, resulting in an invalid response with both COMPLETED and FAILED terminal actions. Fixes #237 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
YunchuWang
force-pushed
the
copilot-finds/bug/fix-setfailed-missing-iscomplete-guard
branch
from
June 11, 2026 20:57
02fb1b6 to
6f6ba65
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a worker-side edge case where RuntimeOrchestrationContext.setFailed() could emit a second terminal completeOrchestration action after the orchestration had already been completed, resulting in an invalid “two terminal actions” response to the sidecar. It aligns setFailed() behavior with the existing double-completion safeguards in the completion paths.
Changes:
- Remove any previously queued
completeOrchestrationaction from_pendingActionswhensetFailed()is invoked after completion. - Add a regression test that simulates replay-time non-determinism leading to
setComplete()followed bysetFailed().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
packages/durabletask-js/src/worker/runtime-orchestration-context.ts |
Ensures setFailed() replaces (rather than duplicates) an existing completion action in _pendingActions. |
packages/durabletask-js/test/orchestration_executor.spec.ts |
Adds a test covering the replay/non-determinism scenario that previously produced duplicate completion actions. |
kaibocai
approved these changes
Jun 12, 2026
YunchuWang
deleted the
copilot-finds/bug/fix-setfailed-missing-iscomplete-guard
branch
June 12, 2026 21:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #237