From 91deaf094e1593d16961968fcbfdac22c1205449 Mon Sep 17 00:00:00 2001 From: lif <1835304752@qq.com> Date: Sat, 27 Dec 2025 21:12:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4=E5=B7=B2=E5=BA=9F?= =?UTF-8?q?=E5=BC=83=E7=9A=84=20sync=5Fenabled=5Fto=5Fcodex=20=E8=B0=83?= =?UTF-8?q?=E7=94=A8=20(#460)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(mcp): 移除同步Codex Provider时的旧MCP同步调用 sync_enabled_to_codex使用旧的config.mcp.codex结构, 在v3.7.0统一结构中该字段为空,导致MCP配置被错误清除。 MCP同步应通过McpService进行。 Fixes #403 * test(mcp): update test to reflect new MCP sync architecture Remove MCP-related assertions from sync_codex_provider_writes_auth_and_config test since provider switching no longer triggers MCP sync in v3.7.0+. MCP synchronization is now handled independently by McpService, not as part of the provider switch flow. --------- Co-authored-by: Jason --- src-tauri/tests/import_export_sync.rs | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src-tauri/tests/import_export_sync.rs b/src-tauri/tests/import_export_sync.rs index aaaeb6f13..3b268dbbd 100644 --- a/src-tauri/tests/import_export_sync.rs +++ b/src-tauri/tests/import_export_sync.rs @@ -76,19 +76,8 @@ fn sync_codex_provider_writes_auth_and_config() { let mut config = MultiAppConfig::default(); - // 添加入测 MCP 启用项,确保 sync_enabled_to_codex 会写入 TOML - config.mcp.codex.servers.insert( - "echo-server".into(), - json!({ - "id": "echo-server", - "enabled": true, - "server": { - "type": "stdio", - "command": "echo", - "args": ["hello"] - } - }), - ); + // 注意:v3.7.0 后 MCP 同步由 McpService 独立处理,不再通过 provider 切换触发 + // 此测试仅验证 auth.json 和 config.toml 基础配置的写入 let provider_config = json!({ "auth": { @@ -133,9 +122,10 @@ fn sync_codex_provider_writes_auth_and_config() { ); let toml_text = fs::read_to_string(&config_path).expect("read config.toml"); + // 验证基础配置正确写入 assert!( - toml_text.contains("command = \"echo\""), - "config.toml should contain serialized enabled MCP server" + toml_text.contains("base_url"), + "config.toml should contain base_url from provider config" ); // 当前供应商应同步最新 config 文本