fix: make --yes skip the sign-in confirmation prompt - #452
Conversation
--yes was parsed and stored on CommandHelper as noConfirm, but nothing ever read that field, so the flag was a no-op across every cloudx command. `ory tunnel --yes` still stopped at "Do you want to sign in?" and waited on stdin, which never arrives in CI — the documented workaround was to pipe `yes` into the command. Confirmations now go through CommandHelper.Confirm, which returns true without prompting when --yes is set. Routing them through one method rather than fixing the single call site means the next prompt added cannot silently reintroduce the bug. Closes #219 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JYzGVwAKQ4ormxRHZg1eDu
Routing the prompt through Confirm was not enough: TemporaryAPIKey gated on Authenticate, which *performs* the interactive sign-in rather than checking for it. It never returns ErrNotAuthenticated, so the confirmation branch was dead code and --yes still had nothing to skip. Unauthenticated users were signed in via a browser without ever being asked. The quiet branch was dead for the same reason: Authenticate returns a plain error under --quiet, which matched neither sentinel and fell through to the catch-all, aborting the tunnel instead of continuing without an API key. TemporaryAPIKey now gates on checkAuthenticated and handles --quiet explicitly, matching how GetAuthenticatedConfig branches on the same sentinels. Confirm now errors under --quiet instead of writing an invisible prompt to io.Discard and blocking on stdin, and --yes also skips the legacy-config "Press enter to continue..." dialog, which blocked every command before the flag was ever consulted. TestTemporaryAPIKeyConfirmation drives the real call site offline via the browser hook, so the prompt cannot silently become unreachable again. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JYzGVwAKQ4ormxRHZg1eDu
|
Warning Review limit reached
Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #219
Problem
--yeswas parsed and stored onCommandHelperasnoConfirm, but nothing ever read that field. Every reference in the tree was a write. So the flag was a no-op across all cloudx commands, not just the prompt in the issue, and the documented workaround was to pipeyesinto the command.Review then turned up something worse: fixing the prompt alone would have changed nothing, because the prompt is currently unreachable.
TemporaryAPIKeygated onh.Authenticate(ctx), which performs the interactive sign-in rather than checking for it. It never returnsErrNotAuthenticated, so the confirmation branch was dead code — unauthenticated users get a browser opened at them without ever being asked. The--quietbranch was dead for the same reason:Authenticatereturns a plain error under--quiet, which matches neither sentinel and falls through to the catch-all, aborting the tunnel instead of continuing without an API key as the code plainly intends.Fix
CommandHelper.Confirm, which returns true without prompting when--yesis set. Routing them through one method rather than patching the single call site means the next prompt added cannot silently reintroduce the bug.TemporaryAPIKeynow gates oncheckAuthenticated(a check) and handles--quietexplicitly. This matches howGetAuthenticatedConfigalready branches on the same sentinels in the same file.Confirmerrors under--quietinstead of writing an invisible prompt toio.Discardand blocking on stdin — in CI that hangs forever with nothing on screen.--yesalso skips the legacy-configPress enter to continue...dialog, which blocked every command before the flag was ever consulted.Behaviour change worth your judgement
Restoring the confirmation means
ory proxy/ory tunnelwill ask before signing in where today they open a browser unprompted. I read that as the intended behaviour — the message exists in the code and the issue reports users seeing it in v0.1.41 — but it is a user-visible change beyond the literal ask of #219, so say the word if you would rather keep the current no-prompt flow and have--yesonly cover the other dialogs.One thing deliberately not changed: with
--yes, answering the prompt still runs the interactive browser OAuth2 flow, so--yesalone does not make the command unattended-safe. That is the literal meaning of the flag ("confirm all dialogs with yes"), and--quietis the flag for non-interactive use. Changing it is a product decision, not a patch; the new test documents the behaviour.Tests
TestConfirmcovers--yes(asserting stdin is never read, via a reader that fails the test on access), interactive yes/no, and the--quieterror path.TestTemporaryAPIKeyConfirmationdrives the real call site offline through the browser hook: it asserts the prompt appears, that--yesskips it and proceeds to sign-in, and that--quietcontinues without a key. Verified it fails against the pre-fix gating — which is exactly the gap that let the prompt become dead code unnoticed.go build ./...,go vet ./cmd/cloudx/...,gofmt -lclean;TestConfirm,TestTemporaryAPIKeyConfirmation,TestLegacyConfigHandlingandTestDetermineIDsall pass under-race.🤖 Generated with Claude Code
https://claude.ai/code/session_01JYzGVwAKQ4ormxRHZg1eDu