Skip to content

fix: handle SENDENTITYMESSAGE and TERMINATEORCHESTRATION in InMemoryOrchestrationBackend#327

Open
YunchuWang wants to merge 1 commit into
mainfrom
copilot-finds/bug/in-memory-backend-missing-entity-action-handling
Open

fix: handle SENDENTITYMESSAGE and TERMINATEORCHESTRATION in InMemoryOrchestrationBackend#327
YunchuWang wants to merge 1 commit into
mainfrom
copilot-finds/bug/in-memory-backend-missing-entity-action-handling

Conversation

@YunchuWang

Copy link
Copy Markdown
Member

Fixes #209.

InMemoryOrchestrationBackend crashed on the SENDENTITYMESSAGE and TERMINATEORCHESTRATION action types because they were unhandled. This adds handling for both.


Opens the existing fix branch copilot-finds/bug/in-memory-backend-missing-entity-action-handling as a PR (automated triage of active [copilot-finds] issues that had a ready fix branch but no open PR).

…TYMESSAGE and TERMINATEORCHESTRATION action types

Add handling for SENDENTITYMESSAGE (case 8) and TERMINATEORCHESTRATION (case 7) action
types in InMemoryOrchestrationBackend.processAction(). Previously, orchestrations using
entity signals or terminate-orchestration actions would crash with 'Unexpected action type'
when run against the in-memory testing backend.

- SENDENTITYMESSAGE: No-op (entity signals are fire-and-forget; in-memory backend does not
  simulate entity workers)
- TERMINATEORCHESTRATION: Extracts target instance ID and delegates to existing terminate()
  method
- Adds 3 unit tests verifying entity signal orchestrations complete without crashing

Fixes #209

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 23, 2026 16:39

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

Fixes crashes in the in-memory testing backend by handling additional orchestrator action types that can be produced by entity interactions and orchestration termination.

Changes:

  • Handle SENDENTITYMESSAGE actions in InMemoryOrchestrationBackend.processAction() (acknowledged/no-op).
  • Handle TERMINATEORCHESTRATION actions by terminating the targeted instance.
  • Add unit tests to verify entity signal (fire-and-forget) orchestrations don’t crash when run against the in-memory backend.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/durabletask-js/src/testing/in-memory-backend.ts Adds handling for SENDENTITYMESSAGE and TERMINATEORCHESTRATION orchestrator actions.
packages/durabletask-js/test/in-memory-backend.spec.ts Adds regression tests ensuring entity signaling doesn’t crash the in-memory backend.
Comments suppressed due to low confidence (1)

packages/durabletask-js/src/testing/in-memory-backend.ts:471

  • TERMINATEORCHESTRATION handling is newly added but isn't covered by a unit test (the existing termination test exercises external termination via the test client, not an OrchestratorAction of type TERMINATEORCHESTRATION). Adding a regression test would help ensure this action type doesn't reintroduce crashes.
      case pb.OrchestratorAction.OrchestratoractiontypeCase.TERMINATEORCHESTRATION:
        // Terminate-orchestration actions are used for recursive termination of
        // sub-orchestrations. Process by terminating the target instance.
        this.processTerminateOrchestrationAction(action);
        break;

Comment on lines +654 to +658
try {
this.terminate(targetInstanceId, output);
} catch {
// Target instance may not exist or already terminated - ignore
}
Comment on lines +467 to +471
case pb.OrchestratorAction.OrchestratoractiontypeCase.TERMINATEORCHESTRATION:
// Terminate-orchestration actions are used for recursive termination of
// sub-orchestrations. Process by terminating the target instance.
this.processTerminateOrchestrationAction(action);
break;
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: InMemoryOrchestrationBackend crashes on SENDENTITYMESSAGE and TERMINATEORCHESTRATION action types

3 participants