Skip to content

fix(cli): re-prompt for Control API URL when discovery fails - #178

Draft
cubeorgdev[bot] wants to merge 1 commit into
mainfrom
fix/setup-url-retry
Draft

cubeorgdev[bot] wants to merge 1 commit into
mainfrom
fix/setup-url-retry

Conversation

@cubeorgdev

@cubeorgdev cubeorgdev Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #90

If discovery fails during blue setup (DNS/TLS/timeout, non-2xx, bad JSON, invalid discovery document), Blue now shows the error and asks "Try a different Control API URL?" with the previous URL pre-filled. Before this change it exited 1.

  • The prompt and discovery now go through one shared retry loop, discover_with_retry / discover_control_api, used in all three places: setup(), first run of start(), and run() when not yet configured. The issue lists two of these; run() had the same bug.
  • If you decline the retry, setup ends with outro_cancel("Setup cancelled; no files were changed.") and exits 0, the same as the reset cancel path.
  • Discovery is tried at most 5 times (MAX_DISCOVERY_ATTEMPTS). After the last failure it returns the last error and exits 1.
  • These are unchanged: non-TTY still fails fast, and malformed URLs are still rejected inline as you type.
  • 26 new unit tests in commands::tests::discovery_retry. They use injected fake prompt/discover/confirm/report closures, so they need no TTY or network.

cargo test --workspace, cargo clippy --all-targets and cargo fmt --all -- --check all pass locally.

🤖 Generated with Claude Code

A well-formed but wrong Control API URL passed inline validation, then
failed discovery and exited 1, forcing a full restart of `blue setup`.
Wrap prompt + discovery in a shared retry loop used by setup(), start()
first-run, and run() newly-configured: report the error, offer to try a
different URL (pre-filled), cancel cleanly on decline, cap at 5 attempts.
Non-TTY fail-fast and inline URL validation are unchanged.

Fixes #90

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cubeorgdev

cubeorgdev Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

This pull request was created from a Blocks session.

View in dashboard | View on desktop

Created as a draft. To change this setting visit Git Settings.

@cubeorgdev

cubeorgdev Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Test from the pr-update-automation automation.

This branch has not been deployed

No deployments
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.

blue setup exits on an unreachable Control API URL instead of letting you re-enter it

1 participant