From cd13d904d76d6a3045915fb736e875e890ac0dae Mon Sep 17 00:00:00 2001 From: decolua Date: Wed, 5 Aug 2026 15:53:20 +0700 Subject: [PATCH] fix(passthrough): detect codex-tui/Codex Desktop as native Codex client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit detectClientTool only matched the legacy "codex-cli" User-Agent, so the current codex-tui CLI and Codex Desktop (UA "Codex Desktop", originator "codex_work_desktop") fell through to null and lost native passthrough — their requests got re-translated, stripping/overwriting fields like reasoning.summary instead of forwarding the client body as-is. Co-Authored-By: Claude Sonnet 5 --- open-sse/utils/clientDetector.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/open-sse/utils/clientDetector.js b/open-sse/utils/clientDetector.js index 2d1381bc..12020762 100644 --- a/open-sse/utils/clientDetector.js +++ b/open-sse/utils/clientDetector.js @@ -22,6 +22,7 @@ export function detectClientTool(headers = {}, body = {}) { const xApp = (headers["x-app"] || "").toLowerCase(); const openaiIntent = (headers["openai-intent"] || "").toLowerCase(); const initiator = (headers["x-initiator"] || headers["X-Initiator"] || "").toLowerCase(); + const originator = (headers["originator"] || "").toLowerCase(); // Antigravity: detected via body field (not header) if (body.userAgent === "antigravity") return "antigravity"; @@ -37,8 +38,10 @@ export function detectClientTool(headers = {}, body = {}) { // Gemini CLI if (ua.includes("gemini-cli")) return "gemini-cli"; - // Codex CLI - if (ua.includes("codex-cli")) return "codex"; + // Codex CLI/Desktop — codex-tui is the current Rust CLI, codex-cli/codex_cli_rs legacy; + // Codex Desktop identifies via UA "Codex Desktop" or originator "codex_work_desktop" + if (ua.includes("codex-tui") || ua.includes("codex-cli") || ua.includes("codex_cli_rs") || + ua.includes("codex desktop") || originator.startsWith("codex_")) return "codex"; // DeepSeek TUI if (ua.includes("deepseek-tui")) return "deepseek-tui";