feat(openai): 支持 OAuth 账号级强制 Codex CLI 身份#4015
Open
alfadb wants to merge 1 commit into
Open
Conversation
alfadb
force-pushed
the
fix/openai-oauth-codex-identity
branch
13 times, most recently
from
July 19, 2026 02:08
b581a7f to
034daa0
Compare
alfadb
force-pushed
the
fix/openai-oauth-codex-identity
branch
10 times, most recently
from
July 23, 2026 08:41
ced6706 to
c8be2aa
Compare
alfadb
force-pushed
the
fix/openai-oauth-codex-identity
branch
from
July 23, 2026 08:53
c8be2aa to
d079ed1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
#3984 已在 OpenAI OAuth 请求的最终出站阶段自动配对 User-Agent、originator 和最低 version,解决身份错配问题。但现有
gateway.force_codex_cli是全局静态配置,无法按账号灰度控制;部分部署需要只将特定 OAuth 账号固定为 Codex CLI 身份,同时让其他账号继续保留codex-tui等官方客户端身份。方案
extra.force_codex_identity,默认关闭,仅对真实 OpenAI OAuth 账号生效。enforceCodexIdentityHeaders。与 #3984 的关系
本 PR 不替换或回退 #3984。开关关闭时完全沿用 #3984 的自动身份配对;开关开启时只增加账号级的 Codex CLI User-Agent 覆盖,随后仍由 #3984 做统一终态校验。
兼容性
accounts.extraJSON 中,无需数据库迁移。false。验证
go test ./internal/service/...go test ./internal/pkg/openai/...golangci-lint run ./...pnpm typecheckpnpm lint:checkpnpm buildforce_codex_cli=false、账号开关开启时调用gpt-5.6-luna的/v1/responses返回 HTTP 200;该结果作为端到端行为验证,不等同于出站 header 抓包。