Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#55,392 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
70/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
api

Direzione di ricerca

Il bug si trova in toModelMessagesEffect, dove le parti di testo dell'assistente vengono aggiunte senza un controllo sulla stringa vuota; l'issue propone di replicare il filtro delle parti utente (part2.text !== ""). Leggi come quella funzione costruisce il contenuto dell'assistente, incluso la sostituzione con " " per hasSignedReasoning, e verifica dove il testo vuoto arriva alla conversione output_text dell'AI SDK. È completato quando le parti di testo vuote dell'assistente vengono eliminate dalla cronologia e il resto del comportamento resta invariato. Il testo non indica alcun file di test, quindi cerca i test esistenti per questa conversione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TypeScript
Stelle
213k
Fork
28.4k
Merge medio
8h 32m
PR unite (30g)
253

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di anomalyco/opencode

Tutte le issue di anomalyco/opencode

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.