Refresh Codex provider label on proxy takeover hot-switch

During proxy takeover, switching third-party Codex providers left the
client-visible provider name stale: sync_codex_live_from_provider_while_proxy_active
based the live config on the existing live file and only patched
base_url/wire_api/model, never refreshing model_provider or
model_providers.<id>.name. The Codex app kept showing the previous
provider in its bottom-right label.

Rebuild the effective settings from the DB for the selected provider so
the live config carries the correct provider key and display name, then
merge MCP servers back from the existing live config. base_url stays
pointed at the local proxy, and official OAuth in auth.json is untouched
(takeover writes config.toml only when auth preservation is enabled).

Generalize preserve_codex_mcp_servers_in_backup ->
preserve_codex_mcp_servers_from_existing_config since it now serves both
the backup and live-sync paths.
This commit is contained in:
Jason
2026-06-01 15:16:13 +08:00
parent aeaa016cae
commit b7499fc871
3 changed files with 78 additions and 21 deletions
+5
View File
@@ -1302,6 +1302,11 @@ wire_api = "responses"
live_config.contains("PROXY_MANAGED"),
"live config should keep the proxy bearer placeholder"
);
assert!(
live_config.contains(r#"model_provider = "deepseek-new""#)
&& live_config.contains(r#"name = "DeepSeek New""#),
"live config should update the Codex-visible provider label during takeover"
);
assert!(
!live_config.contains("https://new.deepseek.example/v1"),
"normal provider base_url must not overwrite taken-over live config"