Fix Terminating Pending Orchestration Regression#1288
Draft
Fix Terminating Pending Orchestration Regression#1288
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression when terminating pending orchestrations that haven't completed their first execution round. The issue occurs for pending suborchestrations or orchestrations started by entities, where no instance entity exists yet in Azure Table Storage. The fix changes the Azure Table operation from MergeEntityAsync (which requires the entity to exist) to InsertOrMergeEntityAsync (which creates the entity if it doesn't exist).
Key Changes:
- Updated
UpdateStatusForTerminationAsyncto useInsertOrMergeEntityAsyncinstead ofMergeEntityAsync - Removed the
ETag.Allparameter which is not needed for insert-or-merge operations - Aligns the termination code with other instance status update patterns used elsewhere in the same file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
added 2 commits
December 11, 2025 12:38
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.
When terminating a pending orchestration, I call
MergeEntityAsyncbecause I assume the instance entity already exists. This assumption is incorrect in the case that an orchestration has since been purged after the termination message has been enqueued. This PR adds a check to see if the instance entity exists, and if the execution ID matches that of the termination message's, before attempting to update the entity's status to terminated.Solves #1287