From d511b1fe639e806a93f79d37864973d2ce64d161 Mon Sep 17 00:00:00 2001 From: fylorn <249551762+fylorn@users.noreply.github.com> Date: Wed, 23 Sep 2026 11:28:20 +0800 Subject: [PATCH] fix(adopt): the Codex client is not only the CLI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `~/.codex/config.toml` is one file behind two front ends: the codex CLI, and the copy bundled inside the ChatGPT desktop app (`ChatGPT.app/Contents/Resources/codex` — the same binary). The desktop app starts its app-server with no provider override, so `model_provider` in that file decides where its local sessions go. Measured: point `model_provider` at a local probe, launch the desktop app and touch nothing, and the probe receives `GET /v1/models?client_version=0.153.4` with `originator: Codex Desktop` and the configured bearer token. So a row labelled "Codex CLI" was telling someone who installed only the desktop app about a CLI they do not have, and adopting it quietly covered an app the confirmation dialog never named. The client is now "Codex", and the cost list says the desktop app is adopted too and has to be restarted for that to take effect. Also recorded in a comment: 0.153.4 does issue `GET /v1/models`, which 0.139.0 did not. Whether that list has any effect is not measured, so the `model_list` cost sentence is left as it is. Co-Authored-By: Claude Opus 5 --- crates/tw-adopt/src/clients.rs | 21 ++++++++++++++++++--- crates/tw-adopt/src/mcp.rs | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/crates/tw-adopt/src/clients.rs b/crates/tw-adopt/src/clients.rs index f08d3956..fc1349a2 100644 --- a/crates/tw-adopt/src/clients.rs +++ b/crates/tw-adopt/src/clients.rs @@ -232,9 +232,15 @@ pub fn adoptable() -> Vec { key_elsewhere: None, config_beats_env: true, }, + // **不叫「Codex CLI」。**`~/.codex/config.toml` 是一份配置、两个 + // 前端:命令行的 codex,和 ChatGPT 桌面版内置的那一个 + // (`ChatGPT.app/Contents/Resources/codex`,同一个二进制)。桌面版 + // 启动 app-server 时不带任何 provider 覆盖,`model_provider` 完全 + // 由这个文件决定 —— 只装了桌面版的用户看到「Codex CLI」,会以为 + // 在说一个他没装的东西。 Client { id: "codex", - name: "Codex CLI", + name: "Codex", config: ".codex/config.toml", format: Format::Toml, // **读环境变量的,必须关掉终端重开** @@ -245,7 +251,12 @@ pub fn adoptable() -> Vec { costs: &[ ( "adopt.cost.codex.model_list", - "Codex CLI does not read the model list from the gateway, so a custom model name has no effect; its local model catalogue decides.", + "Codex does not read the model list from the gateway, so a custom model name has no effect; its local model catalogue decides.", + ), + // 接管这个文件顺带接管了桌面版,**这件事要在确认之前说** + ( + "adopt.cost.codex.chatgpt_desktop", + "The ChatGPT desktop app reads the same configuration file, so its local Codex sessions go through the gateway as well; the app has to be restarted for that to take effect.", ), ( "adopt.cost.codex.reopen_terminal", @@ -467,7 +478,11 @@ pub fn edits(client: &Client, gw: &Gateway) -> Vec { // 的,并且用一个本地嗅探器实跑验证过:请求真的落在 // `POST /v1/responses`,`http_headers` 原样送达, // `experimental_bearer_token` 变成 `Authorization: Bearer`。 - // 一个 GET 都没有 —— 它确实不问我们要模型列表。 + // + // 0.139.0 上一个 GET 都没有。**0.153.4 变了**:命令行和 ChatGPT + // 桌面版都会先来一个 `GET /v1/models?client_version=…`。拿到的列表 + // 有没有真的影响可用模型还没实测,所以 `adopt.cost.codex.model_list` + // 那一句先照原样留着。 "codex" => { let p = |k: &str| { vec![ diff --git a/crates/tw-adopt/src/mcp.rs b/crates/tw-adopt/src/mcp.rs index 0d9bfc25..577b48fb 100644 --- a/crates/tw-adopt/src/mcp.rs +++ b/crates/tw-adopt/src/mcp.rs @@ -100,7 +100,7 @@ pub fn targets() -> Vec { }, Target { client: "codex", - name: "Codex CLI", + name: "Codex", config: ".codex/config.toml", format: Format::Toml, key: "mcp_servers",