Fix:Add KimiExecutor to fix the error of reasoning_content is missing in kimi thing mode - #3132
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces KimiExecutor to handle Kimi-specific request transformations, specifically ensuring reasoning_content is present in tool calls when thinking is active, and registers it under the "kimi-coding-apikey" alias. Feedback highlights a bug in applyKimiRequestDefaults that bypasses general provider defaults, incorrect provider registration and constructor arguments in index.ts, and a violation of the repository style guide due to missing unit tests for the new executor.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| function applyKimiRequestDefaults(body: unknown, defaults?: JsonRecord | null): unknown { | ||
| const record = asRecord(body); | ||
| if (hasActiveKimiThinking(record ?? {}) && hasTools(record ?? {})) { | ||
| // 此处 kimi 开启了 thinking 功能且存在工具调用,确保 tool_calls 中包含 reasoning_content 字段以兼容老版本 Kimi 后端的要求 | ||
| return ensureToolCallReasoningContent(record ?? {}); | ||
| } | ||
|
|
||
| // 其他默认值 | ||
| return applyProviderRequestDefaults(body, defaults); | ||
|
|
||
| } |
There was a problem hiding this comment.
In applyKimiRequestDefaults, if Kimi thinking is active and tools are present, the function immediately returns the result of ensureToolCallReasoningContent and completely bypasses applyProviderRequestDefaults. This means any other configured request defaults (such as temperature or max_tokens) will not be applied.
Furthermore, if thinking is enabled via the defaults rather than the initial request body, hasActiveKimiThinking will evaluate to false before the defaults are applied, missing the opportunity to inject reasoning_content.
To fix this, apply the provider request defaults first, and then perform the Kimi-specific check and transformation on the resulting object.
function applyKimiRequestDefaults(body: unknown, defaults?: JsonRecord | null): unknown {
const withDefaults = applyProviderRequestDefaults(body, defaults);
const record = asRecord(withDefaults);
if (record && hasActiveKimiThinking(record) && hasTools(record)) {
// 此处 kimi 开启了 thinking 功能且存在工具调用,确保 tool_calls 中包含 reasoning_content 字段以兼容老版本 Kimi 后端的要求
return ensureToolCallReasoningContent(record);
}
return withDefaults;
}| v0: new V0VercelWebExecutor(), // Alias | ||
| "kimi-web": new KimiWebExecutor(), | ||
| kimi: new KimiWebExecutor(), // Alias | ||
| "kimi-coding-apikey": new KimiExecutor(), // Alias |
There was a problem hiding this comment.
Currently, "kimi-coding-apikey" is registered using new KimiExecutor(), which defaults the internal provider name to "kimi-coding". This means any provider-specific checks or configurations matching "kimi-coding-apikey" will not be correctly resolved within the executor instance.
Additionally, the "kimi-coding" provider itself is not registered to use KimiExecutor, meaning it will not benefit from the reasoning_content fix when thinking mode is active.
To resolve this, pass the correct provider name to the constructor for both "kimi-coding" and "kimi-coding-apikey", and register both to use KimiExecutor.
| "kimi-coding-apikey": new KimiExecutor(), // Alias | |
| "kimi-coding": new KimiExecutor("kimi-coding"), | |
| "kimi-coding-apikey": new KimiExecutor("kimi-coding-apikey"), |
| export class KimiExecutor extends DefaultExecutor { | ||
| constructor(provider = "kimi-coding") { | ||
| super(provider); | ||
| } |
There was a problem hiding this comment.
According to the Repository Style Guide (Rule 9), tests must always be included when changing or adding production code in open-sse/. Please add unit tests for KimiExecutor under the tests/unit/ directory (per Rule 1) to verify the request transformation and reasoning_content injection logic.
References
- Rule 9: Always include tests when changing production code (src/, open-sse/, electron/, bin/). Rule 1: ALL unit tests, integration tests, ecosystem tests, or Vitest files MUST strictly be placed within the tests/ directory. (link)
…ic-asset build fix - #3131 Kiro Opus 4.8 catalog (thanks @artickc) - #3132 Kimi thinking-mode reasoning_content fix (thanks @bypanghu) - #3130 connectionId fallback + kilo call logging (thanks @androw) - build: standalone static-asset path fix (white login screen after build-output reorg) - contributors hall: +@artickc +@bypanghu +@androw (15 total)
… in kimi thing mode (diegosouzapw#3132) * Fix the error of reasoning_content is missing in kimi thing mode * fix: kimi always use default * fix: add kimi-coding to use KimiExecutor
…uzapw#3131/diegosouzapw#3132) + static-asset build fix - diegosouzapw#3131 Kiro Opus 4.8 catalog (thanks @artickc) - diegosouzapw#3132 Kimi thinking-mode reasoning_content fix (thanks @bypanghu) - diegosouzapw#3130 connectionId fallback + kilo call logging (thanks @androw) - build: standalone static-asset path fix (white login screen after build-output reorg) - contributors hall: +@artickc +@bypanghu +@androw (15 total)
… in kimi thing mode (diegosouzapw#3132) * Fix the error of reasoning_content is missing in kimi thing mode * fix: kimi always use default * fix: add kimi-coding to use KimiExecutor
…uzapw#3131/diegosouzapw#3132) + static-asset build fix - diegosouzapw#3131 Kiro Opus 4.8 catalog (thanks @artickc) - diegosouzapw#3132 Kimi thinking-mode reasoning_content fix (thanks @bypanghu) - diegosouzapw#3130 connectionId fallback + kilo call logging (thanks @androw) - build: standalone static-asset path fix (white login screen after build-output reorg) - contributors hall: +@artickc +@bypanghu +@androw (15 total)
… in kimi thing mode (diegosouzapw#3132) * Fix the error of reasoning_content is missing in kimi thing mode * fix: kimi always use default * fix: add kimi-coding to use KimiExecutor
…uzapw#3131/diegosouzapw#3132) + static-asset build fix - diegosouzapw#3131 Kiro Opus 4.8 catalog (thanks @artickc) - diegosouzapw#3132 Kimi thinking-mode reasoning_content fix (thanks @bypanghu) - diegosouzapw#3130 connectionId fallback + kilo call logging (thanks @androw) - build: standalone static-asset path fix (white login screen after build-output reorg) - contributors hall: +@artickc +@bypanghu +@androw (15 total)
Summary
Related Issues
Validation
npm run lintnpm run test:unitnpm run test:coverage>= 60%for statements, lines, functions, and branchesTests Added Or Updated
Coverage Notes
src/,open-sse/,electron/, orbin/, explain which tests cover the change.Reviewer Notes