fix: Update instance status on suspend/resume in InMemoryOrchestrationBackend#176
Merged
YunchuWang merged 2 commits intoJun 16, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the in-memory testing backend to better mirror Durable Task Scheduler behavior by immediately reflecting suspend/resume in instance runtime status and unblocking waitForState() predicates when these state transitions occur.
Changes:
- Update
InMemoryOrchestrationBackend.suspend()to set instance status toSUSPENDEDand notify state waiters. - Update
InMemoryOrchestrationBackend.resume()to transition status back toRUNNING(when applicable) and notify state waiters. - Add Jest coverage validating status transitions and buffered-event behavior across suspend/resume.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/durabletask-js/src/testing/in-memory-backend.ts | Updates suspend/resume to adjust instance.status immediately and call notifyWaiters(). |
| packages/durabletask-js/test/in-memory-backend.spec.ts | Adds tests for suspend/resume status updates, buffered events, and waiter notification on suspend. |
You can also share your feedback on Copilot code review. Take the survey.
7708538 to
2299b4b
Compare
Member
Author
|
This PR is behind main by 3 commits. Please rebase on latest main before review. |
2299b4b to
a68e278
Compare
Member
Author
|
Addressed all 3 Copilot review comments:
Also added:
|
…ce status The in-memory backend's suspend() and resume() methods queued the appropriate history events but never updated instance.status, causing getOrchestrationState() to return incorrect status. In the real DTS sidecar, calling the suspend/resume RPCs immediately transitions the orchestration status. This fix aligns the in-memory backend with that behavior: - suspend() now sets status to ORCHESTRATION_STATUS_SUSPENDED and notifies state waiters - resume() now transitions status from SUSPENDED back to RUNNING and notifies state waiters Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- suspend() now returns early for terminal statuses (COMPLETED/FAILED/TERMINATED) - resume() now returns early for terminal and non-suspended instances - Add test: notify state waiters on resume - Add test: suspend on completed instance is no-op - Add test: resume on non-suspended instance is no-op Addresses Copilot review comments. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
6fb3cd0 to
e7d72be
Compare
kaibocai
approved these changes
Jun 16, 2026
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.
Fixes #175
Problem
The InMemoryOrchestrationBackend suspend() and resume() methods queue the appropriate SuspendEvent/ResumeEvent history events but never update instance.status. This causes getOrchestrationState() to return incorrect runtime status.
Changes