feat(openai): 支持 OAuth 账号级强制 Codex CLI 身份 - #4015
#4015Open
alfadb wants to merge 1 commit into
Wei-Shaw:mainWei-Shaw/sub2api:mainfrom
alfadb:fix/openai-oauth-codex-identityalfadb/sub2api:fix/openai-oauth-codex-identityCopy head branch name to clipboard
Open
feat(openai): 支持 OAuth 账号级强制 Codex CLI 身份#4015alfadb wants to merge 1 commit intoWei-Shaw:mainWei-Shaw/sub2api:mainfrom alfadb:fix/openai-oauth-codex-identityalfadb/sub2api:fix/openai-oauth-codex-identityCopy head branch name to clipboard
alfadb wants to merge 1 commit into
Wei-Shaw:mainWei-Shaw/sub2api:mainfrom
alfadb:fix/openai-oauth-codex-identityalfadb/sub2api:fix/openai-oauth-codex-identityCopy head branch name to clipboard
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
15 times, most recently
from
July 26, 2026 00:38
8cd74f0 to
0b3f01a
Compare
alfadb
force-pushed
the
fix/openai-oauth-codex-identity
branch
2 times, most recently
from
July 28, 2026 02:16
5b6bb55 to
6188f64
Compare
alfadb
force-pushed
the
fix/openai-oauth-codex-identity
branch
from
July 29, 2026 01:19
6188f64 to
b80fedf
Compare
alfadb
force-pushed
the
fix/openai-oauth-codex-identity
branch
from
July 29, 2026 01:51
b80fedf to
24a7de4
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 抓包。