Skip to content

workflows instances get/delete: no 'latest' instance ID alias #167

Open

Description

@MattieTK

Summary

wrangler workflows instances describe <WORKFLOW_NAME> latest and wrangler workflows instances delete <WORKFLOW_NAME> latest accept latest as a convenience alias to target the most recently created instance.

In cf, cf workflows instances get <INSTANCE_ID> and cf workflows instances delete <INSTANCE_ID> pass <instance-id> directly to the REST API path (/instances/<instance-id>), so users have to run cf workflows instances list --workflow-name <NAME> first and copy an instance ID every time they test a Workflow run.

Expected behaviour

Support latest (or a --latest flag) on cf workflows instances get and cf workflows instances delete (and ideally status-change commands such as pause/resume/terminate) by resolving the most recent instance for --workflow-name:

cf workflows instances get latest --workflow-name my-workflow
# Resolves the most recently created instance ID for my-workflow and returns its status and step logs:
# {
#   "id": "<LATEST_INSTANCE_ID>",
#   "status": "complete",
#   "steps": [...]
# }

Reproduction

cf workflows instances get latest --workflow-name my-workflow --dry-run

Actual output (sends literal "latest" as the instance ID path parameter):

{
  "command": "cf workflows instances get",
  "method": "GET",
  "url": "https://api.cloudflare.com/client/v4/accounts/<account-id>/workflows/my-workflow/instances/latest",
  "pathParams": {
    "workflow-name": "my-workflow",
    "instance-id": "latest"
  },
  "query": {},
  "bodyKind": "none"
}

Docs impact

Found while migrating the Workflows documentation to cf:

  • /workflows/get-started/guide/
  • /workflows/get-started/durable-agents/
  • /workflows/build/trigger-workflows/
  • /workflows/reference/wrangler-commands/

Environment

  • cf: 1.0.0-rc.2
  • Node.js: 24.22.3
  • OS: macOS 26.7.3 (arm64)

Activity

  1. petebacondarwin commented on Nov 20, 2026

    @petebacondarwin
    Contributor

    cf workflows instances get latest --workflow-name my-workflow sends latest unchanged, and the Workflows backend treats it as a literal instance ID. The ID doesn’t have to be a SHA; it can be a user-supplied string. (developers.cloudflare.com)

    Wrangler resolves it client-side. wrangler workflows instances describe my-workflow latest (or just describe my-workflow) fetches the first page of instances, sorts it by created_on newest-first, and requests details using the first result’s actual ID. It errors if the list is empty. An explicit ID skips the list request. (raw.githubusercontent.com)

  2. petebacondarwin commented on Nov 20, 2026

    @petebacondarwin
    Contributor

    While it is tempting to try to fix this clientside for cf similar to what wrangler does, I think the correct fix is at the API level. Either with a new entrypoint or a param (e.g. --latest).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions