Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Empty text parts in history break Responses API providers (missing input.content.text)

已关闭 适合新手
#55,392 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
70/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
api

调研方向

问题出在 toModelMessagesEffect 中,其中助手的文本部分被直接加入,没有检查空字符串;issue 建议沿用用户部分的过滤条件(part2.text !== "")。请阅读该函数如何构建助手内容,包括 hasSignedReasoning 时替换为 " " 的逻辑,并确认空文本在哪里进入 AI SDK 的 output_text 转换。完成标准是:历史记录中的空助手文本部分被丢弃,其他行为保持不变。任务中没有指定测试文件,因此请查找针对该转换的现有测试。

由索引模型根据 Issue 内容生成。

描述

pending close triaging
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
  1. 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": "..." } }
  2. 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)
  3. 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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。