fix(install): show a gateway key refusal plainly and skip the retry prompt - #266
Merged
Merged
Conversation
…rompt When the gateway's mint endpoint declines a user (an email domain outside its allowlist), the backend now answers 403 with code "key_refused". The "Get a new API Key" step used to print the nested status chain and offer "Press Enter to retry" — a retry that can never succeed. fetchApiKey throws a BackendError carrying the backend's status, reason and code; isKeyRefusal is what FetchApiKey branches on. A refusal renders the gateway's own sentence, says retrying won't change it, and Enter goes straight to the manual-credentials step. FetchApiKey also switches its key listener off once it has succeeded or handed off. The parent keeps the Step mounted as history, and the live listener used to answer every later Enter (model pick, smoke-test spinner) by calling onFallback again and yanking the wizard back to manual creds. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DFzDyvc2uV1Vp1WoHBkiPB
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DFzDyvc2uV1Vp1WoHBkiPB
quickbeard
force-pushed
the
fix/key-refusal-no-retry
branch
from
September 10, 2026 08:32
8327114 to
5b1e8ce
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The gateway refused the email domain. That is a policy decision, not an outage, so the retry hint was wrong and the actual reason was buried inside a nested status chain. The companion backend PR (quickbeard/codev-backend) now reports this as
403withcode: "key_refused"; this PR makes the hub act on it.What
fetchApiKeythrows aBackendErrorcarrying the backend'sstatus,reasonandcode.isKeyRefusalis the check components branch on.FetchApiKeyrenders a refusal as the gateway's own sentence, a line saying retrying won't change it, and "Press Enter to enter your own API key". Enter goes straight to manual credentials.FetchApiKeynow gates itsuseInputon!succeeded && !handedOff. The parent keeps the Step mounted as read-only history, and the live listener used to answer every later Enter by callingonFallbackagain — reproducible today on the empty-key → manual fallback path by pressing Enter during the smoke-test spinner, which yanks the wizard back to a fresh manual-creds form.key_refusedwire contract with the backend.Tests
key_refusedbecomes aBackendErrorwith the code and reason;isKeyRefusalrejects a plain 502 and a bareError.onFallback.pnpm fix,pnpm typecheck,pnpm test(1496 passed),pnpm build && node dist/index.js --version.Rollout
Against an old backend the hub keeps its current behaviour (generic 502 + retry prompt). The user in the report stays blocked until the gateway team widens its allowlist or issues them a key by hand.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DFzDyvc2uV1Vp1WoHBkiPB