-
Notifications
You must be signed in to change notification settings - Fork 9
Description
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.
Note: PR creation was blocked by repository permissions (GitHub Actions is not permitted to create PRs). A manual PR can be created from the branch above.