fix: detect OAuth/device-code denial in CLI and wizard polling#614
Merged
fix: detect OAuth/device-code denial in CLI and wizard polling#614
Conversation
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.
Summary
expires_atdeadline (falls back toexpires_in, then a 15-minute default). Previously the loop had no exit condition, so OpenAI Codex's 403-on-deny was treated as "still pending" forever and the user had to Ctrl+C. Also bails after 30 consecutive poll errors (~2.5 min at the default 5s interval) with a network-hint message.auth-flow-polling.tswith dependency injection so it can be unit-tested directly. Recognizerevoked/failed/expiredas terminal failure statuses (forward-compat for the backend follow-up). Replace the bland 5-minute deadline message with one that tells the user to cancel and re-run if they canceled on the provider page.closes #600
Partial fix toward #599: this PR adds the frontend half. Once the backend half lands (see follow-up note), the wizard will exit immediately on user-denial instead of waiting the full 5 minutes.
Follow-up: #599 backend half (separate PR)
backend/src/handlers/user_tokens.rs::generic_oauth_callback_implcurrently redirects to/?error=access_deniedon user denial without touching the placeholder UserApiKey. The placeholder stays inpending_authforever until TTL. Follow-up work:revoked(or a newdeniedstatus) so the wizard's polling exits immediately via the new terminal-status branch.Test plan
cargo test -p nyxid-cli(3 new parser tests + 277 existing + freshness)cd frontend && npm run test(533 tests including the newauth-flow-pollinglifecycle tests)cargo test -p nyxid-cli --test wizard_bundle_freshnessnyxid service add llm-openai-codex --device-code --label "Deny test", click cancel on the provider page, confirm the CLI exits cleanly within ~15 minutes (the default deadline) instead of looping forever. With network unplugged, confirm it bails within ~2.5 minutes.