fix(gui): restore OpenAI account setup with canonical recovery gates - #469
Conversation
|
Warning Review limit reached
Next review available in: 8 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis PR adds recovery for missing or disabled canonical OpenAI providers. The GUI can recreate or re-enable OpenAI, the server validates and normalizes canonical configurations, benchmark DNS handling supports Clash fake-IP addresses, and localized UI, tests, and documentation cover the flow. ChangesOpenAI provider recovery
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant CodexAuth
participant ensureOpenAiProvider
participant ProviderRoutes
participant DestinationPolicy
User->>CodexAuth: select Enable OpenAI
CodexAuth->>ensureOpenAiProvider: recover absent or disabled provider
ensureOpenAiProvider->>ProviderRoutes: create or re-enable openai
ProviderRoutes->>DestinationPolicy: validate canonical destination
DestinationPolicy-->>ProviderRoutes: accept or reject destination
ProviderRoutes-->>CodexAuth: refreshed provider state
CodexAuth-->>User: show Pool mode or translated error
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
🔒 Under maintainer review — detailed feedback incoming@lidge-jun (maintainer) has this PR in an active review pass. Please do not merge, rebase, or This is a claim marker so two maintainers do not review or land the same PR at once. If you are a Baseline for this pass: No action needed from you until then. Thanks for the contribution and for your patience. Review tracker: |
|
Thank you for hardening the OpenAI account setup recovery. I reviewed this against #445, which addresses the same problem, and this is the version we should take. Duplicate resolution: take #469, close #445. The patch IDs of the original change match, so #445's authorship is preserved here, and this PR adds the base-URL gate, server-side re-enable validation, and regressions for malformed disabled rows that #445 is missing. #445 in its current form allows a disabled row with a hostile Verdict: BLOCKED_SECURITY — policy gate, not a defect. What I verified holds: enabled and disabled rows both require Overlap with Test gap: the new GUI test only asserts banner markup. It never clicks the recovery action, so the absent-provider Reviewed as part of a maintainer review pass against |
原因: - 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.
Cherry-picked #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>
Keep destination checks for canonical openai and only suppress benchmark/fake-IP answers; normalize baseUrl when re-enabling; localize enable failures; sync structure and provider docs with gated recovery. Co-authored-by: Ouyang Xingyuan <galaxyroaming@qq.com>
Prove absent→POST, disabled→PATCH, localized error display, and post-success Pool refresh through the rendered page, not banner markup alone.
5beb38a to
b77c43e
Compare
|
Addressed the review follow-ups on head
Still waiting on the explicit maintainer security review (BLOCKED_SECURITY process gate) before merge — understood this is policy, not a defect finding against the implementation. |
Allow only Clash 198.18/19 answers inside destination resolution for the canonical seed, normalize baseUrl on re-enable with save-and-reload coverage, and always localize enable failures through t(...).
PATCH {disabled:false} for openai now resolves destinations with the
canonical base URL and allowBenchmarkAddresses, ignoring any persisted
allowPrivateNetwork so Clash fake-IP alone can pass.
|
Ready for merge. @lidge-jun |
Guard Accounts enable against double-clicks, localize the missing-seed path, unify zh provider wording, and drop stale allowPrivateNetwork after a successful disabled-row re-enable.
Ingwannu
left a comment
There was a problem hiding this comment.
Reviewed the exact head 077a407a45c6399dcd922dfadde3e79f82a4ceeb against the current dev merge result.
The recovery flow is correctly gated to the canonical OpenAI adapter, forward auth mode, and normalized Codex base URL. Missing providers are created only from the canonical server preset; disabled providers are re-enabled through the restricted PATCH path; noncanonical rows remain blocked. The destination-resolution exception is limited to Clash benchmark answers and still rejects loopback, RFC1918, metadata, and mixed dangerous results. The successful recovery path also removes stale allowPrivateNetwork.
Verified locally:
- 71 focused provider-management, destination-policy, and payload tests
- 6 GUI recovery component/interaction tests, including actual POST/PATCH clicks, error display, and post-success refresh
bun run typecheckbun run lint:gui
All current GitHub checks are green. The CodeRabbit duplicate-declaration report is not present on this head (each test has one declaration), and the remaining canonicalization-helper suggestion is non-blocking maintainability follow-up.
…overy fix(gui): restore OpenAI account setup with canonical recovery gates
Summary
providers.openairows must pass the same canonical adapter / baseUrl / authMode checks before UI recovery is offered, and disabled-onlyPATCH { disabled: false }cannot re-enable a malformed OpenAI row unchanged.dev, plus the maintainer-requested validation hardenings and regressions.Thanks @apple-ouyang for the original recovery work in #445 — this PR cherry-picks that change and layers the canonical gates from review.
Fixes #443
Supersedes #445
Credits
Co-authored-byon the follow-up commit)Test plan
bun run typecheckbun test tests/provider-payload.test.tsbun test ./gui/tests/codex-auth-provider-enable.test.tsxbun test tests/management-provider-validation.test.ts(includes noncanonical disabled re-enable rejection + canonical re-enable with missing mode fill)bun run lint:guiChangelog note
Restore OpenAI account setup when the built-in provider is missing or disabled, with credits to @apple-ouyang (#445). Noncanonical disabled OpenAI rows no longer get a false recovery path.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation