Skip to content

Conversation

@sophiatev
Copy link
Contributor

@sophiatev sophiatev commented Dec 11, 2025

When terminating a pending orchestration, I call MergeEntityAsync because 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

Copilot AI review requested due to automatic review settings December 11, 2025 20:26
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 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 UpdateStatusForTerminationAsync to use InsertOrMergeEntityAsync instead of MergeEntityAsync
  • Removed the ETag.All parameter 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.

@sophiatev sophiatev marked this pull request as draft December 11, 2025 20:35
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.

2 participants