Skip to content

fix(wrangler): don't report rollback success after declining changed secrets confirmation - #16269

Closed
yomna-shousha wants to merge 1 commit into
mainfrom
fix/rollback-abort-reports-success
Closed

yomna-shousha wants to merge 1 commit into
mainfrom
fix/rollback-abort-reports-success

Conversation

@yomna-shousha

Copy link
Copy Markdown
Contributor

Fixes the "Cancelled rollbacks are reported as successful" pain point from the internal Versioned Secrets pain points doc (no GH issue).

When wrangler rollback hits the changed-secrets check (API error 10220) and the user declines the "The following secrets have changed…" confirmation, Wrangler printed Aborting rollback... but then fell through to the success path:

╰  X  Aborting rollback...
╰  SUCCESS  Worker Version <id> has been deployed to 100% of traffic.
Current Version ID: <id>

No deployment is made (the original version stays live, as confirmed with wrangler deployments status), but the output and the "Current Version ID" line say otherwise. I reproduced this against a real Worker with wrangler 4.151.0.

Changes

  • versions/rollback/index.ts: return after cli.cancel("Aborting rollback...") in the changed-secrets branch, matching how declining the first "Are you sure…" prompt already behaves.
  • rollback.test.ts:
    • New test: declining the changed-secrets confirmation makes exactly one deploy request (no forced retry), prints Aborting rollback..., and prints no success message or Current Version ID. Fails without the fix.
    • Fixed the existing changed-secrets tests, which never reached the secrets prompt:
      • They didn't run as a TTY, so confirm() used the non-interactive fallback (yes) instead of the mocks.
      • The ?force=true handler was registered last, and msw ignores query strings and checks the most recently registered handler first, so it answered the first (non-forced) request and the 10220 path never ran. Handlers are now registered in the right order.
    • Added afterEach(clearDialogs) (as other test files do) so unused prompt mocks fail the test. With the original test file, all three tests fail this check.

Not changed (open question)

A cancelled rollback still exits with code 0, the same as declining the first prompt. That means automation can't tell a cancel from a success by exit code. Exiting non-zero on both cancel paths would fix that, but it's a behaviour change, so I've left it out of this PR. Happy to add it if maintainers agree.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: bug fix to CLI output, no documented behaviour changes

Note

This is a contribution from an AI agent: OpenCode, Claude Opus 5.5, under human supervision.

@ask-bonk

ask-bonk Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@pkg-pr-new

pkg-pr-new Bot commented Oct 14, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

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

@cloudflare/build-output-utils

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

@cloudflare/codemods

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

@cloudflare/config

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

@cloudflare/containers-shared

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

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

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

@cloudflare/pages-shared

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

@cloudflare/runtime-types

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-plugin

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

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 276005f

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.

1 participant