Skip to content

fix: normalize Kimi anthropic tool payloads#59440

Merged
obviyus merged 2 commits into
mainfrom
fix/kimi-tool-payload
Apr 2, 2026
Merged

fix: normalize Kimi anthropic tool payloads#59440
obviyus merged 2 commits into
mainfrom
fix/kimi-tool-payload

Conversation

@obviyus

@obviyus obviyus commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • mark Kimi and Kimi Coding as OpenAI-function-style Anthropic tool payload providers
  • align the bundled plugin capability metadata with the fallback capability registry
  • add regression coverage for Kimi payload normalization on the Anthropic Messages path

Fixes #59327
Fixes #54442
Fixes #58817
Fixes #53747
Fixes #56916

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling extensions: kimi-coding size: S maintainer Maintainer-authored PR labels Apr 2, 2026
@obviyus obviyus self-assigned this Apr 2, 2026
@greptile-apps

greptile-apps Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes Kimi and Kimi Coding being incorrectly treated as native Anthropic tool-payload providers. It adds anthropicToolSchemaMode: "openai-functions" and anthropicToolChoiceMode: "openai-string-modes" to both the fallback capability registry (PLUGIN_CAPABILITIES_FALLBACKS["kimi"]) and the kimi-coding bundled plugin, ensuring the two code paths stay aligned. Tests are updated to assert the new (correct) behaviour and a regression test is added for the kimi-coding alias.

Confidence Score: 5/5

  • Safe to merge — the fix is narrow, well-tested, and the plugin/fallback paths are now aligned.
  • All findings are P2 or lower. The capability change is covered by both updated unit tests and new regression tests, and the normalization logic is consistent across the fallback registry and the bundled plugin.
  • No files require special attention.

Reviews (1): Last reviewed commit: "fix: normalize kimi anthropic tool paylo..." | Re-trigger Greptile

@obviyus

obviyus commented Apr 2, 2026

Copy link
Copy Markdown
Contributor Author

Manual check: validated against a live Kimi Coding plan account.

Ran a small openclaw agent --local compare with kimi-coding/k2p5 on both main and this branch. This branch preserved the tool-call args (functions.exec:0 {"command":"pwd"}), which matches the regression covered in this PR.

@obviyus
obviyus force-pushed the fix/kimi-tool-payload branch from 625b38c to e4839d5 Compare April 2, 2026 07:18
@obviyus
obviyus force-pushed the fix/kimi-tool-payload branch from e4839d5 to f7e4317 Compare April 2, 2026 08:09
@obviyus
obviyus merged commit b441cd2 into main Apr 2, 2026
24 checks passed
@obviyus
obviyus deleted the fix/kimi-tool-payload branch April 2, 2026 08:09
@obviyus

obviyus commented Apr 2, 2026

Copy link
Copy Markdown
Contributor Author

Landed on main.

@yuanaichi

Copy link
Copy Markdown
Contributor

My PR #54491 fixed an issue where Kimi tool calls could return empty parameters, and it was merged into main in release v2026.3.31 . After upgrading OpenClaw to v2026.4.2 , I’m hitting a new issue: Kimi no longer works correctly — tool calling doesn’t execute, and the agent replies with the tool call content directly instead of actually running the tool.

<|tool_calls_section_begin|>
<|tool_call_begin|> read:43
<|tool_call_argument_begin|> {"path": "..."}
<|tool_call_end|>
<|tool_calls_section_end|>

@dorbodwolf

dorbodwolf commented Apr 3, 2026

Copy link
Copy Markdown

My PR #54491 fixed an issue where Kimi tool calls could return empty parameters, and it was merged into main in release v2026.3.31 . After upgrading OpenClaw to v2026.4.2 , I’m hitting a new issue: Kimi no longer works correctly — tool calling doesn’t execute, and the agent replies with the tool call content directly instead of actually running the tool.

<|tool_calls_section_begin|>
<|tool_call_begin|> read:43
<|tool_call_argument_begin|> {"path": "..."}
<|tool_call_end|>
<|tool_calls_section_end|>

the same issue with v2026.4.2 and kimi/kimi-coding api

@obviyus

obviyus commented Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

@yuanaichi @dorbodwolf I have a follow-up PR up for this fix in #60051

ngutman pushed a commit that referenced this pull request Apr 3, 2026
* fix: normalize kimi anthropic tool payloads

* fix: normalize kimi anthropic tool payloads (#59440)
@obviyus obviyus mentioned this pull request Apr 4, 2026
steipete pushed a commit to duncanita/openclaw that referenced this pull request Apr 4, 2026
* fix: normalize kimi anthropic tool payloads

* fix: normalize kimi anthropic tool payloads (openclaw#59440)
@chengoak

chengoak commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

Can confirm that v2026.3.13 works fine for Kimi Coding tool calling, while 2026.3.7+ and 2026.4.2 still have the regression where tool calls are printed as text instead of being executed.

It would be great if this fix could also address the response parsing side, since the current half-fix in 2026.4.2 doesn't fully resolve the issue.

@obviyus

obviyus commented Apr 5, 2026

Copy link
Copy Markdown
Contributor Author

This was fixed on main in follow-up Kimi patches after v2026.4.2, including the response-side parsing path that was still missing when this PR landed.

So the regression reported here is not still open on main; it just has not shipped in a release yet. It will be included in the next release.

@chengoak

chengoak commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

Thanks for the quick fix and the clarification! Looking forward to the next release. 🦞

lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
* fix: normalize kimi anthropic tool payloads

* fix: normalize kimi anthropic tool payloads (openclaw#59440)
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* fix: normalize kimi anthropic tool payloads

* fix: normalize kimi anthropic tool payloads (openclaw#59440)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
* fix: normalize kimi anthropic tool payloads

* fix: normalize kimi anthropic tool payloads (openclaw#59440)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* fix: normalize kimi anthropic tool payloads

* fix: normalize kimi anthropic tool payloads (openclaw#59440)
Nachx639 pushed a commit to Nachx639/clawdbot that referenced this pull request Jun 17, 2026
* fix: normalize kimi anthropic tool payloads

* fix: normalize kimi anthropic tool payloads (openclaw#59440)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment