Skip to content

Emit new Worker config for same-worker Workflows - #15856

Merged
Naapperas merged 9 commits into
mainfrom
nunopereira/workflows-ctx-exports-miniflare
Sep 27, 2026
Merged

Naapperas merged 9 commits into
mainfrom
nunopereira/workflows-ctx-exports-miniflare

Conversation

@Naapperas

@Naapperas Naapperas commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Implements the Miniflare side of cloudflare/workerd#7361, which implements support in workerd for running same-worker Workflows


A picture of a cute animal (not mandatory, but encouraged)

@changeset-bot

changeset-bot Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 387a25b

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

This PR includes changesets to release 9 packages
Name Type
miniflare Minor
@cloudflare/workflows-shared Minor
@cloudflare/vitest-plugin Minor
@cloudflare/vite-plugin Minor
wrangler Minor
@cloudflare/deploy-helpers Patch
@cloudflare/pages-shared Patch
@cloudflare/remote-bindings Patch
@cloudflare/runtime-types 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

@pkg-pr-new

pkg-pr-new Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

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

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@15856

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@15856

@cloudflare/config

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

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@15856

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@15856

@cloudflare/pages-shared

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

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@15856

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@15856

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 387a25b

@ask-bonk

ask-bonk Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

@Naapperas Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

@ask-bonk

ask-bonk Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Export-only workflows never enter bindingIdMap.workflows: that map is still populated solely from env workflow proxy bindings. Consequently a Worker that uses only ctx.exports.MyWorkflow has no /api/workflows entry and the Local Explorer cannot inspect or create its instances. The added test masks this by also configuring MY_WORKFLOW. Add explorer bindings and map entries for exports that do not already have an env binding.

		workflowExporters,
		telemetry,
		observabilityEnabled,
		sharedOptions,
	} = options;
	const workflowProxyBindings = proxyBindings.filter((binding) =>
		binding.name?.startsWith(
			`${CoreBindings.DURABLE_OBJECT_NAMESPACE_PROXY}:workflows:`
		)
	);

	for (const [workflowName, exporter] of workflowExporters) {
		if (bindingIdMap.workflows[workflowName] !== undefined) {
			continue;
		}

		const binding = `${CoreBindings.DURABLE_OBJECT_NAMESPACE_PROXY}:workflows:exports:${workflowName}`;
		bindingIdMap.workflows[workflowName] = {
			name: workflowName,
			className: exporter.className,
			scriptName: exporter.workerName,
			binding,
			engineBinding: `EXPLORER_WORKFLOW_ENGINE_${workflowName}`,
		};
		workflowProxyBindings.push({
			name: binding,
			wrapped: {
				moduleName: "workflows:local-wrapped-binding",
				innerBindings: [
					{
						name: "binding",
						service: {
							name: `workflows:${workflowName}`,
							entrypoint: "WorkflowBinding",
						},
					},
				],
			},
		});
	}

@ask-bonk

ask-bonk Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

I'm Bonk, and I've done a quick review of your PR.

Adds local ctx.exports Workflow support across Miniflare integrations.

  1. P2: Local Explorer omits workflows declared only in exports; suggestion posted in the PR comment.

github run

@Naapperas
Naapperas marked this pull request as ready for review September 24, 2026 23:31
@workers-devprod
workers-devprod requested review from a team and cjol and removed request for a team September 24, 2026 23:31
@workers-devprod

workers-devprod commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/workflows
  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 1 potential issue.

Devin Review

Comment thread packages/miniflare/src/plugins/core/index.ts
@Naapperas
Naapperas force-pushed the nunopereira/workflows-ctx-exports-miniflare branch 2 times, most recently from 41a3da3 to b179354 Compare September 25, 2026 17:23

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 0 new potential issues.

Devin Review

@Naapperas
Naapperas force-pushed the nunopereira/workflows-ctx-exports-miniflare branch from b179354 to e108720 Compare September 25, 2026 18:36

@jamesopstad jamesopstad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! workerd has been bumped to the latest version on main so you should be able to rebase and then merge.

Comment thread packages/miniflare/src/plugins/core/index.ts
@Naapperas
Naapperas force-pushed the nunopereira/workflows-ctx-exports-miniflare branch from e108720 to 387a25b Compare September 27, 2026 09:31

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Devin Review

Comment thread packages/miniflare/src/plugins/core/index.ts
@Naapperas
Naapperas enabled auto-merge (squash) September 27, 2026 10:04
@Naapperas
Naapperas merged commit 4c2993b into main Sep 27, 2026
70 of 71 checks passed
@Naapperas
Naapperas deleted the nunopereira/workflows-ctx-exports-miniflare branch September 27, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants