Repository navigation
fix(devices): clean up pending_auth on device-code timeout/cancel - #790
Merged
Merged
Conversation
CLI + dashboard device-code flows now DELETE the placeholder via ?only_if_pending=true on every abort path (expiry+declined renewal, denial, network errors, ctrl+C, dashboard Back/Cancel, dialog unmount), so `nyxid service list` no longer accumulates leftover services from abandoned attempts. Also adds a redrawn countdown timer and a [Y/n] renewal prompt in the CLI's TTY mode; non-TTY bails on first expiry without prompting. Closes #706. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Ports the device-code countdown + on-expiry/denied cleanup from the terminal-only and dashboard paths to the cli-wizard's DeviceCodeFlow (frontend/src/components/cli-wizard/auth-flows.tsx), which is the default path most users hit. The wizard now reads init.expires_in for its client-side deadline (was hardcoded 10min), shows an "Expires in MM:SS" chip beside the CODE label, and calls releaseServerState() on expired/denied so the placeholder doesn't linger if the user walks away. The "Request a new code" button continues to work via existing startSession() re-entry. CLI follow-ups in the same change: - Decouple countdown redraw from poll cadence: the inner loop now ticks every 1s for visible MM:SS movement while the HTTP poll is throttled to the provider's `interval` (5s+). - Add NYXID_DEVICE_CODE_DEADLINE_SECS env var that clamps the client-side deadline in both the terminal flow and (via a forwarded ?expires_in_override query param) the wizard, so QA can exercise expiry/renewal paths in seconds instead of waiting ~15min for a real provider expiry. Wizard now ships a responsive SVG favicon (nyxid-app-icon.svg) matching the dashboard's <link rel="icon"> — previously the wizard served only the static .ico fallback. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
nyxid service add --device-codenow redraws a countdown timer each tick, prompts[Y/n]to renew on expiry in TTY mode (default Y), and bails immediately in non-TTY mode. Every abort path (expiry+declined, denial, 30 consecutive errors, ctrl+C) DELETEs the placeholder via?only_if_pending=truebefore exit.add-key-dialog::DeviceCodeStepgets the same cleanup discipline: Back/Cancel buttons,expired/deniedpoll outcomes, and component unmount (X / Esc / outside-click) now drop the placeholder. The success branch nulls a ref so the happy path skips the redundant DELETE.expired/denied) directly fromPOST /providers/{id}/connect/device-code/polland own the placeholder lifecycle via the existingDELETE /keys/{id}?only_if_pending=trueendpoint. Earlier draft included a backend fast-fail inpoll_device_code'sdeniedarm, but it raced the CLI/dashboard cleanup (flipping tofailedmade?only_if_pendingno-op and the row lingered inservice list) and was reverted per code review.Closes #706.
Test plan
nyxid service add llm-openai-codex --device-code --label \"QA-$(date +%s)\" --base-url https://nyx-api.chrono-ai.fun— let the code expire, decline renewal at the prompt →nyxid service listshows no leftovernyxid service add ... --device-code < /dev/null(simulate non-TTY) — let expire → bails immediately with timeout message, no leftover/keysactive🤖 Generated with Claude Code