fix(config): generate custom model catalog for non-standard models with context_window#1261
Open
lennney wants to merge 4 commits into
Open
fix(config): generate custom model catalog for non-standard models with context_window#1261lennney wants to merge 4 commits into
lennney wants to merge 4 commits into
Conversation
Prevents port collision when multiple Windows RDP users run Codex++ on the same machine. Resolution order: 1. CODEX_PLUS_GUARD_PORT env var — exact override for all roles 2. CODEX_PLUS_LAUNCHER_GUARD_PORT / CODEX_PLUS_MANAGER_GUARD_PORT — role-specific env override 3. CODEX_PLUS_GUARD_PORT_OFFSET env var — explicit offset from base 4. Windows: auto-offset by USERNAME hash (mod 1000) 5. Other platforms: 0 (backward-compatible default) Old constants LAUNCHER_GUARD_PORT / MANAGER_GUARD_PORT replaced with launcher_guard_port() / manager_guard_port() functions. Fixes BigPizzaV3#328
…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. This allows Codex CLI to find the model in the catalog and use the user-specified context window. Also fixes unsafe set_var/remove_var calls in ports.rs tests for Rust 2024 edition compatibility. Closes BigPizzaV3#1260
32f5899 to
f60bef3
Compare
7a9d5ce to
95baadb
Compare
…nfig The custom model catalog fallback (ensure_custom_model_catalog) was incorrectly placed inside apply_context_limits_to_config, which runs BEFORE apply_model_catalog_to_config. This caused two bugs: 1. For suffixed model_list: ensure_custom_model_catalog wrote model_catalog_custom.json first, then apply_model_catalog_to_config saw a mismatched model_catalog_json value and skipped relay catalog generation entirely. 2. For unsuffixed model_list: ensure_custom_model_catalog generated an unwanted catalog, even when no context_window was set. Fix: - Remove home param and ensure_custom_model_catalog call from apply_context_limits_to_config - Add apply_custom_catalog_fallback() called AFTER apply_model_catalog_to_config at all profile-based call sites - Update test for context_window without suffixes to expect custom fallback catalog generation
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 value and falls back to the default 272000.Root cause: Codex CLI looks up models in its catalog. Custom models aren't found, so the configured
model_context_windowis never used.Solution
Modified
apply_context_limits_to_config()to detect when:model_context_windowis setmodel_catalog_jsonis not already configuredAnd generates
~/.codex/model_catalog_custom.jsonwith the model's context window, then setsmodel_catalog_jsonto point to it.This allows Codex CLI to find the model in the catalog and use the user-specified context window.
Changes
relay_config.rs(+68 lines): Addedensure_custom_model_catalog()function and updated callers to passhomeports.rs: Fixed unsafeset_var/remove_varcalls for Rust 2024 editiontests/relay_config.rs(+136 lines): 4 new test cases covering all scenariosTest Results
All tests pass:
Scenarios Covered
Closes #1260