feat(gui): add manual paste fallback for OAuth add-account - #1769
feat(gui): add manual paste fallback for OAuth add-account#1769dbc-hbin wants to merge 3 commits into
Conversation
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughThe provider workspace now accepts manual Command Code API keys, authorization codes, or redirect URLs. The OAuth hook submits these values to the provider login-code endpoint and reports success or errors. Localization, styling, and integration tests support the new flow. ChangesManual authentication flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change adds a localized manual OAuth fallback for remote GUI account setup, with focused accessibility and behavior tests; no actionable merge-blocking risk remains after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant User
participant ProviderAuthPanel
participant useProvidersOAuth
participant OAuthAPI
User->>ProviderAuthPanel: Enter code or redirect URL
User->>ProviderAuthPanel: Submit value
ProviderAuthPanel->>useProvidersOAuth: submitManualCode(provider, input)
useProvidersOAuth->>OAuthAPI: POST /api/oauth/login/code
OAuthAPI-->>useProvidersOAuth: Success or error response
useProvidersOAuth-->>ProviderAuthPanel: Completion or error
ProviderAuthPanel-->>User: Display status feedback
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
⏳ DRAFT
What to do
Review readiness checklist
✅ 4/4 boxes ticked. This pull request was already a draft. Its draft status will be preserved after every issue above is resolved. |
Wibias
left a comment
There was a problem hiding this comment.
Requesting changes based on the current head (58be5e6).
[P2] The manual credential/code survives cancellation and a new login attempt for the same provider. ProviderAuthPanel keeps manualCode, manualCodeMsg, and manualCodeOk in local state. When the login hint disappears, the paste UI is only removed from the DOM; that state is not cleared. Starting Add account again on the same mounted provider panel can therefore re-render the previous raw user_… API key / OAuth code and stale feedback. Since Command Code intentionally uses a password input here, this is credential-bearing state and should not persist across login generations.
Please reset the manual input and feedback when the login flow is cancelled/ends and when a fresh login generation starts. Add a regression along the lines of: start Command Code Add account → enter a key → cancel/end the flow → start Add account again → input is empty and no prior success/error message is present.
Also refresh onto current dev. French localization was added after this branch point with strict locale-key parity; this PR adds prov.pasteCommandCodePlaceholder and prov.pasteCommandCodeHint to the existing locales but not the new French dictionary. Add the French strings so the updated branch satisfies the locale contracts, then rerun full CI.
Expose the existing /api/oauth/login/code path in the GUI: while a login is in progress the account panel shows a paste box that accepts a redirect URL / authorization code / raw Command Code API key (Command Code uses password masking). Keeps the server-side rotation/pool logic untouched — minimal surface to let users add a second Command Code account without fighting the localhost callback. GUI: ProviderAuthPanel + types + use-providers-oauth hook + Providers wiring, paste styles. i18n: en/de/ja/ko/ru/tr/zh/zh-TW (command-code placeholder + hint, plus the refined redirect hint from lidge-jun#1552). Test: provider-auth-manual-code (password type + role=status/alert feedback).
58be5e6 to
1bef4fc
Compare
Summary
Minimal add-account fix split out of #1552. Keeps no pool rotation — only the failure that blocks adding a second Command Code account: the localhost callback can't be reached from a remote GUI, so we surface the existing
/api/oauth/login/codepath in the account panel.user_…from~/.commandcode/auth.json). Command Code usestype="password".POST /api/oauth/login/code→submitManualLoginCode(provider, input)→OAuthController.onManualCodeInput; no new backend surface. Backed by the Command Code provider'sparsePastedCommandCodeInput/validatePastedApiKey(already ondev).role="status"/role="alert"+aria-atomic, covered bygui/tests/provider-auth-manual-code.test.tsx.Screenshot (dogfooding build
58be5e6e0—feat/command-code-add-account-minimalondev@c71c827, proxy 2.18.0 @ 127.0.0.1:10100)docs/screenshots/command-code-add-account-paste.png— Providers → Command Code - Auth → Accounts → after Add account: the waiting state shows the auth link + link-copy + "didn't open?" and the paste hint +passwordinput (Command Code API 키 또는 리다이렉트 URL 붙여넣기) + Submit button. This is the requested small text box next to the link.What is dropped vs #1552
oauth-pool-routing,command-code-routing, poolGET/PUT/PATCH+priority+clear-cooldown, quotafiveHourPercent/weeklyPercentprobing,responses/core429 failover, CLIauto-switch/priority/clear-cooldown. Those can return in a dedicated follow-up once the rotation design is approved; this PR does not touchsrc/server/management/oauth-account-routes.ts,src/oauth/*,src/providers/quota.ts,src/types.ts,src/codex/pool-rotation.ts.Design (only what ships)
gui/src/components/provider-workspace/*— newonSubmitManualCodehandler,ProviderAuthPanelpaste UI.gui/src/pages/use-providers-oauth.ts+gui/src/pages/Providers.tsx— hook wired throughfetch(.../api/oauth/login/code)with error propagation.gui/src/styles/provider-workspace-settings.css—pwi-auth-pastelayout.en/de/ja/ko/ru/tr/zh/zh-TW—pasteCommandCodePlaceholder/pasteCommandCodeHintplus the refinedpasteRedirectHintfrom feat: Command Code OAuth account pool with Codex-style rotation #1552.Verification
gui/dist(index-DjmiLvzJ.js) carries the paste strings, restarted proxy (PID 80594) serves it (index-DjmiLvzJ.jsconfirmed viacurl /), Chrome dogfooding to/ #providers→ Command Code → Accounts → Add account verified: showsWaiting for browser…+ link + paste box (password) simultaneously (screenshot above,kolocale).tsc --noEmitclean (root).gui/tests/provider-auth-manual-code.test.tsx— masks Command Code input as password and asserts rejection/success roles.Relates to #1552 (closed, superseded).
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.