fix(gpt-account): relay OAuth login prompts through the extension UI - #1486
Merged
Conversation
…ompt-signal relay Split the /account and /gpt-account suites behind a shared account-command harness that records ui.select / ui.input calls, and add the RED cases from #1485: the select prompt must reach ui.select with both labels and resolve to the option id, a dismissed selector stays silent, device_code notices carry the user code, manual_code prompts pass their placeholder and are released by the provider's per-prompt signal, and auth_url opens the browser only in the TUI.
/gpt-account add sent every AuthPrompt to ctx.ui.input(prompt.message), so the provider's select prompt rendered as an empty text field and an empty Enter reached openai-codex as 'Unknown OpenAI Codex login method:'. A shared createExtensionLoginInteraction now routes select prompts to ctx.ui.select (label mapped back to the option id), text/secret/manual_code prompts to ctx.ui.input with the placeholder, binds every dialog to the command signal plus the per-prompt AuthPrompt.signal so the manual-code dialog closes when the callback server wins, opens the browser for auth_url in the TUI, and prints the device-code user code. /claude-account add uses the same relay. Closes #1485
This was referenced Sep 8, 2026
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
Closes #1485.
/gpt-account addrelayed every OAuthAuthPrompttoctx.ui.input(prompt.message), so the provider'sselectprompt (Select OpenAI Codex login method:) rendered as an empty text field and an empty Enter reachedopenai-codexasUnknown OpenAI Codex login method:. The device-code flow printed the verification URL without the user code, the browser flow never opened a browser, and the manual-code dialog ignored the provider's per-prompt abort signal.What changed
builtin/oauth-login-interaction.ts—createExtensionLoginInteraction(ctx, { providerLabel, openBrowser? }):select→ctx.ui.select(message, labels, { signal }), chosen label mapped back to the option id;text/secret/manual_code→ctx.ui.input(message, placeholder, { signal });AuthPrompt.signal(AbortSignal.any), so the paste-the-code dialog closes when the local callback server wins; dismissed/aborted →Login cancelled;auth_url→openBrowser(url)whenctx.mode === "tui"(same as the/logindialog) + notice with the URL and instructions;device_code→ notice with the verification URL andEnter code: <userCode>;infoprints links;progressprints the message.builtin/gpt-account.tsandclaude-sdk-oauth/account-command.tsaddAccountuse the shared interaction; both factories accept an optionalopenBrowserdep for tests.test/suite/account-command-harness.ts(recordsui.select/ui.inputcalls; unanswered input resolves""like the reporter's empty Enter),account-extension.test.ts(/account),gpt-account-extension.test.ts(list/pin/remove),gpt-account-add.test.ts(the 6 new relay cases + 3 existing add cases). RED before the fix: 5 failed / 14 passed; GREEN after: 36 passed across the account, claude-account, rpc-login and app-server-account suites.builtin/changes.md,claude-sdk-oauth/changes.md,packages/coding-agent/CHANGELOG.md[Unreleased]→ Fixed.Verification
npx vitest --run test/suite/{account-extension,gpt-account-extension,gpt-account-add,claude-sdk-oauth-account-command,rpc-login-interactive-prompts,app-server-account}.test.ts→ 36 passednpx tsc --noEmit -p tsconfig.json→ cleannode scripts/check-pr-changelog.mjs --base $(git merge-base HEAD origin/main)→ PASS/gpt-account addfrom the builtdist/cli.js: evidence will be attached to [Bug]: /gpt-account add renders the OpenAI Codex login-method select as an empty text input (Unknown OpenAI Codex login method:) #1485 (selector withBrowser login (default)/Device code login (headless)).Notes
/logineither.Summary by cubic
Fixes
/gpt-account addand/claude-account addso OAuth login prompts render as their proper UI instead of every prompt being sent to a plain text input. The login-method chooser now shows as a real selector, the device-code flow prints the user code, the browser flow opens the browser in the TUI, and the manual-code dialog closes when the provider's callback completes the login. Closes #1485.oauth-login-interaction.tsused by both account commands that routes prompts by type:selecttoui.select,text/secret/manual_codetoui.inputwith the placeholder, andauth_url/device_code/infoto notices.AuthPrompt.signalso a dismissed or aborted prompt rejects withLogin cancelled.ui.select/ui.inputcalls, with new coverage for the relay cases ingpt-account-add.test.ts.Written for commit eb1297d. Summary will update on new commits.