Empty text parts in history break Responses API providers (missing input.content.text)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 70/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- api
调研方向
问题出在 toModelMessagesEffect 中,其中助手的文本部分被直接加入,没有检查空字符串;issue 建议沿用用户部分的过滤条件(part2.text !== "")。请阅读该函数如何构建助手内容,包括 hasSignedReasoning 时替换为 " " 的逻辑,并确认空文本在哪里进入 AI SDK 的 output_text 转换。完成标准是:历史记录中的空助手文本部分被丢弃,其他行为保持不变。任务中没有指定测试文件,因此请查找针对该转换的现有测试。
由索引模型根据 Issue 内容生成。
描述
Description
When building the request for OpenAI-Responses-compatible providers (e.g. Volcengine Ark plan endpoint https://ark.cn-beijing.volces.com/api/plan/v3 configured via @ai-sdk/openai + custom baseURL), assistant messages in session history that contain an empty-string text part ("text": "") are sent as {"type":"output_text","text":""}. Ark strictly validates this and rejects the whole request with:
MissingParameter: The request failed because it is missing input.content.text parameter. (HTTP 400)
Once one such empty text part exists in the session history (produced by earlier turns of other models that tolerate empty text, e.g. via the Anthropic-compatible endpoint), every subsequent request on that session fails permanently - the session becomes unusable, including when switching to any other Responses-API model.
Verified by calling the Ark API directly:
- [{"role":"assistant","content":[{"type":"output_text","text":""}]},{"role":"user",...}] -> 400 MissingParameter input.content.text
- same request with non-empty text -> 200
Root cause in desktop code (v1.18.25, app.asar): in toModelMessagesEffect, assistant text parts are pushed unconditionally, only replaced with " " when hasSignedReasoning; empty text then flows through the AI SDK into output_text with text: "".
Suggested fix: drop assistant text parts whose text === "" when converting history to model messages (user messages already do this: part2.text !== "" is filtered for user parts).
Request IDs from failing calls: 021791626449725a494df944a230ff836cdfb3920056d77a998d5, 021791626336303d5d07458a5ab4d80457611556e9a6a102788ed
Plugins
none
OpenCode version
1.18.25 (OpenCode Desktop)
Steps to reproduce
- Configure a custom provider using the Responses API:
"volcengine-plan": { "npm": "@ai-sdk/openai", "options": { "baseURL": "https://ark.cn-beijing.volces.com/api/plan/v3", "apiKey": "..." } } - In a session, get at least one assistant turn with an empty text part in history (e.g. produced by another provider/model that emits an empty text block, or a streaming artifact)
- Send any message with the Responses-API model -> request fails with "missing input.content.text", every retry fails, session is stuck
Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
No response
- 主要语言
- TypeScript
- 星标
- 213k
- 派生
- 28.4k
- 平均合并
- 8 小时 58 分钟
- 30 天内合并 PR
- 251
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
anomalyco/opencode 的其他 Issue
-
reproduced
难度 2/5 1-3 小时 新手友好度 70/100
anomalyco/opencode#56038 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
anomalyco/opencode#56002 · 1 条评论 ·
维护者通常 1 天内回复
-
app: keybinds match the produced character, so Ctrl+F and other letter shortcuts fail on non-Latin layouts可能已有人在做 @ZXLyyds100 今天认领。 未关闭reproduced
难度 2/5 1-3 小时 新手友好度 82/100
anomalyco/opencode#55676 · 2 条评论 ·
维护者通常 1 天内回复
-
tui: NumPad End/Home ignored under kitty keyboard protocol (Windows Terminal reports KP_END 57424)可能已有人在做 @argszero 今天认领。 未关闭reproduced
难度 2/5 1-3 小时 新手友好度 75/100
anomalyco/opencode#55533 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
anomalyco/opencode#55383 · 3 条评论 ·
维护者通常 1 天内回复
查看 anomalyco/opencode 的全部 Issue
相似的 Issue
-
streams:add
难度 2/5 1 小时以内 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
apache/rocketmq-dashboard#6872 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
interledger/publisher-tools#931 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
ARTPARK-SAHAI-ORG/calibrate-frontend#727 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 70/100
fab-geocommuns/RNB-site#539 ·
维护者通常 2 天内回复