You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
workflows delete exits 0 when noninteractive confirmation aborts the operation #94
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.
? 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.
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.
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.
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.
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.
Activity
neotan commentedon Sep 30, 2026
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
--forceand 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 ownqueues purgetest already expects a failure here, and cf's copy now does too.Scripts that relied on getting 0 without
--forcewill start failing, so the changeset isminorand says so.fix: exit non-zero when a destructive command is refused without --force
bradystroud commentedon Sep 30, 2026
Also reproduces with
cf r2 objects deleteon 1.0.0-beta.5 (Node v24.16.0, macOS), so this looks like the shared confirmation path rather than something specific to workflows:The object is still there afterwards (
cf r2 objects getsucceeds), and with--forcethe delete works. A script that loops over keys and checks$?reports every delete as successful when none happened.neotan commentedon Sep 30, 2026
Thanks, that matches what I found.
cf r2 objects deletegoes 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, whilemainstill exits 0.fix: exit non-zero when a destructive command is refused without --force
ferdousbhai commentedon Oct 10, 2026
Same behaviour in
[email protected]for email routing: run without a terminal and without--force, these print the confirmation prompt, thenAborted., 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.
fix: exit non-zero when a destructive command is refused without --force