Skip to content

fix(MOC-153): catalog 写非空 base_instructions 修第三方切真 GPT 400#419

Merged
Cmochance merged 1 commit into
mainfrom
fix/MOC-153-catalog-base-instructions
Jun 7, 2026
Merged

fix(MOC-153): catalog 写非空 base_instructions 修第三方切真 GPT 400#419
Cmochance merged 1 commit into
mainfrom
fix/MOC-153-catalog-base-instructions

Conversation

@Cmochance

Copy link
Copy Markdown
Owner

问题

第三方模型(MiniMax / MiMo 等)起步的会话切换到真 GPT(gpt-5.5)后发消息,Codex 内联报 400 Instructions are required、对话卡死。

根因(真机实测坐实)

transfer 给 Codex model_catalog_json 每个 entry 写 base_instructions: ""。Codex 在会话创建时把它冻结进 session_meta.base_instructions、跨 resume 不重解析(isolated codex exec 实测:catalog 写什么字符串 session_meta 就原样冻结)。第三方会话起步顶层 instructions 一直空;之后切真 GPT 直连 chatgpt.com 不经 proxy,OpenAI Responses 后端硬校验顶层 instructions 非空 → 400。真 GPT 不经 proxy → 唯一可行修法是让会话出生即带非空 base_instructions

改动

  • registry:新增共享常量 CAS_BASE_INSTRUCTIONS(写入/剥离两端 single source of truth)。
  • model_catalog.rs:每个 catalog entry 写该非空值(替代旧 "")。
  • responses/request.rs:adapter 对第三方请求精确剥离该 sentinel,第三方对话行为不变。
  • 单测 5 个 + README FAQ + CHANGELOG。

用户影响

  • 第三方会话切真 GPT 不再 400。
  • 正常工作的第三方对话(MiniMax 等)行为不变(sentinel 被 adapter 剥离)。

废弃 #418

#418 是方向 B(在 /backend-api passthrough 注入),前提"GPT 经 transfer"被用户场景"停 transfer 切真 GPT"证伪(真 GPT 直连、proxy 够不着)。本 PR 取代之,#418 将关闭。

详细排查记录见 Linear。Refs MOC-153

第三方模型起步的会话切真 GPT 后报 400 `Instructions are required`。根因:
transfer 给 Codex model catalog 每个 entry 写空串 `base_instructions`,Codex
在会话创建时把它冻结进 session_meta;之后切真 GPT 直连 chatgpt.com(不经 proxy),
OpenAI Responses 后端硬校验顶层 instructions 非空 → 400。真 GPT 不经 proxy,
只能让会话出生即带非空 base_instructions。

- registry 新增共享常量 CAS_BASE_INSTRUCTIONS(写入/剥离两端 single source of truth)
- model_catalog.rs 给每个 catalog entry 写该非空值(替代旧 "")
- responses/request.rs adapter 对第三方请求精确剥离该 sentinel,第三方行为字节级不变
- 4 单测(catalog 非空 / 第三方剥离 string+object / 非 sentinel 不误剥)
- README FAQ + CHANGELOG 同步

2026-06-07 isolated `codex exec` 真机实测坐实:catalog base_instructions
原样冻结进 session_meta(空→空 / 非空→非空)。

Refs MOC-153

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@Cmochance
Cmochance merged commit 1d3c901 into main Jun 7, 2026
5 checks passed
@Cmochance
Cmochance deleted the fix/MOC-153-catalog-base-instructions branch June 7, 2026 05:45
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.

1 participant