Skip to content

[copilot-finds] Bug: continueAsNew drops fire-and-forget actions (sendEvent, signalEntity) #124

@github-actions

Description

@github-actions

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    copilot-findsFindings from daily automated code review agent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions