[Miniflare][Workflows] Persisted sleepUntil does not complete after setOptions() reload

Open
#16,794 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
node.js, typescript
Domain
backend, testing

Research direction

Start with the linked reproduction script and the referenced timePriorityQueue.ts, then trace how persisted Workflow sleeps are restored and how handleNextAlarm() schedules their wake after setOptions(). Check existing Workflow reload and alarm tests to establish whether this scenario is supported. Done means confirming the expected behavior and reproducing a passing test for completion after reload, or documenting the supported restart API if this path is unsupported.

Written by the indexing model from the issue text.

Description

bug package:miniflare product:workflows
What versions & operating system are you using?

Miniflare 5.20261019.2-beta, workerd 1.20261019.1, Node 24.21.0, Ubuntu 24.04 on WSL2. Worker compatibility date 2026-10-24.

Please provide a link to a minimal reproduction

https://gist.github.com/elijahnsangu/65d857383eff13126ba5cf6205a057d8

Describe the bug

Place miniflare-workflow-reload-repro.mjs in an empty directory and run:

npm install --no-save [email protected]
node miniflare-workflow-reload-repro.mjs

The script starts a Workflow with an absolute deadline of Date.now() + 3000, waits for its checkpoints, pauses and resumes it, then calls setOptions() with the same configuration and persistence directory. It reacquires the binding and looks up the same instance ID.

Expected

If cold reload of active Workflows is supported, the original instance should complete at or after its saved deadline, with its checkpoints intact, within the probe’s five-second boundary.

Observed

The reload completed at 273 ms and fresh bindings were available at 279 ms. The Worker generation changed, and the original instance, deadline, and checkpoints were restored. Its status was running after reload, but the probe never observed completion and exited 1 at Unchanged5000ms probe boundary.

The linked script is a syntax-checked, path-independent adaptation of the probe that produced these observations.

Is this reload scenario supported? If so, could the missing wake be related to handleNextAlarm()? If there is a supported way to exercise a real persisted sleep across a local runtime restart, which API should the test use? Upstream timer source

Dominant language
TypeScript
Stars
4.7k
Forks
1.7k
Avg merge
1d 22h
Merged PRs (30d)
282

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudflare/workers-sdk

All issues in cloudflare/workers-sdk

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.