Skip to content

Kimi thinking mode fails on tool-call messages: reasoning_content missing in assistant message #82161

@mm19830609-sudo

Description

@mm19830609-sudo

Bug Summary

When thinkingDefault is enabled (medium/high/etc.), OpenClaw 2026.5.12 fails with Kimi (kimi-for-coding via openai-completions API) on multi-turn sessions that contain tool calls. The error is:

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

This is a different issue from #47452 (which was fixed in 5.12). #47452 fixed the case where Kimi rejected thinking content blocks in replay history. Now the opposite problem occurs: when thinking is enabled, Kimi requires reasoning_content on assistant tool-call messages, but OpenClaw does not populate it.


Environment

Item Value
OpenClaw Version 2026.5.12 (f066dd2)
Model kimi-for-coding
Provider kimi
API Type openai-completions
Model Config reasoning: true
thinkingDefault medium

Model configuration excerpt

{
  "models": {
    "providers": {
      "kimi": {
        "baseUrl": "https://api.kimi.com/coding/v1",
        "api": "openai-completions",
        "models": [
          {
            "id": "kimi-for-coding",
            "reasoning": true,
            ...
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "thinkingDefault": "medium"
    }
  }
}

Reproduction Steps

  1. Configure OpenClaw with Kimi model and thinkingDefault: "medium"
  2. Start a conversation that triggers tool calls (e.g., active-memory, file operations)
  3. On the second or later turn, when replay history includes assistant tool-call messages, Kimi API returns 400

Error Log

{
  "event": "embedded_run_agent_end",
  "error": "LLM request failed: provider rejected the request schema or tool payload.",
  "rawErrorPreview": "400 thinking is enabled but reasoning_content is missing in assistant tool call message at index 69",
  "providerRuntimeFailureKind": "schema",
  "model": "kimi-for-coding",
  "provider": "kimi"
}

Full stack trace from ~/.openclaw/logs/:

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

Expected Behavior

When thinkingDefault is enabled for Kimi models, OpenClaw should ensure that assistant messages containing tool calls also include a reasoning_content field (even if empty "") so that Kimi API accepts the replayed history.

Actual Behavior

OpenClaw sends assistant tool-call messages without reasoning_content, causing Kimi to reject the entire request with HTTP 400.


Additional Context

Suggested Fix

In the message serialization path for Kimi (Moonshot) provider, when thinking is enabled, ensure that all assistant messages in the replay history — including those with tool_calls — have reasoning_content set (defaulting to "" if no reasoning text is available).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions