Skip to content

fix(mailbox): read the secret list again before calling a secret missing (0.5.1) - #5

Merged
cycle-five merged 1 commit into
masterfrom
fix-secret-list
Nov 20, 2026
Merged

cycle-five merged 1 commit into
masterfrom
fix-secret-list

Conversation

@cycle-five

Copy link
Copy Markdown
Member

Root cause

After each deploy the mailbox tool checks, by name, that the Worker has its required secrets, with one wrangler secret list. For a few seconds after a deploy Cloudflare sometimes answers that command with an empty list and exit code 0. Reproduced on the live account: eight reads one second apart straight after a deploy returned the two secrets seven times and [] once.

With one read, the tool reported existing secrets as missing on three of four Workers during a release. The run exited 1 and the follow-on mailroom deploy was blocked, which is the safe direction. At a terminal it would also have prompted for those secrets, and typing them would have overwritten good values.

Fix

A secret now counts as present once any of up to three reads shows it, two seconds apart; it is reported missing only when all three agree. A Worker that does not exist is still decided by the first answer ("not found" is a different reply from an empty list), so the guards that depend on it are unchanged. status uses the same rule.

Patch release 0.5.1: only packages/mailbox changes; the Workers get the new version number.

Checked

  • npm run typecheck clean; tests: broker-core 48, mailbox-tool 131, discord-broker 65, github-broker 55.
  • New tests: an empty first read after a deploy; a secret seen in any read; a really missing secret after three reads; no prompt at a terminal for a momentarily empty list; status; a Worker that does not exist is not read again. Stopping after the first read fails seven tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_017zqkE8grD6nh1bNnb2r1X8

…ing (0.5.1)

For a few seconds after a deploy Cloudflare sometimes answers `wrangler secret list` with an empty list and exit code 0. The tool read the list once, so it reported existing secrets as missing and, at a terminal, would have prompted for them and overwritten them. A secret now counts as present once any of up to three reads shows it, with two seconds between reads.

Co-Authored-By: Claude & Lothrop (cycle.five@proton.me)
@cycle-five
cycle-five merged commit 26d454b into master Nov 20, 2026
1 check passed
@cycle-five
cycle-five deleted the fix-secret-list branch November 20, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant