Skip to content

Isolated session tools schema serialization fails with kimi-coding provider #38669

@Jasonggg15

Description

@Jasonggg15

Bug Report: Isolated session tools schema serialization fails with kimi-coding provider

Summary

When using kimi-coding/k2p5 provider with anthropic-messages API type, isolated sessions (e.g., cron jobs with sessionTarget: "isolated") fail to execute tools due to schema serialization error. Main/direct sessions work correctly.

Environment

  • OpenClaw version: 2026.3.2
  • Provider: kimi-coding
  • API type: anthropic-messages
  • Model: k2p5

Configuration

{
  "models": {
    "providers": {
      "kimi-coding": {
        "baseUrl": "https://api.kimi.com/coding/",
        "api": "anthropic-messages",
        "models": [{
          "id": "k2p5",
          "name": "Kimi for Coding",
          "contextWindow": 262144,
          "maxTokens": 32768
        }]
      }
    }
  }
}

Steps to Reproduce

  1. Configure kimi-coding provider with anthropic-messages API type
  2. Create a cron job with sessionTarget: "isolated"
  3. Cron task attempts to use tools (e.g., web_search, web_fetch, read)
  4. Error occurs immediately on first tool call

Expected Behavior

Isolated session should serialize tools schema correctly for Kimi's anthropic-messages API, just like main sessions do.

Actual Behavior

[Error: request could not be processed] 
{"error":{"message":"23 validation errors:
  {'type': 'missing', 'loc': ('body', 'tools', 0, 'function'), 'msg': 'Field required', 'input': {'name': 'read', 'description': '...', 'input_schema': {...}}}"
}}

Key Observations

  1. Main/direct sessions work fine - The same configuration works correctly for interactive chat
  2. Only isolated sessions fail - Cron jobs with sessionTarget: "isolated" consistently fail
  3. Tools schema format issue - Error suggests OpenClaw is sending:
    {"name": "read", "description": "...", "input_schema": {...}}
    But Kimi's anthropic-messages endpoint expects:
    {"type": "function", "function": {"name": "read", "description": "...", "parameters": {...}}}

Workaround

Change cron job to use sessionTarget: "main" instead of "isolated", though this risks polluting the main session context.

Related Issues

Possible Root Cause

The tool schema serialization logic for isolated sessions may be using a different code path than main sessions, or may not be properly handling the anthropic-messages API format for Kimi.


Labels: bug, provider/kimi-coding, session/isolated, tools

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