Fix continueAsNew dropping fire-and-forget actions (sendEvent, signal…#136
Merged
YunchuWang merged 1 commit intomainfrom Mar 5, 2026
Conversation
…Entity) When an orchestration called sendEvent() or signalEntity() before continueAsNew(), those fire-and-forget actions were silently dropped because getActions() returned only the continue-as-new completion action, ignoring all other pending actions. This is inconsistent with setComplete() and setFailed(), which both preserve pending fire-and-forget actions alongside the completion action. The fix makes getActions() include all pending actions when continuing-as-new, matching the behavior of the other completion paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes a core orchestration runtime behavior where continueAsNew() previously caused pending fire-and-forget actions (e.g., sendEvent, signalEntity) to be dropped by getActions(). This aligns the continue-as-new completion path with the existing setComplete() / setFailed() behavior in the Durable Task JS SDK.
Changes:
- Update
RuntimeOrchestrationContext.getActions()to return all pending actions plus the continue-as-new completion action. - Add an in-memory backend regression test validating that
sendEvent()is preserved acrosscontinueAsNew().
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/runtime-orchestration-context.ts | Ensure continue-as-new returns pending actions (fire-and-forget) alongside the completion action. |
| packages/durabletask-js/test/in-memory-backend.spec.ts | Add regression coverage verifying sendEvent is not dropped when continuing-as-new. |
kaibocai
approved these changes
Mar 5, 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.
Fix #124
Problem
When an orchestration calls sendEvent() or signalEntity() before continueAsNew(), those fire-and-forget actions are silently dropped.
File: packages/durabletask-js/src/worker/runtime-orchestration-context.ts
In getActions() (line 243), when the completion status is CONTINUED_AS_NEW, only the single continue-as-new completion action is returned, dropping all other pending actions (including fire-and-forget actions like sendEvent). This is inconsistent with setComplete() (line 195) and setFailed() (line 217), which both preserve pending fire-and-forget actions.
Both setComplete and setFailed have explicit comments:
Note: Do NOT clear pending actions here - fire-and-forget actions like sendEvent must be preserved and returned alongside the complete action
Root Cause
setContinuedAsNew() stores only flags (_newInput, _saveEvents) without adding the completion action to _pendingActions. Then getActions() creates a fresh completion action and returns [action] as the sole item, discarding everything in _pendingActions.
Fix Available
Branch: copilot-finds/bug/continue-as-new-drops-fire-and-forget-actions
The fix modifies getActions() to include all pending actions alongside the continue-as-new completion action. A new unit test verifies that sendEvent actions scheduled before continueAsNew are preserved and delivered.
Summary
What changed?
Why is this change needed?
Issues / work items
Project checklist
CHANGELOG.mdAI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
AI verification (required if AI was used):
Testing
Automated tests
Manual validation (only if runtime/behavior changed)
1.
2.
3.
Notes for reviewers