You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR introduces a complete Cloudflare Workers world implementation for the Workflow DevKit, enabling workflow execution on Cloudflare's serverless platform using Durable Objects for state management, D1 for cross-run queries, and Cloudflare Queues for message dispatch.
Key Changes
WorkflowRunDO (Durable Object): A comprehensive per-run state machine that handles:
Event processing and validation with full state transition logic
Run, step, hook, and wait entity management
Stream chunk storage and retrieval for large data handling
Legacy spec version compatibility
Idempotent event handling and terminal state enforcement
Storage Layer: Implements the Storage interface with:
Run listing via D1 index with fallback to Durable Objects for full data
Event creation and retrieval routed through per-run DOs
Hook and step management with cross-run query support via D1
Queue Integration:
Message envelope format for Cloudflare Queues
Queue handler registration and batch processing
Integration with local world executor for handler execution
D1 Index Schema: Lightweight global index tables for:
Workflow runs (with filtering by name/status)
Workflow hooks (with token-based lookup)
Automatic index updates on run mutations
Streaming Support: Stream chunk storage in Durable Object storage with:
Multi-chunk write operations
Stream closure and metadata tracking
Byte-range read support
Configuration & Utilities:
Type-safe config interface for Cloudflare bindings
Durable Object stub management and fetch helpers
ISO date serialization utilities
Notable Implementation Details
Event processing logic ported from world-postgres with full validation including version compatibility checks, terminal state enforcement, and idempotent operations
Hybrid storage model: DO storage for per-run data, D1 for global queries with intelligent fallback
Monotonic ULID generation for deterministic ordering
Comprehensive error handling with proper HTTP status codes (404, 409, 410, 425)
Data filtering support (resolveData parameter) to exclude input/output when not needed
Implements a Workflow DevKit world backend using Cloudflare primitives:
- Durable Objects for per-run state (events, steps, hooks, waits, streams)
- D1 SQLite for cross-run index queries (runs.list, hooks.getByToken)
- Cloudflare Queues for reliable message dispatch
https://claude.ai/code/session_019jYBQA1pNTDjK4LGt8qFKA
- Fix run_created with null runId: generate runId client-side so routing
key and stored runId map to the same DO instance; temp random keys routed
to a different instance making run data permanently unretrievable
- Fix listStreamsByRunId: prefix returned names with `runId:` to match
the format expected by readFromStream
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
We love seeing World contributions. The approach we're taking with community Worlds is that we'd like them to be published as third-party Worlds, which we then add/advertise on our list of Worlds. In order to get on this list, all you need is:
Publish your World as an npm package
Make a PR to our docs and the world-manifest.json file in this repo adding yourself
Once that's done, we'll verify whether the package works, is deployable/redeployable, and passes at least basic workflow e2e tests. If that looks good, we'll merge the PR! If your package gets significant community attention, we may consider moving to first-party support inside the workflow repository.
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
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.
Summary
This PR introduces a complete Cloudflare Workers world implementation for the Workflow DevKit, enabling workflow execution on Cloudflare's serverless platform using Durable Objects for state management, D1 for cross-run queries, and Cloudflare Queues for message dispatch.
Key Changes
WorkflowRunDO (Durable Object): A comprehensive per-run state machine that handles:
Storage Layer: Implements the Storage interface with:
Queue Integration:
D1 Index Schema: Lightweight global index tables for:
Streaming Support: Stream chunk storage in Durable Object storage with:
Configuration & Utilities:
Notable Implementation Details
https://claude.ai/code/session_019jYBQA1pNTDjK4LGt8qFKA