Fix Codex startup live import duplication#2590
Fix Codex startup live import duplication#2590DhruvShankpal wants to merge 2 commits intofarion1231:mainfrom
Conversation
|
Thanks for the PR! The approach looks correct — the root cause is that A few things:
Overall the fix is clean and addresses the issue well. 👍 |
|
Fix: Prevent duplicate Codex default provider on restart & add startup import tests Hey @JiangHe12 I fixed the issue where restarting the app could create duplicate Codex default provider entries. The startup logic now checks for any existing provider before importing the live config, ensuring the import only happens on a true fresh install. What’s included: Refactored startup guard to check for any provider, not just non-official ones. Added tests to verify: Test results:
Notes: |
|
Also @JiangHe12 I'm curious what the appropriate etiquette is when improving on my initial pull request. Is it better to just commit changes to same branch(like i did above) or create a new branch? |
|
The refactored approach with For your etiquette question: committing to the same branch is the standard practice. It automatically updates this PR, keeps all discussion in one place, and the maintainer can review the full diff. Creating a new branch would mean a new PR and split context. So what you did is correct. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fix Issue #2535
Summary
Fixes the startup live-import path so CC Switch does not recreate 'id="default"' for Codex when the app already has provider entries such as 'codex-official'.
Also keeps local current-provider settings in sync when a live import does happen.
What changed
Why
Before this change, startup import only skipped when a non-official provider existed. That meant Codex could still auto-import live config even when 'codex-official' was already present, creating a 'default' provider and causing DB/settings current-provider drift.
Result
Notes
I could not run automated tests in the current shell because 'cargo' and 'pnpm' were not available in the environment.
I am relatively new to Rust and used the assistance of codex to help solve the problem so advise supervision before merge.