Skip to content

fix: assistant tool-call messages missing reasoning_content with interleaved models (Kimi K2.6) #23833

Closed

Description

@fkyah3

Problem

When using interleaved reasoning models like Kimi K2.6, assistant messages containing parts but no parts fail API validation during long-context replay. The model API expects on all assistant tool-call messages, even if empty.

Error:

Context

in only injects empty for assistant messages after the last user turn (). Historical assistant messages with tool calls that appear before the last user message do not get the field.

AI SDK PR #12049 added reasoning extraction from message content, but OpenCode filters reasoning parts out of content before AI SDK sees them, so the SDK never has a chance to add for these messages.

Solution (in our fork)

Also force when the assistant message contains parts:

Commit with full analysis: https://github.com/fkyah3/opencode-fkyah3/commit/d14da0b74

This likely affects any OpenAI-compatible provider using reasoning (not just Kimi K2.6).

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 22, 2026
  2. github-actions commented on Apr 22, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • No issue template was used. Please resubmit using one of the three required templates: Bug Report, Feature Request, or Question. Bug reports require a Description field with reproduction context; the title should not start with fix:.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    If you believe this was flagged incorrectly, please let a maintainer know.

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

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)needs:complianceThis means the issue will auto-close after 2 hours.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions