Skip to content

[prototype] Add experimental config workflow exports#14693

Draft
ericclemmons wants to merge 5 commits into
mainfrom
codex/workflow-experimental-config
Draft

[prototype] Add experimental config workflow exports#14693
ericclemmons wants to merge 5 commits into
mainfrom
codex/workflow-experimental-config

Conversation

@ericclemmons

@ericclemmons ericclemmons commented Jul 14, 2026

Copy link
Copy Markdown
Member

Summary

  • Add exports.workflow() to the experimental config API for declaring Workflows owned by a Worker.
  • Add typed cross-Worker Workflow bindings through defineWorker(...).workflow() and bindings.workflow().
  • Carry Workflow exports through validation, upload metadata, conflict detection, deployment, local Miniflare, type generation, and Vite export discovery.

Manual validation

Use the existing fixtures/experimental-new-config fixture with a unique Worker and Workflow name.

  1. In fixtures/experimental-new-config/cloudflare.config.ts, import exports, give the Worker a disposable unique name, and add the Workflow export:

    import {
      bindings,
      defineWorker,
      exports,
    } from "wrangler/experimental-config";
    
    // Inside defineWorker(...):
    name: "<YOUR_UNIQUE_WORKER_NAME>",
    exports: {
      ConfigWorkflow: exports.workflow({
        name: "<YOUR_UNIQUE_WORKFLOW_NAME>",
        limits: { steps: 10 },
      }),
    },
  2. In fixtures/experimental-new-config/src/index.ts, export the matching Workflow class:

    import { env, WorkflowEntrypoint } from "cloudflare:workers";
    
    export class ConfigWorkflow extends WorkflowEntrypoint {
      override async run() {
        return "experimental config workflow completed";
      }
    }
  3. Start local development from the repository root:

    pnpm --dir fixtures/experimental-new-config dev
Screenshot 2026-07-14 at 6 56 01 PM
  1. In another terminal, trigger and inspect the locally simulated Workflow:

    pnpm --dir fixtures/experimental-new-config exec wrangler workflows trigger <YOUR_UNIQUE_WORKFLOW_NAME> --local
    pnpm --dir fixtures/experimental-new-config exec wrangler workflows instances list <YOUR_UNIQUE_WORKFLOW_NAME> --local

    Expected: wrangler dev starts without a legacy workflows binding, the trigger creates an instance, and the instance completes.

 ⛅️ wrangler 4.110.0
────────────────────
🚀 Workflow instance "c67f4e3b-d730-4224-814b-2ce2e600e64a" has been triggered successfully
 ⛅️ wrangler 4.110.0
────────────────────
Showing 2 instances from page 1:
┌──────────────────────────────────────┬───────────────────────┬──────────────┐
│ Instance ID                          │ Created               │ Status       │
├──────────────────────────────────────┼───────────────────────┼──────────────┤
│ c67f4e3b-d730-4224-814b-2ce2e600e64a │ 7/14/2026, 6:59:06 PM │ ✅ Completed │
├──────────────────────────────────────┼───────────────────────┼──────────────┤
│ 80487f9a-7cdd-4637-824f-dc604df87c4e │ 7/14/2026, 6:55:50 PM │ ✅ Completed │
└──────────────────────────────────────┴───────────────────────┴──────────────┘
  1. Deploy the disposable Worker and verify the production API contract:

    pnpm --dir fixtures/experimental-new-config run deploy
    pnpm --dir fixtures/experimental-new-config exec wrangler workflows describe <YOUR_UNIQUE_WORKFLOW_NAME>
    pnpm --dir fixtures/experimental-new-config exec wrangler workflows trigger <YOUR_UNIQUE_WORKFLOW_NAME>
    pnpm --dir fixtures/experimental-new-config exec wrangler workflows instances list <YOUR_UNIQUE_WORKFLOW_NAME>

    Expected: deploy provisions the Workflow using export class ConfigWorkflow, describe reports the configured Worker/class and step limit, and a remotely triggered instance completes.

 ⛅️ wrangler 4.110.0
────────────────────
Total Upload: 0.63 KiB / gzip: 0.38 KiB
Your Worker has access to the following bindings:
Binding                                    Resource                  
env.MY_TEXT ("The mode is undefined")      Environment Variable      

Uploaded experimental-new-config (1.09 sec)
Deployed experimental-new-config triggers (2.64 sec)
  https://experimental-new-config.eclemmons-individual-account.workers.dev
  workflow: my-workflow
Current Version ID: 47a5e3ef-aa24-432b-b65a-41a5e535b09c
 ⛅️ wrangler 4.110.0
────────────────────
🚀 Workflow instance "d8e61a62-31b1-4d30-a8aa-a4585ace4d03" has been queued successfully
 ⛅️ wrangler 4.110.0
────────────────────
Showing 1 instance from page 1:
┌──────────────────────────────────────┬──────────────────────────────────────┬───────────────────────┬───────────────────────┬───────────┐
│ Instance ID                          │ Version                              │ Created               │ Modified              │ Status    │
├──────────────────────────────────────┼──────────────────────────────────────┼───────────────────────┼───────────────────────┼───────────┤
│ d8e61a62-31b1-4d30-a8aa-a4585ace4d03 │ c20efc9a-6d8a-4b0a-bc4d-8bd84fde57c7 │ 7/14/2026, 7:18:17 PM │ 7/14/2026, 7:18:19 PM │ ▶ Running │
└──────────────────────────────────────┴──────────────────────────────────────┴───────────────────────┴───────────────────────┴───────────┘
Screenshot 2026-07-14 at 7 20 31 PM
  1. Clean up the disposable resources:

    pnpm --dir fixtures/experimental-new-config exec wrangler workflows delete <YOUR_UNIQUE_WORKFLOW_NAME>
    pnpm --dir fixtures/experimental-new-config exec wrangler delete --name <YOUR_UNIQUE_WORKER_NAME>
 ⛅️ wrangler 4.110.0
────────────────────
✅ Workflow "my-workflow" removed successfully. 
 ⛅️ wrangler 4.110.0
────────────────────
✔ Are you sure you want to delete experimental-new-config? This action cannot be undone. … yes
Successfully deleted experimental-new-config

Automated validation

  • pnpm check — 194/194 tasks passed.
  • Added and updated tests across config conversion/schema validation, deploy helpers, Workflow conflict handling, upload metadata, Miniflare options, type generation, and Vite export discovery.

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this exposes the already documented Workflows model through the experimental configuration API; dedicated experimental-config documentation will follow that API's release process.

@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 94e5240

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
wrangler Minor
@cloudflare/vite-plugin Minor
@cloudflare/vitest-pool-workers Patch

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

@ericclemmons ericclemmons self-assigned this Jul 14, 2026
@ericclemmons
ericclemmons force-pushed the codex/workflow-experimental-config branch from c786db9 to 711a134 Compare July 14, 2026 23:44
@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Jul 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@pkg-pr-new

pkg-pr-new Bot commented Jul 14, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@14693

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@14693

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14693

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14693

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14693

miniflare

npm i https://pkg.pr.new/miniflare@14693

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14693

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14693

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14693

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14693

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14693

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@14693

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14693

wrangler

npm i https://pkg.pr.new/wrangler@14693

commit: 94e5240

@ericclemmons ericclemmons changed the title [workers-sdk] Add experimental config workflow exports [prototype] Add experimental config workflow exports Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants