fix(codex): respect user-owned model_catalog_json when generating catalog - #454
Open
czfhhh wants to merge 1 commit into
Open
fix(codex): respect user-owned model_catalog_json when generating catalog#454czfhhh wants to merge 1 commit into
czfhhh wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Port the user-owned model-catalog fix from the desktop upstream (farion1231/cc-switch#6087). When model mapping generates the Codex catalog, cc-switch-cli currently replaces any existing
model_catalog_jsonvalue withcc-switch-model-catalog.json. This PR makes the write side preserve user-managed catalog pointers.Problem
set_codex_model_catalog_json_fieldinsrc-tauri/src/codex_config.rshas two arms:Nonearm already checks ownership and only removes cc-switch-owned pointers.Somearm unconditionally writesCC_SWITCH_CODEX_MODEL_CATALOG_FILENAME, clobbering user paths such as~/.codex/model-catalog.local.json.Starting the Codex local route with model mapping enabled therefore rewrites
config.toml, breaking setups that depend on a user-managed catalog file. This builds on #265, which closed #260 by switching the same write to a relative filename.Fix
Mirror the
Nonearm's ownership rule in theSomearm: claim the pointer only when it is absent or already cc-switch-owned (matched by filename); otherwise leave the user's catalog path untouched. The generatedcc-switch-model-catalog.jsonfile is still written, so model-mapping based proxy routing keeps working.Testing
cargo fmt --checkpasses.cargo test --lib: 4334 passed, 0 failed, 2 ignored (CI-style sandbox environment).Somearm:set_catalog_json_some_preserves_user_owned_catalog(absolute custom path)set_catalog_json_some_preserves_user_owned_relative_filename(bare custom filename)model_catalog_json, enabling the Codex local route keeps the pointer inconfig.tomland multi-model routing continues to work.