fix(codex): always update model catalog JSON on provider switch#3360
Conversation
Without this fix, the cc-switch-model-catalog.json file and the model_catalog_json field in config.toml were only regenerated when should_sync_backup was true (proxy active or backup exists). Switching providers while the proxy was idle left the catalog pointing at the previous provider's models, requiring a full restart to take effect. After the existing should_sync_backup block, unconditionally call write_codex_provider_live_with_catalog when switching a Codex provider and the proxy is not currently active (live_taken_over == false). This mirrors what live.rs already does during a normal provider apply. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
I can reproduce a related Codex model catalog issue on CC Switch 3.16.0 on macOS. The PR description matches one part of the behavior: switching Codex providers while the proxy is idle can leave the live There seems to be an additional persistence case worth covering:
Observed result:
Expected result:
Local workaround that confirms the failure mode:
So #3360 looks directionally correct for the live catalog refresh path, but it may also need a test/assertion that provider switching does not rewrite an inactive Codex provider's saved |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80c010e91a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
|
This is important and should solve my problem in #3356 (comment) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b0a32ccde
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
farion1231
left a comment
There was a problem hiding this comment.
Thank you for your contribution!
…on1231#3360) * fix(codex): always update model catalog JSON on provider switch Without this fix, the cc-switch-model-catalog.json file and the model_catalog_json field in config.toml were only regenerated when should_sync_backup was true (proxy active or backup exists). Switching providers while the proxy was idle left the catalog pointing at the previous provider's models, requiring a full restart to take effect. After the existing should_sync_backup block, unconditionally call write_codex_provider_live_with_catalog when switching a Codex provider and the proxy is not currently active (live_taken_over == false). This mirrors what live.rs already does during a normal provider apply. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(codex): refresh catalog on restored hot switch --------- Co-authored-by: yueqi.guo <[email protected]> Co-authored-by: Claude Sonnet 4.6 <[email protected]> Co-authored-by: Jason <[email protected]>
…on1231#3360) * fix(codex): always update model catalog JSON on provider switch Without this fix, the cc-switch-model-catalog.json file and the model_catalog_json field in config.toml were only regenerated when should_sync_backup was true (proxy active or backup exists). Switching providers while the proxy was idle left the catalog pointing at the previous provider's models, requiring a full restart to take effect. After the existing should_sync_backup block, unconditionally call write_codex_provider_live_with_catalog when switching a Codex provider and the proxy is not currently active (live_taken_over == false). This mirrors what live.rs already does during a normal provider apply. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(codex): refresh catalog on restored hot switch --------- Co-authored-by: yueqi.guo <[email protected]> Co-authored-by: Claude Sonnet 4.6 <[email protected]> Co-authored-by: Jason <[email protected]>
Summary
cc-switch-model-catalog.jsonandmodel_catalog_jsoninconfig.tomlwere only regenerated when the proxy was active (takeover) or a live backup existed. Switching providers while the proxy was idle left the catalog stale — requiring a full CC Switch restart to pick up the new provider's models.should_sync_backupblock inhot_switch_provider.should_sync_backupblock, unconditionally callwrite_codex_provider_live_with_catalogfor Codex provider switches when the proxy is not currently active (!live_taken_over). This mirrors whatlive.rsalready does during a normal provider apply.Test plan
hot_switch_codex_provider_updates_model_catalog_json_without_proxy_takeover: seeds two providers (each withmodelCatalog), switches without proxy takeover, asserts catalog JSON file is created and contains the new provider's model, and thatconfig.tomlnow includesmodel_catalog_json.hot_switch_codex_*tests still pass.🤖 Generated with Claude Code