Fix Claude Code tool-use follow-up for Kimi /coding Claude upstream#214
Open
cwzsquare wants to merge 2 commits into
Open
Fix Claude Code tool-use follow-up for Kimi /coding Claude upstream#214cwzsquare wants to merge 2 commits into
cwzsquare wants to merge 2 commits into
Conversation
891a3f0 to
6a39193
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue
Fixes #213
变更说明
这个 PR 修复了 Kimi
/coding作为 Claude-compatible 上游时,Claude Code tool use 在第二轮请求中失败的问题。问题发生在工具调用后的历史消息回传阶段:Claude Code 第一轮可以正常收到
tool_use,本地工具也能执行,但第二轮携带tool_result的/v1/messages请求会被 Kimi 拒绝,报错类似:本 PR 对 Claude provider 的历史 assistant tool-use 消息做了兼容处理:
reasoningParamStyle为reasoning/thinking的 Claude 上游自动启用 reasoning passback;thinkingblock;tool_use/server_tool_use但缺少thinkingblock 的历史 assistant 消息,补一个非空thinkingblock;reasoning_content,兼容依赖 OpenAI-style reasoning 字段的上游校验。