fix(gui): restore OpenAI account setup paths - #445
Conversation
📝 WalkthroughWalkthroughThe change adds localized OpenAI enablement text, provider discovery and recovery helpers, canonical OpenAI validation handling, and UI flows that create or re-enable the provider before Codex authentication. ChangesOpenAI provider recovery
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Providers
participant ensureOpenAiProvider
participant ProviderAPI
participant CodexLogin
Providers->>ensureOpenAiProvider: prepare OpenAI account provider
ensureOpenAiProvider->>ProviderAPI: create or re-enable OpenAI
ProviderAPI-->>ensureOpenAiProvider: provider result
ensureOpenAiProvider-->>Providers: preparation complete
Providers->>CodexLogin: open Codex login flow
CodexLogin-->>Providers: account added
Providers->>Providers: refresh config, OAuth, quotas, and models
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
原因: - OpenAI account credentials can outlive the built-in provider, leaving no GUI path to restore routing. - Disabled legacy or API-key OpenAI rows must not be treated as canonical Codex account providers. - Clash fake-IP DNS can reject the exact canonical OpenAI preset after canonical seed validation. 改动: - Keep OpenAI visible in the unified account picker and add in-place recovery on Codex Auth. - Create missing canonical providers, re-enable only canonical disabled providers, and reject noncanonical rows without overwriting them. - Preserve destination checks for custom providers and cover provider-state, banner-state, test isolation, and fake-IP boundaries.
d4b66ef to
ba5d9ca
Compare
🔒 Under maintainer review — detailed feedback incoming@lidge-jun (maintainer) has this PR in an active review pass. Please do not merge or close This PR is not part of the current integration batch. It is held back deliberately — Heads-up on rebasing: No action needed from you until then. Thanks for the contribution and for your patience. Review tracker: |
|
Thank you for restoring the OpenAI account setup paths. The disabled-provider recovery logic currently bypasses the stricter canonical-provider validation and can re-enable an unusable OpenAI row. At Please make disabled rows pass the same This changes authentication/provider-validation behavior, so it requires explicit maintainer security review. I appreciate the recovery UX work; canonical validation has to remain the single gate for both enabled and disabled rows. Please also rebase onto current Reviewed as part of a maintainer integration pass. |
|
Thanks @apple-ouyang — this was a solid recovery UX fix. We cherry-picked your #445 commits onto current You're credited in the commit ( |
|
Thank you for spotting and fixing the broken OpenAI account setup path — the problem you identified is real and worth fixing. Before this can land, there's a security defect in the recovery gate that I need to flag directly. High — a disabled, noncanonical OpenAI endpoint can be re-enabled and then receive forwarded account credentials. Policy — this area also needs explicit security review. Recommendation: close this in favor of #469. #469 carries the identical original patch — the patch IDs match, so your authorship is preserved — and adds exactly the base-URL gate and server-side re-enable validation described above, plus regressions for malformed disabled rows. Keeping both open risks someone reviewing and landing the weaker implementation by mistake. This branch is also 129 commits behind the current baseline and still a draft, so rebasing it to reach the same end state would duplicate work already done in #469. Test gap that allowed this: no regression uses a disabled Genuinely appreciate the contribution — the diagnosis was right, and it's carried forward in #469. Reviewed as part of a maintainer review pass against |
Cherry-picked lidge-jun#445 from @apple-ouyang (Ouyang Xingyuan) onto current dev, then require the same adapter/baseUrl/authMode checks for disabled rows in Codex Auth and reject noncanonical openai re-enable via PATCH. Co-authored-by: Ouyang Xingyuan <galaxyroaming@qq.com>
Fixes #443
Summary
providers.openaiis missingPATCH { disabled: false }, preserving Direct/Pool mode and saved model settingsValidation
bun test tests/provider-payload.test.ts— 13 passedbun test ./gui/tests/codex-auth-provider-enable.test.tsx— 1 passedbun test tests/management-provider-validation.test.ts --test-name-pattern 'accepts canonical OpenAI modes|fake-IP DNS'— 2 passedbun run typecheckbun run lint:guibun run build:guiLocal full-suite note
bun run prepushwas attempted. On this macOS machine, Clash fake-IP DNS maps the existing test domains (for exampleapi.example.test) into198.18.0.0/15, so five pre-existing custom-provider management tests are rejected by the destination policy. The focused fake-IP boundary tests above pass; GitHub CI should provide the authoritative full-suite result under standard DNS.Security review
This touches the authentication setup path and destination-policy boundary. Please apply the repository's explicit maintainer security review requirement. The DNS exception is limited to
name === "openai"plus the existing strict canonical seed validator; custom providers still execute resolved destination validation.Summary by CodeRabbit
New Features
Bug Fixes
Tests