Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đã đóng Phù hợp với người mới
#55,392 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
70/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
api

Hướng nghiên cứu

Lỗi nằm ở toModelMessagesEffect, nơi các phần văn bản của assistant được thêm vào mà không kiểm tra chuỗi rỗng; issue đề xuất áp dụng lại bộ lọc của phần người dùng (part2.text !== ""). Hãy đọc cách hàm này dựng nội dung của assistant, bao gồm việc thay bằng " " khi hasSignedReasoning, rồi xác nhận văn bản rỗng đi đến đâu trong bước chuyển đổi output_text của AI SDK. Hoàn thành khi các phần văn bản rỗng của assistant bị loại khỏi lịch sử và phần hành vi còn lại không đổi. Yêu cầu không nêu tên tệp kiểm thử nào, nên hãy tìm các kiểm thử hiện có cho phép chuyển đổi này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
213k
Fork
28.4k
Merge trung bình
8 giờ 58 phút
Pull request đã merge (30 ngày)
251

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của anomalyco/opencode

Tất cả issue của anomalyco/opencode

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.