fix(relay-config): fix TOML merge and model catalog sync - #2006
Open
ViceEye wants to merge 2 commits into
Open
Conversation
normalize_duplicate_toml_text 之前按整行字符串去重表头/根键, 遇到第二次 出现的表头就整段丢弃表体。这在语义上是错的: [mcp_servers.node_repl] (带正确的 .env 子表) 和其后一个裸的空 [mcp_servers] 表头是两个不同的 字符串, 行级去重看不出它们是同一棵 TOML 树的父子关系, 也看不出同一 表头出现两次、各自只写了部分字段时应该合并而不是丢弃后者。 真实故障: Codex config.toml 反复复现 invalid transport, 根因是 split_relay_context_config_sections 迁移 common/context 配置段时纯 文本拼接无去重, 让裸 env 变量和 .env 子表的历史残留一起原样保留进了 最终文件。 改为按顶层表头/根键切块, 每块单独 parse 成 DocumentMut, 用已有的 merge_toml_table_like 做语义合并(标量后写覆盖前写, 子表递归合并、 不清空)。任一块解析失败则退回原逐行丢弃策略, 保证不比修复前更差。 新增 3 个回归测试覆盖: 子表与后出现空父表头合并、同表头两次出现各写 部分字段的合并、根键重复后写覆盖前写。codex-plus-core 全量 300 个测试 + codex-plus-data 10 个测试通过(cargo test, rust:latest docker 镜像)。
ViceEye
force-pushed
the
fix/toml-header-dedup-semantic-merge
branch
from
August 27, 2026 20:23
f1a7fd6 to
cd1eba2
Compare
Contributor
Author
摘要修复两个 relay 配置问题:
TOML 语义合并用 TOML 语义合并替代原来的按文本行去重。
修复以下场景:
避免 MCP/plugin 配置损坏导致 Context 配置支持 profile 中的绝对 token 配置: model_context_window = 1000000
model_auto_compact_token_limit = 900000模型窗口优先级: 复制外部 catalog 到 Codex++ 管理的 catalog 时:
回归测试覆盖:
验证结果
测试在
|
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
Fix two relay configuration issues:
config.tomlafter repeated MCP/plugin merges.TOML Semantic Merge
Replace line-based duplicate removal with semantic TOML merging.
merge_toml_table_like.Fixes cases involving:
[mcp_servers.node_repl][mcp_servers.node_repl.env][mcp_servers]Prevents
invalid transporterrors caused by malformed MCP/plugin configuration.Context Configuration
Support absolute token values from the profile:
Model window priority:
When copying an external catalog into a Codex++ managed catalog:
context_window.max_context_window.use_responses_lite = falsefor custom Responses providers.model_auto_compact_token_limituses the absolute token value from the profile.Regression Coverage
Covered:
Validation
cargo test -p codex-plus-core --test model_suffixcargo test -p codex-plus-core --test relay_configgit diff --checkTests ran in
rust:latestDocker because no local Rust toolchain is installed.cargo fmt --checkwas unavailable because the Docker image does not includerustfmt.