惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
G
Google Developers Blog
有赞技术团队
有赞技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Blog — PlanetScale
Blog — PlanetScale
罗磊的独立博客
博客园 - 聂微东
V
Visual Studio Blog
博客园_首页
D
DataBreaches.Net
腾讯CDC
I
InfoQ
F
Fortinet All Blogs
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
云风的 BLOG
云风的 BLOG
月光博客
月光博客
Recent Announcements
Recent Announcements
MongoDB | Blog
MongoDB | Blog
C
Check Point Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: default kimi thinking to off (#68907) · openclaw/ope...
frankekn · 2026-04-19 · via Recent Commits to openclaw:main

@@ -1,7 +1,12 @@

11

import type { StreamFn } from "@mariozechner/pi-agent-core";

22

import type { Context, Model } from "@mariozechner/pi-ai";

33

import { describe, expect, it } from "vitest";

4-

import { createKimiToolCallMarkupWrapper, wrapKimiProviderStream } from "./stream.js";

4+

import {

5+

createKimiThinkingWrapper,

6+

createKimiToolCallMarkupWrapper,

7+

resolveKimiThinkingType,

8+

wrapKimiProviderStream,

9+

} from "./stream.js";

510611

type FakeStream = {

712

result: () => Promise<unknown>;

@@ -29,6 +34,19 @@ const KIMI_MULTI_TOOL_TEXT =

2934

' <|tool_calls_section_begin|> <|tool_call_begin|> functions.read:0 <|tool_call_argument_begin|> {"file_path":"./package.json"} <|tool_call_end|> <|tool_call_begin|> functions.write:1 <|tool_call_argument_begin|> {"file_path":"./out.txt","content":"done"} <|tool_call_end|> <|tool_calls_section_end|>';

30353136

describe("kimi tool-call markup wrapper", () => {

37+

it("defaults Kimi thinking to disabled unless explicitly enabled", () => {

38+

expect(resolveKimiThinkingType({ configuredThinking: undefined })).toBe("disabled");

39+

expect(resolveKimiThinkingType({ configuredThinking: undefined, thinkingLevel: "high" })).toBe(

40+

"enabled",

41+

);

42+

expect(resolveKimiThinkingType({ configuredThinking: "off", thinkingLevel: "high" })).toBe(

43+

"disabled",

44+

);

45+

expect(resolveKimiThinkingType({ configuredThinking: "enabled", thinkingLevel: "off" })).toBe(

46+

"enabled",

47+

);

48+

});

49+3250

it("converts tagged Kimi tool-call text into structured tool calls", async () => {

3351

const partial = {

3452

role: "assistant",

@@ -243,4 +261,105 @@ describe("kimi tool-call markup wrapper", () => {

243261

stopReason: "toolUse",

244262

});

245263

});

264+265+

it("forces Kimi thinking disabled and strips proxy reasoning fields", () => {

266+

let capturedPayload: Record<string, unknown> | undefined;

267+

const baseStreamFn: StreamFn = (model, _context, options) => {

268+

const payload: Record<string, unknown> = {

269+

reasoning: { effort: "high" },

270+

reasoning_effort: "high",

271+

reasoningEffort: "high",

272+

};

273+

options?.onPayload?.(payload as never, model as never);

274+

capturedPayload = payload;

275+

return createFakeStream({

276+

events: [],

277+

resultMessage: { role: "assistant", content: [] },

278+

}) as never;

279+

};

280+281+

const wrapped = createKimiThinkingWrapper(baseStreamFn, "disabled");

282+

void wrapped(

283+

{

284+

api: "anthropic-messages",

285+

provider: "kimi",

286+

id: "kimi-code",

287+

} as Model<"anthropic-messages">,

288+

{ messages: [] } as Context,

289+

{},

290+

);

291+292+

expect(capturedPayload).toEqual({

293+

thinking: { type: "disabled" },

294+

});

295+

});

296+297+

it("lets explicit model params keep Kimi thinking disabled even when session thinking is on", () => {

298+

let capturedPayload: Record<string, unknown> | undefined;

299+

const baseStreamFn: StreamFn = (model, _context, options) => {

300+

const payload: Record<string, unknown> = {};

301+

options?.onPayload?.(payload as never, model as never);

302+

capturedPayload = payload;

303+

return createFakeStream({

304+

events: [],

305+

resultMessage: { role: "assistant", content: [] },

306+

}) as never;

307+

};

308+309+

const wrapped = wrapKimiProviderStream({

310+

provider: "kimi",

311+

modelId: "kimi-code",

312+

extraParams: { thinking: "off" },

313+

thinkingLevel: "high",

314+

streamFn: baseStreamFn,

315+

} as never);

316+317+

void wrapped(

318+

{

319+

api: "anthropic-messages",

320+

provider: "kimi",

321+

id: "kimi-code",

322+

} as Model<"anthropic-messages">,

323+

{ messages: [] } as Context,

324+

{},

325+

);

326+327+

expect(capturedPayload).toEqual({

328+

thinking: { type: "disabled" },

329+

});

330+

});

331+332+

it("enables Kimi thinking only when explicitly requested", () => {

333+

let capturedPayload: Record<string, unknown> | undefined;

334+

const baseStreamFn: StreamFn = (model, _context, options) => {

335+

const payload: Record<string, unknown> = {};

336+

options?.onPayload?.(payload as never, model as never);

337+

capturedPayload = payload;

338+

return createFakeStream({

339+

events: [],

340+

resultMessage: { role: "assistant", content: [] },

341+

}) as never;

342+

};

343+344+

const wrapped = wrapKimiProviderStream({

345+

provider: "kimi",

346+

modelId: "kimi-code",

347+

thinkingLevel: "high",

348+

streamFn: baseStreamFn,

349+

} as never);

350+351+

void wrapped(

352+

{

353+

api: "anthropic-messages",

354+

provider: "kimi",

355+

id: "kimi-code",

356+

} as Model<"anthropic-messages">,

357+

{ messages: [] } as Context,

358+

{},

359+

);

360+361+

expect(capturedPayload).toEqual({

362+

thinking: { type: "enabled" },

363+

});

364+

});

246365

});