Skip to content

fix: handle EntityUnlockSent replay events#268

Merged
YunchuWang merged 1 commit into
mainfrom
copilot-finds/bug/fix-entity-unlock-sent-replay
Jun 18, 2026
Merged

fix: handle EntityUnlockSent replay events#268
YunchuWang merged 1 commit into
mainfrom
copilot-finds/bug/fix-entity-unlock-sent-replay

Conversation

@YunchuWang

Copy link
Copy Markdown
Member

Summary

Fixes #235

Copilot AI review requested due to automatic review settings June 11, 2026 20:54
Add missing ENTITYUNLOCKSENT case to the orchestration executor's
processEvent switch statement. Previously, EntityUnlockSent history
events were silently dropped during replay, causing stale unlock
actions to accumulate in _pendingActions and be re-sent to the
sidecar on every subsequent replay of orchestrations using entity
locks.

The fix follows the same validateEntityAction pattern used by all
other entity event handlers (EntityOperationCalled, EntityLockRequested,
etc.) to properly validate and clean up the pending action.

Fixes #235

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@YunchuWang
YunchuWang force-pushed the copilot-finds/bug/fix-entity-unlock-sent-replay branch from 5a63fc0 to 8ad5e98 Compare June 11, 2026 20:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 replay bug in the Durable Task JS orchestration executor by adding explicit handling for EntityUnlockSent history events, ensuring unlock actions emitted during critical-section exit are properly matched and removed from _pendingActions during replay (avoiding duplicate unlock messages being re-sent to the sidecar).

Changes:

  • Add a ENTITYUNLOCKSENT case to the executor event switch and validate/remove the corresponding pending unlock action.
  • Add a regression test that simulates multi-pass replay including EntityUnlockSent and asserts no stale unlock actions are returned.

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/orchestration-executor.ts Adds ENTITYUNLOCKSENT replay handling via validateEntityAction to clear pending unlock actions.
packages/durabletask-js/test/entity-locking.spec.ts Adds a regression test that reproduces replay behavior and verifies unlock actions don’t persist across replays.

@YunchuWang
YunchuWang merged commit dd96051 into main Jun 18, 2026
28 checks passed
@YunchuWang
YunchuWang deleted the copilot-finds/bug/fix-entity-unlock-sent-replay branch June 18, 2026 15:53
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.

[copilot-finds] Bug: Orchestration executor missing EntityUnlockSent handler causes duplicate unlock actions on replay

4 participants