[Workflows] Fix: implement workflows instance methods#12881
Merged
pombosilva merged 2 commits intomainfrom Mar 19, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 7b5437b The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
✅ All changesets look good |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
a467471 to
ad6c122
Compare
d5925a6 to
6f8cc6c
Compare
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers |
9695f80 to
3c92208
Compare
penalosa
approved these changes
Mar 18, 2026
Contributor
penalosa
left a comment
There was a problem hiding this comment.
Looks good from the vitest pool & miniflare side, but this also needs a workflows review
avenceslau
approved these changes
Mar 18, 2026
a599e23 to
cd73e7e
Compare
cd73e7e to
86a7d0c
Compare
86a7d0c to
7b5437b
Compare
Merged
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 #12872 that reverted the original #12814 .
The original PR was causing constant Windows CI errors where the workerd process crashed mid tests.
The problem was with the
pause()flow inbinding.test.tstests. Pause makes a void call towaitUntilNothingIsRunningso that running step.do's can finish before actually pausing the instance. The last thingwaitUntilNothingIsRunningdoes is to change the instance status to paused and then aborts the Engine DO. The problem with this is because this is a void call that returns immediately, the actual abort fires later. At that point, no RPC is active and the abort happens in an orphaned context - which makes workerd crash on Windows CI.The fix was to simply propagate Errors, where pause signals Engine instead of aborting - the key is that the throw must happen from inside the workflow's own promise chain where init() can catch it.
Original PR main changes:
Implements the 4 missing Workflow instance lifecycle methods for local dev:
pause(),resume(),restart(), andterminate().pause()setsWaitingForPausestatus, then it checks between steps, stores the pause timestamp, transitions toPaused, and aborts the DO. If there are any pending step.do's these will finish before going toPaused.init().INSTANCE_METADATA, cleans up SQL/KV (preserving modifier keys and mocked event data), writes fresh logs, and firesinit().Terminatedand aborts.Also:
DATETIME('now','subsec')for timestamp precision).WorkflowHandle.status()auto-refreshes stale DO stubs after abort.Also:
Validated step configuration.
Aligned states table schema with production (DATETIME('now','subsec') for timestamp precision).
WorkflowHandle.status() auto-refreshes stale DO stubs after abort.
A picture of a cute animal (not mandatory, but encouraged)