Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,9 @@ public async Task CompleteTaskOrchestrationWorkItemAsync(
continuedAsNewMessage,
orchestrationState)));

// update the runtime state and execution id stored in the session
session.UpdateRuntimeState(runtimeState);

Comment on lines +1210 to +1212
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change fixes a subtle race in checkpointing order for ContinueAsNew + extended sessions, but there’s no regression test added to ensure the out-of-order TaskCompleted scenario is handled (message abandoned/retried rather than deleted and leaving the instance stuck). Consider adding an AzureStorage end-to-end test that enables extended sessions and forces trackingStore.UpdateStateAsync to be delayed while an activity completion message is delivered for the new execution ID, asserting the orchestration still completes and no control-queue message is lost.

Copilot uses AI. Check for mistakes.
// First, add new messages into the queue. If a failure happens after this, duplicate messages will
// be written after the retry, but the results of those messages are expected to be de-dup'd later.
// This provider needs to ensure that response messages are not processed until the history a few
Expand All @@ -1231,8 +1234,6 @@ await this.CommitOutboundQueueMessages(
try
{
await this.trackingStore.UpdateStateAsync(runtimeState, workItem.OrchestrationRuntimeState, instanceId, executionId, session.ETags, session.TrackingStoreContext);
// update the runtime state and execution id stored in the session
session.UpdateRuntimeState(runtimeState);

// if we deferred some messages, and the execution id of this instance has changed, redeliver them
if (session.DeferredMessages.Count > 0
Expand Down
Loading