Skip to content

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

Closed

Description

@fkyah3

Description

When using Kimi K2.6 (or other interleaved models via @ai-sdk/openai-compatible), long conversations with tool calls fail on history replay with:

thinking is enabled but reasoning_content is missing in assistant tool call message at index X

Root cause

normalizeMessages() only adds empty reasoning_content for assistant messages after the last user turn. Historical assistant messages containing tool calls (but no reasoning text) skip this step, causing the API to reject the request.

Fix approach

Also force reasoning_content when the assistant message contains tool-call parts, even if reasoning text is empty.

Reference implementation: https://github.com/fkyah3/opencode-fkyah3/commit/d14da0b74

Steps to reproduce

  1. Use Kimi K2.6 in a session
  2. Have the model make tool calls over multiple turns
  3. Accumulate 80+ messages
  4. Close and reopen the session, then send a new message
  5. Error appears during history replay

Activity

  1. github-actions commented on Apr 22, 2026

    @github-actions
    Contributor

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

    All of the above describe the same underlying issue: historical assistant messages containing tool calls but no reasoning parts failing validation with thinking is enabled but reasoning_content is missing in assistant tool call message at index X. Please coordinate with those issues rather than filing a new one.

  2. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 22, 2026
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)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions