fix(wizard): pass --default=no so default_no prompts actually preselect No - #100
Conversation
…ct No `confirm()` and `toggle()` only passed an explicit flag on their affirmative branch; the negative branch called `gum confirm` bare. gum's `--default` is a bool declared `default:"true"` (confirm/options.go), and confirm/command.go seeds `choice := o.Default`, so omitting the flag preselects Yes. Every `default_no` prompt was therefore landing on Yes — the opposite of its stated default — and a user pressing Enter opted IN. Affected prompts: - "Protect <pack> WebUI with Cognito login? (enterprise-grade)" (:2150) - "Connect KiroCrew to Telegram? ..." (:3411) `toggle()` had the same inversion for any caller passing a false default. Both helpers now pass --default=no explicitly, so neither branch depends on gum's implicit value. bash -n install.sh / uninstall.sh: OK. shellcheck --severity=error: 0 findings. No remaining `$GUM confirm` call site relies on the implicit default.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38d4e02feb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # --default=no is REQUIRED, not redundant: gum's --default is a bool that | ||
| # defaults to true, so omitting it preselects Yes and silently inverts every | ||
| # default_no prompt. | ||
| $GUM confirm --default=no "$text" < /dev/tty || rc=$? |
There was a problem hiding this comment.
Use false for Gum’s boolean default flag
With Gum v0.14.5, --default is a boolean whose explicit value is decoded through Kong’s strconv.ParseBool mapper; the Go documentation lists accepted false values as 0, f, and false, not no. Consequently --default=no is rejected before the TUI opens, and the surrounding || rc=$? silently converts that parse failure into a negative answer. During interactive installs, every default-no prompt—including Cognito, Telegram, AWS CLI updates, quota requests, and some continue/abort paths—therefore becomes impossible to accept; pass --default=false instead.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Thanks — but this is a false positive, and gum's own error message is the disproof.
Gum does not use Kong's stock strconv.ParseBool mapper for this flag; it registers a custom bool mapper. Feeding it a value that mapper rejects makes it enumerate exactly what it accepts:
$ gum confirm --default=f q
gum: error: --default: bool value must be true, 1, yes, false, 0 or no but got "f"
So the accepted set is true, 1, yes, false, 0, no — yes and no are valid, while t and f are the values that get rejected. That is the inverse of what strconv.ParseBool would do, which is what makes the ParseBool premise identifiable as the wrong model here.
Probed across the full range on gum v0.14.5 (linux/arm64), capturing stderr:
| value | parse error? |
|---|---|
no |
none |
false |
none |
0 |
none |
yes |
none |
true |
none |
1 |
none |
f |
rejected |
t |
rejected |
Two further points against the finding as written:
- If
yes/nowere rejected, the pre-existing--default=yeson the affirmative branch — untouched by this PR and shipping for many releases — would have been silently broken the whole time, turning everydefault_yesprompt negative. That has not been observed. - The claimed symptom is that default-no prompts become "impossible to accept". Under the actual mapper there is no parse failure, so
rcreflects the user's real choice.
--default=false would also work and is equivalent; I'm keeping no because it reads symmetrically against the existing --default=yes on the adjacent branch. No code change.
Note the exit code alone cannot settle this: gum confirm returns 1 for every flag combination when it has no TTY, so a non-interactive exit-code probe is not valid evidence. The parse error on stderr is, because argument parsing happens before the TUI opens.
The bug
confirm()andtoggle()ininstall.shpassed an explicit flag only on theiraffirmative branch. The negative branch called
gum confirmbare:gum's
--defaultis a bool declareddefault:"true"inconfirm/options.go,and
confirm/command.goseeds the TUI with
choice := o.Default. Omitting the flag therefore preselectsYes.
Net effect: every
default_noprompt rendered with Yes highlighted — theopposite of its stated default — so a user pressing Enter opted in to a
feature the code intended to default off.
Affected prompts
Protect <pack> WebUI with Cognito login? (enterprise-grade)default_noConnect KiroCrew to Telegram? (chat with your agent from your phone)default_notoggle()carried the same inversion for any caller passing a false default.The fix
Both helpers now pass
--default=noexplicitly, so neither branch depends ongum's implicit value. Four
$GUM confirmcall sites exist and all four nowname their default.
Verification
bash -n install.shandbash -n uninstall.sh: OKshellcheck --severity=error install.sh uninstall.sh: 0 findingsgrep '$GUM confirm' install.sh | grep -v -- '--default='→ empty, so no callsite relies on the implicit default
Behaviour was confirmed from gum v0.14.5's source rather than from exit codes:
gum confirmreturns the negative for every flag combination when it has noTTY, so a non-interactive exit-code probe cannot distinguish the cases and is
not valid evidence here.