Skip to content

fix: make --yes skip the sign-in confirmation prompt - #452

Merged
alnr merged 2 commits into
masterfrom
fix/219-yes-flag
Jul 29, 2026
Merged

fix: make --yes skip the sign-in confirmation prompt#452
alnr merged 2 commits into
masterfrom
fix/219-yes-flag

Conversation

@alnr

@alnr alnr commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Closes #219

Problem

--yes was parsed and stored on CommandHelper as noConfirm, 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 pipe yes into the command.

Review then turned up something worse: fixing the prompt alone would have changed nothing, because the prompt is currently unreachable.

TemporaryAPIKey gated on h.Authenticate(ctx), which performs the interactive sign-in rather than checking for it. It never returns ErrNotAuthenticated, so the confirmation branch was dead code — unauthenticated users get a browser opened at them without ever being asked. The --quiet branch was dead for the same reason: Authenticate returns 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

  • Confirmations go through CommandHelper.Confirm, which returns true without prompting when --yes is set. Routing them through one method rather than patching the single call site means the next prompt added cannot silently reintroduce the bug.
  • TemporaryAPIKey now gates on checkAuthenticated (a check) and handles --quiet explicitly. This matches how GetAuthenticatedConfig already branches on the same sentinels in the same file.
  • Confirm errors under --quiet instead of writing an invisible prompt to io.Discard and blocking on stdin — in CI that hangs forever with nothing on screen.
  • --yes also skips the legacy-config Press 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 tunnel will 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 --yes only cover the other dialogs.

One thing deliberately not changed: with --yes, answering the prompt still runs the interactive browser OAuth2 flow, so --yes alone does not make the command unattended-safe. That is the literal meaning of the flag ("confirm all dialogs with yes"), and --quiet is the flag for non-interactive use. Changing it is a product decision, not a patch; the new test documents the behaviour.

Tests

  • TestConfirm covers --yes (asserting stdin is never read, via a reader that fails the test on access), interactive yes/no, and the --quiet error path.
  • TestTemporaryAPIKeyConfirmation drives the real call site offline through the browser hook: it asserts the prompt appears, that --yes skips it and proceeds to sign-in, and that --quiet continues 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 -l clean; TestConfirm, TestTemporaryAPIKeyConfirmation, TestLegacyConfigHandling and TestDetermineIDs all pass under -race.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JYzGVwAKQ4ormxRHZg1eDu

alnr and others added 2 commits July 29, 2026 14:32
--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
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@alnr, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 17 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0e81e852-409a-4a6a-8631-9a97dc3e9aa8

📥 Commits

Reviewing files that changed from the base of the PR and between 6b55b72 and c0d09be.

📒 Files selected for processing (4)
  • cmd/cloudx/client/api_key.go
  • cmd/cloudx/client/command_helper.go
  • cmd/cloudx/client/config.go
  • cmd/cloudx/client/confirm_test.go

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@alnr
alnr merged commit 266f34c into master Jul 29, 2026
18 checks passed
@alnr
alnr deleted the fix/219-yes-flag branch July 29, 2026 15:09
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.

Cannot auto confirm the social sign in prompt on tunnel run

2 participants