Skip to content

workflows delete exits 0 when noninteractive confirmation aborts the operation #94

Closed

Description

@matthewbjones

Summary

In [email protected], running cf workflows delete fixture noninteractively without --force prints Aborted. and performs no deletion, but exits with status 0.

A CI job or script checking the exit status therefore treats the requested deletion as successful even though cf refused to execute it.

Minimal reproduction

Requires Bun for installation and Node.js 22.18+ to execute cf. No Cloudflare account, real credentials, project configuration, or existing Workflow is required. The API URL points to an unreachable loopback endpoint, and telemetry is disabled.

mkdir cf-abort-repro
cd cf-abort-repro
printf '{"private":true}
' > package.json
bun add --exact [email protected]

CI=true \
CLOUDFLARE_API_TOKEN=fixture-only \
CLOUDFLARE_ACCOUNT_ID=fixture-only \
CLOUDFLARE_API_BASE_URL=http://127.0.0.1:1/client/v4 \
CF_SEND_TELEMETRY=false \
WRANGLER_SEND_METRICS=false \
DO_NOT_TRACK=1 \
./node_modules/.bin/cf workflows delete fixture </dev/null

printf 'exit code: %s\n' "$?"

Actual result

? This operation permanently deletes the Workflow. Continue?
  (non-interactive; pass --force to confirm)
Aborted.
exit code: 0

Expected result

Keep refusing the destructive operation without confirmation, but return a nonzero exit status when a noninteractive invocation cannot proceed. This lets automation distinguish an aborted command from a successful deletion.

Verification and environment

  • cf: 1.0.0-beta.5
  • Node.js: v24.4.1
  • Bun: 1.4.2
  • macOS
  • Reproduced with stdin closed and stdout/stderr captured, and with the loopback URL above.
  • A separate local mock API test recorded zero requests for this invocation.
  • No real Cloudflare resources were accessed or deleted.

This report is specifically about noninteractive execution; we have not established the intended exit-code semantics for a human declining an interactive prompt.

Activity

  1. added theissue type on Sep 30, 2026
  2. neotan commented on Sep 30, 2026

    @neotan

    There's a fix on my fork: neotan/cf@main...neotan:cf:fix/noninteractive-abort-exit. This repo doesn't accept outside pull requests, so feel free to take it over.

    When a destructive command runs without --force and there's no terminal to ask, cf still prints the same hint but now exits with status 1 instead of 0. Saying no at an interactive prompt still exits 0, since this issue leaves that case open.

    Five R2 tests in the Wrangler compatibility suite only passed because the command stopped at the prompt and never sent its request. They now pass --force, the way their upstream versions confirm the prompt. Wrangler's own queues purge test already expects a failure here, and cf's copy now does too.

    Scripts that relied on getting 0 without --force will start failing, so the changeset is minor and says so.

  3. added a commit that references this issue on Sep 30, 2026
    fe3a771
  4. bradystroud commented on Sep 30, 2026

    @bradystroud

    Also reproduces with cf r2 objects delete on 1.0.0-beta.5 (Node v24.16.0, macOS), so this looks like the shared confirmation path rather than something specific to workflows:

    $ cf r2 objects delete "some/key" --bucket-name my-bucket; echo "exit=$?"
    ? This permanently deletes the specified object from the R2 bucket. Continue?
      (non-interactive; pass --force to confirm)
    Aborted.
    exit=0
    

    The object is still there afterwards (cf r2 objects get succeeds), and with --force the delete works. A script that loops over keys and checks $? reports every delete as successful when none happened.

  5. neotan commented on Sep 30, 2026

    @neotan

    Thanks, that matches what I found. cf r2 objects delete goes through the same confirmation step, so the fix on my branch covers it too. I ran your command against the branch: it now exits 1, while main still exits 0.

  6. added a commit that references this issue on Sep 30, 2026
    f50230d
  7. ferdousbhai commented on Oct 10, 2026

    @ferdousbhai

    Same behaviour in [email protected] for email routing: run without a terminal and without --force, these print the confirmation prompt, then Aborted., change nothing, and exit 0:

    • cf email-routing rules delete <rule-id> -z <zone>
    • cf email-routing disable -z <zone>

    A script deleting several rules therefore reports success for each while none are deleted. That's how we hit it. It looks like the shared non-interactive confirmation path, so it probably affects every command that asks before a destructive change. A non-zero exit when the confirmation aborts would fix all of them.

  8. added a commit that references this issue on Nov 10, 2026
    b45b8ec
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

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions