Skip to content

fix(gpt-account): relay OAuth login prompts through the extension UI - #1486

Merged
code-yeongyu merged 3 commits into
mainfrom
fix/gpt-account-login-method-select
Sep 8, 2026
Merged

fix(gpt-account): relay OAuth login prompts through the extension UI#1486
code-yeongyu merged 3 commits into
mainfrom
fix/gpt-account-login-method-select

Conversation

@code-yeongyu

@code-yeongyu code-yeongyu commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #1485.

/gpt-account add relayed every OAuth AuthPrompt to ctx.ui.input(prompt.message), so the provider's select prompt (Select OpenAI Codex login method:) rendered as an empty text field and an empty Enter reached openai-codex as Unknown 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

  • New builtin/oauth-login-interaction.tscreateExtensionLoginInteraction(ctx, { providerLabel, openBrowser? }):
    • selectctx.ui.select(message, labels, { signal }), chosen label mapped back to the option id;
    • text / secret / manual_codectx.ui.input(message, placeholder, { signal });
    • dialog signal = command signal + per-prompt AuthPrompt.signal (AbortSignal.any), so the paste-the-code dialog closes when the local callback server wins; dismissed/aborted → Login cancelled;
    • auth_urlopenBrowser(url) when ctx.mode === "tui" (same as the /login dialog) + notice with the URL and instructions;
    • device_code → notice with the verification URL and Enter code: <userCode>; info prints links; progress prints the message.
  • builtin/gpt-account.ts and claude-sdk-oauth/account-command.ts addAccount use the shared interaction; both factories accept an optional openBrowser dep for tests.
  • Tests: test/suite/account-command-harness.ts (records ui.select/ui.input calls; 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.
  • Trackers: builtin/changes.md, claude-sdk-oauth/changes.md, packages/coding-agent/CHANGELOG.md [Unreleased] → Fixed.

Verification

Notes


Summary by cubic

Fixes /gpt-account add and /claude-account add so 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.

  • Adds a shared oauth-login-interaction.ts used by both account commands that routes prompts by type: select to ui.select, text/secret/manual_code to ui.input with the placeholder, and auth_url/device_code/info to notices.
  • Binds every dialog to the per-prompt AuthPrompt.signal so a dismissed or aborted prompt rejects with Login cancelled.
  • Extracts a test harness recording ui.select/ui.input calls, with new coverage for the relay cases in gpt-account-add.test.ts.

Written for commit eb1297d. Summary will update on new commits.

Review in cubic

…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
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.

[Bug]: /gpt-account add renders the OpenAI Codex login-method select as an empty text input (Unknown OpenAI Codex login method:)

1 participant