切引擎到 Codex/GPT-5.5 时,历史 input[].id 超过 64 字符导致 400 string_above_max_length
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
### 问题描述 / What happened
同一条对话里,从 Gateway 模型(如 x-ai-grok/grok-4.6)切到 Codex/OpenAI Responses 模型(如 codex/gpt-5.5)并 resume 原 thread 后,下一轮请求失败。
原因:Gateway 历史里的 item id(尤其 ws_* / tco_*)长达 84/85 字符。切到 Codex 后这些 id 被原样塞进 Responses API 的 input[n].id。OpenAI 限制该字段 ≤ 64 字符,LiteLLM 把上游 400 原样包回客户端。
这不是用户输入问题,也不是上下文超长。同一条会话里重试、compact 都会继续失败。
根因
OpenAI Responses API 校验 input[n].id 最长 64。
Gateway 历史里实际 id 形如:
ws_0cb4cb13-dee8-9afb-aece-c5ec0b3bf2bf_call-94cd3890-d2bb-41ae-8c39-9613c70a322c-24 # 84
tco_0cb4cb13-dee8-9afb-aece-c5ec0b3bf2bf_call-94cd3890-d2bb-41ae-8c39-9613c70a322c-24 # 85
结构:{prefix}_{uuid}_call-{uuid}-{n}
ws_ = 3,总长 84
tco_ = 4,总长 85
这条 rollout 里至少 8 个超长 id。input[74] 说明是长会话回放,不是单条新消息。
Grok 自己能吃这些 id;切到 Codex 后未做 remap/truncate,请求被 OpenAI 拒绝。
同源问题(建议一并修)
同一类「切引擎不改编历史 id」还有前缀校验失败:
Invalid 'input[18].id': 'fc_24d4b468-46a3-9c15-b839-7ee1978b7f4a_0'. Expected an ID that begins with 'ctc'.
以及 compact 同样失败:
Error running remote compact task: ... Invalid 'input[35].id': ... expected 64, got 83
说明问题在历史序列化 / resume / compact 公共路径,不只是普通 turn。
### 环境 / Environment
Cindy Desktop 0.1.77(win32-x64 hotfix)
Codex CLI 0.153.4
OS:Windows
复现会话:910f32c3-0fe4-41c6-bc4a-bb33a22fca46
thread:01a08a53-1702-72e3-bc2f-cd4d836ed99f
### 复现步骤 / Steps to reproduce
1. 新建对话,引擎选 x-ai-grok/grok-4.6(cindy_gateway)
2. 进行多轮,触发工具调用(尤其 web search)
3. 同一条会话切到 codex/gpt-5.5(cindy_codex),resume 原 thread
4. 再发一条消息(内容无关,复现时发了 111)
### 日志与截图 / Logs & screenshots
关键日志:
startSession model=x-ai-grok/grok-4.6 provider=cindy_gateway resume=new
thread/start ok threadId=01a08a53-1702-72e3-bc2f-cd4d836ed99f modelProvider=cindy_gateway
startSession model=codex/gpt-5.5 provider=cindy_codex resume=01a08a53-1702-72e3-bc2f-cd4d836ed99f
thread/resume ok modelProvider=cindy_codex
codex turn error string_above_max_length input[74].id expected 64 got 84
Contributor guide
Research direction
Start by tracing the shared history serialization, thread resume, and compact paths involved when switching from cindy_gateway to cindy_codex, then reproduce with the supplied session and thread IDs. Done means resumed and compacted histories no longer send incompatible or overlong input IDs to the Codex/OpenAI Responses API, including the reported tool-call cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100