Skip to content

Fix CSP compatibility and implement MOC126 and MOC-153 updates#396

Closed
Alpaca233114514 wants to merge 5 commits into
Cmochance:mainfrom
Alpaca233114514:codex/MOC153
Closed

Fix CSP compatibility and implement MOC126 and MOC-153 updates#396
Alpaca233114514 wants to merge 5 commits into
Cmochance:mainfrom
Alpaca233114514:codex/MOC153

Conversation

@Alpaca233114514

Copy link
Copy Markdown
Contributor

Fix CSP compatibility and implement MOC126 and MOC-153 updates

Alpaca233114514 and others added 5 commits June 1, 2026 19:35
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@Alpaca233114514

Copy link
Copy Markdown
Contributor Author

?126怎么在上面

Cmochance added a commit that referenced this pull request Jun 6, 2026
切 GPT 走 relay /backend-api/.../responses,被 passthrough_chatgpt_backend
提前拦截、不经 Adapter。原 #396/#398 把注入放在 ResponsesPassthroughAdapter
是死代码路径、从不执行。本 PR 在 passthrough_chatgpt_backend 转发前对切 GPT
对话请求注入 Codex 身份中性占位,过 OpenAI 后端 instructions 非空校验。

收窄触发避免误伤 getAccount/plugins 等 backend 请求;content-length 跟随
重算;注入可观测(INFO + 回写失败去重 WARN);9 单测。待 relay 真机验证生效。
@Cmochance Cmochance mentioned this pull request Jun 6, 2026
@Cmochance

Copy link
Copy Markdown
Owner

#396#398 的子集(5 个 commit 完全相同的 oid,#398 多一个 MOC-174)。处置见 #398 的评论:MOC-153 已在 #418 重做、MOC-36 废弃(asar 证伪)、MOC-126 已 Cancel、MOC-131 已 #354 合并。本 PR 同样建议关闭。

@Cmochance

Copy link
Copy Markdown
Owner

@Alpaca233114514 感谢你对 MOC-153 的排查 🙏 这个 PR 里的 ensure_top_level_instructions(顶层 instructions 为空时注入占位)根因诊断完全正确 —— 第三方起步的会话顶层 instructions 为空,切到 GPT 官方后端硬校验非空 → 400 Instructions are required

最终我们在 #419(已 merge) 里换了个注入位置彻底解决,说明一下原因:

proxy 侧注入(本 PR 在 passthrough/forward 注入)够不着真正出问题的请求。 复现场景是「停掉 transfer 后把会话切到真 GPT」—— 此时 GPT 直连 chatgpt.com、完全不经过 transfer 的 proxy(真机 forward-trace 对 /backend-api/codex/responses 零命中),所以在 proxy 里注入顶层 instructions 永远拦不到这个直连请求。

#419 的做法(方向 C):transfer 给 Codex 的 model catalog(model_catalog_json)每个 model 条目写非空 base_instructions。Codex 在会话创建时就把它冻结进 session_meta.base_instructions(真机 codex exec 实测:catalog 写什么就原样冻结),于是第三方起步的会话出生即带非空顶层 instructions —— 不管之后切不切 GPT、经不经 proxy 都不再 400。对走 proxy 的第三方请求则由 adapter 精确剥离这个 sentinel,保证第三方对话字节级不变、零污染。

你的诊断和「注入非空 instructions」的核心思路直接促成了本次修复,会把你署为 co-author。本 PR 的 MOC-153 部分已由 #419 取代,先 close。感谢 🙏

@Cmochance Cmochance closed this Jun 7, 2026
Cmochance added a commit that referenced this pull request Jun 7, 2026
#419(catalog base_instructions 路线)采纳了 @Alpaca233114514#396/#398 里
的 MOC-153 贡献:第三方切 GPT 报 `Instructions are required` 400 的根因诊断
(顶层 instructions 空)+ 注入非空 instructions 的核心思路。#419 已 squash-merge
进 main、无法 amend,故在此 follow-up commit 以 Co-Authored-By 形式署名。

Co-Authored-By: ALPACA LI <alpaca8570@outlook.com>
Cmochance added a commit that referenced this pull request Jun 7, 2026
#419(catalog base_instructions 路线)采纳了 @Alpaca233114514#396/#398 里
的 MOC-153 贡献:第三方切 GPT 报 `Instructions are required` 400 的根因诊断
(顶层 instructions 空)+ 注入非空 instructions 的核心思路。#419 已 squash-merge
进 main、无法 amend,故在此 follow-up commit 以 Co-Authored-By 形式署名。

Co-Authored-By: ALPACA LI <alpaca8570@outlook.com>
Cmochance added a commit that referenced this pull request Jun 7, 2026
#419(catalog base_instructions 路线)采纳了 @Alpaca233114514#396/#398 里
的 MOC-153 贡献:第三方切 GPT 报 `Instructions are required` 400 的根因诊断
(顶层 instructions 空)+ 注入非空 instructions 的核心思路。#419 已 squash-merge
进 main、无法 amend,故在此 follow-up commit 以 Co-Authored-By 形式署名。

Co-authored-by: ALPACA LI <alpaca8570@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants