Skip to content

[wrangler] Add Workflows local commands#13097

Merged
petebacondarwin merged 3 commits intomainfrom
osilva/add-local-wrangler-commands-workflows
Mar 30, 2026
Merged

[wrangler] Add Workflows local commands#13097
petebacondarwin merged 3 commits intomainfrom
osilva/add-local-wrangler-commands-workflows

Conversation

@pombosilva
Copy link
Copy Markdown
Contributor

@pombosilva pombosilva commented Mar 27, 2026

Fixes WOR-384.

Adds --local support to all Workflows CLI commands, allowing them to interact with a running wrangler dev session via the /cdn-cgi/explorer/api/workflows endpoints.

Commands:

  • wrangler workflows list --local
  • wrangler workflows describe <name> --local
  • wrangler workflows trigger <name> [params] --local
  • wrangler workflows delete <name> --local
  • wrangler workflows instances list <name> --local
  • wrangler workflows instances describe <name> [id] --local
  • wrangler workflows instances pause <name> <id> --local
  • wrangler workflows instances resume <name> <id> --local
  • wrangler workflows instances restart <name> <id> --local
  • wrangler workflows instances terminate <name> <id> --local
  • wrangler workflows instances send-event <name> <id> --type <type> --local

All commands also accept --port (defaults to 8787) to target a specific wrangler dev session.

NOTE:
Here commands default to production Workflows. Only by adding --local we would be hitting dev Workflows. This is because local and remote here are fundamentally different contexts (as opposed to KV, R2, D1). Remote commands operate on deployed Workflows only. And local commands operate on a running dev session.
We have no "remote mode from local".

  • no flag -> prod Workflows (preserves backward compatibility, no breaking change)
  • --local -> opt-in to target a dev session

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


Open with Devin

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 27, 2026

🦋 Changeset detected

Latest commit: d9d1c04

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

✅ All changesets look good

@pombosilva pombosilva force-pushed the osilva/add-local-wrangler-commands-workflows branch from 769b2fb to 7f9f82a Compare March 27, 2026 18:50
@pombosilva pombosilva marked this pull request as ready for review March 27, 2026 18:52
@pombosilva pombosilva requested a review from a team as a code owner March 27, 2026 18:52
@pombosilva pombosilva requested a review from vicb March 27, 2026 18:52
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Mar 27, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 27, 2026

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

wrangler

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

commit: d9d1c04

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 27, 2026

OK - listWorkflows doesn't support pagination, so it's correct that the workflows list --local handler doesn't try to paginate. The local API returns all workflows in a single response. That's fine -- not a bug.

For instances list --local, the --reverse flag is client-side sorting, and the local path just skips it. This is a minor gap but not a bug per se.

After thorough review, I don't find any actionable bugs, security issues, backward compatibility violations, or incorrect API behavior. The code is well-structured, properly uses encodeURIComponent on path segments, correctly handles the different field names between local and remote APIs (action vs status, id vs instance_id), has comprehensive test coverage for all local commands, and all tests pass.

LGTM

github run

devin-ai-integration[bot]

This comment was marked as resolved.

@pombosilva pombosilva force-pushed the osilva/add-local-wrangler-commands-workflows branch from 7f9f82a to ef9eb32 Compare March 27, 2026 19:05
devin-ai-integration[bot]

This comment was marked as resolved.

@pombosilva pombosilva force-pushed the osilva/add-local-wrangler-commands-workflows branch from ef9eb32 to 1476698 Compare March 30, 2026 09:45
@petebacondarwin petebacondarwin self-assigned this Mar 30, 2026
@petebacondarwin petebacondarwin requested review from petebacondarwin and removed request for vicb March 30, 2026 10:49
Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Approved but I think it would be helpful to add some tests to the workflows fixture that spin up a local wrangler dev and then separately run local wrangler workflow commands against it.
This would give additional confidence that the MSW config is not out of sync.

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Mar 30, 2026
@pombosilva
Copy link
Copy Markdown
Contributor Author

Thanks @petebacondarwin ! Added some fixtures tests to hit the local commands.

@pombosilva pombosilva force-pushed the osilva/add-local-wrangler-commands-workflows branch from 4757d26 to d9d1c04 Compare March 30, 2026 11:58
@petebacondarwin petebacondarwin merged commit cd0e971 into main Mar 30, 2026
57 of 58 checks passed
@petebacondarwin petebacondarwin deleted the osilva/add-local-wrangler-commands-workflows branch March 30, 2026 13:02
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Mar 30, 2026
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