Skip to content

[Bug] Missing type:text when assistant returns text + question tool in same step #49708

Closed as not planned

Description

@tieuhaoluong

Description

Problem:
Assistant sends text + question tool in one turn, but the log shows only the tool. The text part is lost.

Repro:

  1. User sends: {"type":"text","text":"request content"}
  2. Assistant sends commentary "This is demo text." plus question tool call
  3. Check data log order

Expected order (5 parts in 1 step):

  1. {"snapshot":"8f0572e1091e38e15b43080be8e09aa4315a0f15","type":"step-start"}
  2. {"type":"reasoning","text":""}
  3. {"type":"text","text":"This is demo text."}
  4. {"type":"tool","tool":"question","callID":"call_01a0b2d02cd470e28145337ec5d13635","state":{"status":"running"}}
  5. {"reason":"tool-calls","snapshot":"8f0572e1091e38e15b43080be8e09aa4315a0f15","type":"step-finish"}

Actual order (text missing):

  1. {"snapshot":"8f0572e1091e38e15b43080be8e09aa4315a0f15","type":"step-start"}
  2. {"type":"reasoning","text":""}
  3. {"type":"tool","tool":"question","callID":"call_01a0b3076e37574b4a315fa42a639a2","state":{"status":"running"}}
    -> Step 3 should be type:text, but it is missing.

Plugins

No response

OpenCode version

OpenCode Desktop v1.18.31

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. Dante-dan commented on Sep 30, 2026

    @Dante-dan
    Contributor

    I checked the current v2 text/tool publication path. It keeps text and tool fragments separate, and #51105 flushes pending text before the next tool block starts. The existing text-before-tool regression test passes; the containing test file passed all 25 tests. This does not reproduce or establish a fix for the Desktop 1.18.31 report.

    Which provider/model produced this, and where was the “data log” captured (SSE events, stored message parts, or another interface)? If it still happens, could you share a redacted provider response showing the text content alongside the question call, plus the corresponding server events/message parts? The text part is created when the provider emits text-start, so those two sides would distinguish missing provider text from text lost during publication. Please remove credentials and private prompt content.

  2. PrismKitty commented on Oct 7, 2026

    @PrismKitty

    @Dante-dan I'm seeing what looks like the same symptom on v2.0.19 with anthropic/claude-opus-5-5 on the Anthropic provider. My data comes from the stored message parts, and I think it answers your question about which side loses the text.

    The text is missing on the provider side. It isn't lost during publication. In the affected steps the model never emits text, so there is no text-start. Instead it writes the message as one of Anthropic's progress updates between tool calls, which the API returns as a thinking block just before the tool_use. OpenCode stores that block as a reasoning part, which is correct. With no variant selected, OpenCode sends no thinking config, so Anthropic falls back to display: "omitted" and the part comes back empty. That matches the empty reasoning part in the report above.

    You can tell the two kinds of reasoning part apart by their signatures. A progress update's signature decodes to narration, and ordinary reasoning's decodes to thinking. The affected steps have a narration part and no text part.

    I don't have a raw provider response, because it only happens some of the time and I can't trigger it on demand. #52735 describes the same cause and has a workaround for the default variant, plus two proposed fixes.

  3. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions