fix(config): generate custom model catalog for non-standard models with context_window#1261
Open
lennney wants to merge 1 commit into
Open
fix(config): generate custom model catalog for non-standard models with context_window#1261lennney wants to merge 1 commit into
lennney wants to merge 1 commit into
Conversation
7a9d5ce to
95baadb
Compare
2 tasks
dca162a to
8dbeefc
Compare
Owner
|
当前 PR 的 Windows artifacts 检查仍然失败,暂时不能合并。请先 rebase/merge 最新 |
…th context_window When model_context_window is set for a custom model (e.g. mimo-v2.5) that isn't in the standard OpenAI catalog, Codex CLI previously ignored the value and fell back to the default 272000. Now apply_context_limits_to_config() detects when: - model_context_window is set - model_catalog_json is not already configured - A model name is present And generates ~/.codex/model_catalog_custom.json with the model's context_window, then sets model_catalog_json to point to it. Also fixes: - Restore select_packaged_codex_debug_port lost in rebase - Move custom catalog generation after model_catalog_to_config to avoid overwriting Closes BigPizzaV3#1260
8dbeefc to
f2f912f
Compare
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.
Problem
When
model_context_windowis set for a custom model (e.g.mimo-v2.5) that isn't in the standard OpenAI catalog, Codex CLI ignores the configured value and falls back to its default 272000 tokens.Why this happens: Codex CLI uses
model_catalog_jsonas its model metadata source. Custom models aren't in the built-in catalog, somodel_context_windowhas no catalog entry to attach to — it gets dropped silently.Solution
Detect when
model_context_windowis set butmodel_catalog_jsonisn't configured, and auto-generate~/.codex/model_catalog_custom.jsonwith the model's context window entry.This is complementary to the existing suffix-based catalog (
model_list: "deepseek-v4-pro[1M]") — this PR handles the single-model case where the user sets context_window directly in the UI.New function:
ensure_custom_model_catalog(home, config_text, profile)— no-ops when catalog already exists or context_window is empty.Changes
relay_config.rs(+68): Newensure_custom_model_catalog()+ caller updates to passhometests/relay_config.rs(+4 test cases): all catalog generation scenariosTest Coverage
Relation to #1451
This PR handles the per-model context_window use case. #1451 (model catalog precompute) handles the startup speed use case by generating a catalog for all models. Both write to separate files and don't conflict.