Skip to content

fix(codex): 修复版本请求头导致新模型调用失败 - #107

Open
MattLYT wants to merge 1 commit into
BigStrongSun:mainfrom
MattLYT:codex/codex-version-header-3.20.4
Open

MattLYT wants to merge 1 commit into
BigStrongSun:mainfrom
MattLYT:codex/codex-version-header-3.20.4

Conversation

@MattLYT

@MattLYT MattLYT commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary / 概述

修复 Codex 经本地代理调用 OpenAI Official 的 gpt-6.1-sol 时返回 HTTP 400、提示 ChatGPT 账号不支持该模型的问题。

对照实验中,同一官方请求携带 version: 0.158.0-alpha.2.1 时返回上述错误,移除该请求头后返回 HTTP 200、OK 和 response.completed。该头由代理从真实 Codex User-Agent 提取并合成;两份不同的 access token 均可独立成功调用,因此本次不修改或同步凭证。上游为何拒绝该版本值尚未确认。

本次仅修改 src-tauri/src/proxy/forwarder.rs:

  • 停止从 User-Agent 合成独立的 version 请求头,并删除不再使用的提取函数。
  • 保留清除旧 version 覆盖值的行为,同时保留真实 User-Agent、可信 originator、认证及可信原生 attestation。
  • 在普通转发、原生透传和实时转发共用的身份规范化入口修复;不改变非官方上游行为。
  • 更新回归测试,检查不合成版本头、清除旧值以及其他请求头保持不变。

验证

  • 修复前:实际 Codex CLI 经 CCSM 可复现原始 HTTP 400。
  • 基于 v3.20.4-1 执行转发模块针对性测试:cargo test --manifest-path src-tauri/Cargo.toml --lib proxy::forwarder::tests:: -- --test-threads=1,177 项通过。
  • 完成 release 安装包构建及本地事务式升级后,实际 Codex CLI 经生产 CCSM 代理调用 gpt-6.1-sol、gpt-6-astra 均返回 OK 和 turn.completed;代理日志确认路由至 OpenAI Official,上游均返回 HTTP 200。
  • 已通过修改文件的 rustfmt 检查和 Git 差异空白检查。未验证 GUI 模型选择流程。
  • 子代理独立复验:TypeScript 类型检查、前端格式检查和 Clippy 均通过,转发模块测试再次获得 177 项通过、0 项失败。测试编译出现两条位于未修改文件的 Rust 警告(runner_tests.rs 的 dead_code、session_usage_codex.rs 的 invalid_from_utf8);Clippy 无警告或错误。未运行全量 Rust 测试。

Related Issue / 关联 Issue

无。

Screenshots / 截图

不适用,本次为请求转发逻辑修复,无界面变化。

Checklist / 检查清单

  • pnpm typecheck passes / 通过 TypeScript 类型检查。
  • pnpm format:check passes / 通过前端格式检查;修改的 Rust 文件另已通过 rustfmt 检查。
  • cargo clippy passes (if Rust code changed) / cargo clippy --manifest-path src-tauri/Cargo.toml 通过,无警告或错误。
  • Updated i18n files if user-facing text changed / 不适用,未修改用户可见文本。

Controlled Sol requests return HTTP 400 with version 0.158.0-alpha.2.1 and complete successfully without it. Preserve User-Agent, trusted originator, authentication and native attestation while retaining removal of stale version overrides.

Validation: 46 Codex forwarder regression tests passed; rustfmt and diff checks. Installed runtime validation follows the local build and upgrade transaction.
@MattLYT
MattLYT marked this pull request as ready for review September 30, 2026 04:51

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant