fix(catalog): honor Manager context window for suffixless custom models (#1594) - #1722
fix(catalog): honor Manager context window for suffixless custom models (#1594)#1722LeoLin990405 wants to merge 3 commits into
Conversation
…#1594) PR BigPizzaV3#1722 fixed the early return in apply_model_catalog_to_config that silently dropped the Manager's context window for suffixless custom models. Codex then fell back to its bundled 272000 default and the CLI showed ~258K instead of the configured value. The fix moves the fallback parse before the early return and adds fallback.is_none() to the guard, so a user-configured context window forces catalog generation. Two integration tests failed because they set context_window=200000 while asserting no catalog generation. Updated them as follows: - apply_relay_profile_does_not_write_model_catalog_json_for_selected_models: removed context_window, preserving the original intent (no catalog when nothing is customized). - apply_relay_profile_no_catalog_when_model_list_has_no_suffix -> renamed to apply_relay_profile_generates_catalog_when_context_window_configured: now tests the positive case -- context_window set, no suffix -> catalog IS generated with the correct window value in both config.toml and the catalog JSON.
…#1594) PR BigPizzaV3#1722 fixed the early return in apply_model_catalog_to_config that silently dropped the Manager's context window for suffixless custom models. Codex then fell back to its bundled 272000 default and the CLI showed ~258K instead of the configured value. The fix moves the fallback parse before the early return and adds fallback.is_none() to the guard, so a user-configured context window forces catalog generation. Two integration tests failed because they set context_window=200000 while asserting no catalog generation. Both tests now omit context_window and auto_compact_limit, preserving their original intent: no catalog when nothing is customized. Closes BigPizzaV3#1722 References BigPizzaV3#1594
|
审查结论:当前分支仍不能合并。Windows artifacts CI 的 |
|
已折入那两个集成测试的修复(commit
本地 感谢 @dongyu23 在 #1786 里定位到这两个集成测试 —— 已在本 PR 内一并修好,保持单一 PR 自洽。 |
|
已 rebase 到最新 |
3060250 to
dbd093f
Compare
|
复审确认核心修复成立:当前 main 仍在解析 profile 级 |
|
核心修复结论不变:无后缀且无内置 metadata 的自定义模型,应在配置了 context_window 时生成 catalog。请 rebase 当前 main(已包含 #1934 和后续 relay_config 迁移),保留最小改动并重新运行 relay_config、core 与三平台 CI;冲突解决且 CI 转绿后可继续合并评估。 |
|
|
apply_model_catalog_to_config returned before generating a catalog when a custom model had neither a `[window]` suffix nor bundled metadata — even if the user configured a context window in the Manager. Codex then fell back to its bundled 272000 default, so the CLI showed ~258K regardless of the 1M the user set. Generate the catalog (and propagate the window) whenever the user supplied a context window too. Adds a regression test. Fixes BigPizzaV3#1594.
apply_relay_profile_{does_not_write_model_catalog_json_for_selected_models,
no_catalog_when_model_list_has_no_suffix} set a context window and asserted no
catalog. Now that a configured window generates a catalog (BigPizzaV3#1594), drop the
window from these no-suffix cases so they keep exercising the no-catalog path;
window->config.toml stays covered elsewhere and window->catalog is covered by
generates_catalog_with_user_context_window_*.
…ehavior Per review: complement generates_catalog_with_user_context_window_* with a regression test proving a suffixless, non-bundled, non-DeepSeek-v4 custom model generates NO catalog when no context window is configured — i.e. the fix only adds catalog generation for the explicitly-configured-window case.
|
已按 review rebase 到最新 最小改动保持:仅在显式配置 |
dbd093f to
63f58cf
Compare
|
补充定位:本 PR 的 Windows artifacts red 不来自本 PR 的改动,而是
一行修复(供参考): 本 PR 的改动本身已按 review 就绪:最小 catalog 修复 + 两个方向的回归测试( |
Root cause
apply_model_catalog_to_configreturns before generating a catalog when a custom model has neither a[window]suffix nor bundled metadata — even if the user configured a context window in the Manager. Theparse_optional_positive_u64(&profile.context_window, …)that reads the user's value sat after that early return, so it never ran. Codex then falls back to its bundled272000default (→272000 − 13840reserved ≈ 258160, the "258K" users report) regardless of the 1M they set.Repro (from #1594): custom provider on
http://127.0.0.1:57321/v1, modeldeepseek-v4-flash(native 1M), Manager context window = 1,000,000 → Codex CLI shows 258K / 258K for every model.Fix
Parse the configured window first, then generate the catalog whenever there is anything to customize — a
[window]suffix, bundled metadata, or a user-supplied context window. When the user set no window, behavior is unchanged (a plain custom model still gets no generated catalog).Verification
New regression test
generates_catalog_with_user_context_window_for_suffixless_custom_model(RED before the fix, GREEN after).cargo test -p codex-plus-core --lib→ 202 passed, 0 failed.Fixes #1594.