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

推荐订阅源

人人都是产品经理
人人都是产品经理
MongoDB | Blog
MongoDB | Blog
Google DeepMind News
Google DeepMind News
L
LangChain Blog
J
Java Code Geeks
MyScale Blog
MyScale Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
WordPress大学
WordPress大学
小众软件
小众软件
Microsoft Security Blog
Microsoft Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
aimingoo的专栏
aimingoo的专栏
F
Fortinet All Blogs
I
InfoQ
博客园 - 聂微东
量子位
A
About on SuperTechFans
S
SegmentFault 最新的问题
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Apple Machine Learning Research
Apple Machine Learning Research
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
H
Help Net Security

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(moonshot): preserve native Kimi tool_call IDs in open...
LeoDu0314 · 2026-04-23 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -29,6 +29,7 @@ Docs: https://docs.openclaw.ai

2929
3030

### Fixes

3131
32+

- Providers/Moonshot: stop strict-sanitizing Kimi's native tool_call IDs (shaped like `functions.<name>:<index>`) on the OpenAI-compatible transport, so multi-turn agentic flows through Kimi K2.6 no longer break after 2-3 tool-calling rounds when the serving layer fails to match mangled IDs against the original tool definitions. Adds a `sanitizeToolCallIds` opt-out to the shared `openai-compatible` replay family helper and wires Moonshot to it. Fixes #62319. (#70030) Thanks @LeoDu0314.

3233

- Codex harness: ignore dynamic tool descriptions when deciding whether to reuse a native app-server thread while still fingerprinting tool schemas, so channel-specific copy changes no longer reset otherwise compatible Codex conversations. (#69976) Thanks @chen-zhang-cs-code.

3334

- Codex harness: drop invalid legacy app-server `serviceTier` values such as `"priority"` before native thread and turn requests, while keeping supported Codex tiers limited to `"fast"` and `"flex"`. Fixes #64815.

3435

- Codex harness: show bounded, sanitized permission target samples in app-server approval prompts, so native permission requests keep their specific hosts, roots, and paths visible without leaking home usernames or URL credentials. (#70340) Thanks @Lucenx9.

Original file line numberDiff line numberDiff line change

@@ -5,22 +5,22 @@ import { createCapturedThinkingConfigStream } from "../../test/helpers/plugins/s

55

import plugin from "./index.js";

66
77

describe("moonshot provider plugin", () => {

8-

it("owns replay policy for OpenAI-compatible Moonshot transports", async () => {

8+

it("owns replay policy for OpenAI-compatible Moonshot transports without mangling native Kimi tool_call IDs", async () => {

99

const provider = await registerSingleProviderPlugin(plugin);

1010
11-

expect(

12-

provider.buildReplayPolicy?.({

13-

provider: "moonshot",

14-

modelApi: "openai-completions",

15-

modelId: "kimi-k2.6",

16-

} as never),

17-

).toMatchObject({

18-

sanitizeToolCallIds: true,

19-

toolCallIdMode: "strict",

11+

const policy = provider.buildReplayPolicy?.({

12+

provider: "moonshot",

13+

modelApi: "openai-completions",

14+

modelId: "kimi-k2.6",

15+

} as never);

16+
17+

expect(policy).toMatchObject({

2018

applyAssistantFirstOrderingFix: true,

2119

validateGeminiTurns: true,

2220

validateAnthropicTurns: true,

2321

});

22+

expect(policy).not.toHaveProperty("sanitizeToolCallIds");

23+

expect(policy).not.toHaveProperty("toolCallIdMode");

2424

});

2525
2626

it("wires moonshot-thinking stream hooks", async () => {

Original file line numberDiff line numberDiff line change

@@ -1,5 +1,5 @@

11

import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";

2-

import { OPENAI_COMPATIBLE_REPLAY_HOOKS } from "openclaw/plugin-sdk/provider-model-shared";

2+

import { buildProviderReplayFamilyHooks } from "openclaw/plugin-sdk/provider-model-shared";

33

import { MOONSHOT_THINKING_STREAM_HOOKS } from "openclaw/plugin-sdk/provider-stream-family";

44

import { applyMoonshotNativeStreamingUsageCompat } from "./api.js";

55

import { moonshotMediaUnderstandingProvider } from "./media-understanding-provider.js";

@@ -57,7 +57,13 @@ export default defineSingleProviderPluginEntry({

5757

},

5858

applyNativeStreamingUsageCompat: ({ providerConfig }) =>

5959

applyMoonshotNativeStreamingUsageCompat(providerConfig),

60-

...OPENAI_COMPATIBLE_REPLAY_HOOKS,

60+

// Kimi K2+ returns native tool_call IDs shaped like `functions.<name>:<index>`.

61+

// Sanitizing them to alphanumeric-only breaks Kimi's serving-layer matching in

62+

// multi-turn replay. See openclaw/openclaw#62319.

63+

...buildProviderReplayFamilyHooks({

64+

family: "openai-compatible",

65+

sanitizeToolCallIds: false,

66+

}),

6167

...MOONSHOT_THINKING_STREAM_HOOKS,

6268

resolveThinkingProfile: () => ({

6369

levels: [

Original file line numberDiff line numberDiff line change

@@ -191,6 +191,23 @@ describe("buildProviderReplayFamilyHooks", () => {

191191

validateGeminiTurns: true,

192192

});

193193
194+

const nativeIdsHooks = buildProviderReplayFamilyHooks({

195+

family: "openai-compatible",

196+

sanitizeToolCallIds: false,

197+

});

198+

const nativeIdsPolicy = nativeIdsHooks.buildReplayPolicy?.({

199+

provider: "moonshot",

200+

modelApi: "openai-completions",

201+

modelId: "kimi-k2.6",

202+

} as never);

203+

expect(nativeIdsPolicy).toMatchObject({

204+

applyAssistantFirstOrderingFix: true,

205+

validateGeminiTurns: true,

206+

validateAnthropicTurns: true,

207+

});

208+

expect(nativeIdsPolicy).not.toHaveProperty("sanitizeToolCallIds");

209+

expect(nativeIdsPolicy).not.toHaveProperty("toolCallIdMode");

210+
194211

expect(

195212

PASSTHROUGH_GEMINI_REPLAY_HOOKS.buildReplayPolicy?.({

196213

provider: "openrouter",

Original file line numberDiff line numberDiff line change

@@ -118,7 +118,7 @@ type ProviderReplayFamilyHooks = Pick<

118118

>;

119119
120120

type BuildProviderReplayFamilyHooksOptions =

121-

| { family: "openai-compatible" }

121+

| { family: "openai-compatible"; sanitizeToolCallIds?: boolean }

122122

| { family: "anthropic-by-model" }

123123

| { family: "native-anthropic-by-model" }

124124

| { family: "google-gemini" }

@@ -132,11 +132,13 @@ export function buildProviderReplayFamilyHooks(

132132

options: BuildProviderReplayFamilyHooksOptions,

133133

): ProviderReplayFamilyHooks {

134134

switch (options.family) {

135-

case "openai-compatible":

135+

case "openai-compatible": {

136+

const policyOptions = { sanitizeToolCallIds: options.sanitizeToolCallIds };

136137

return {

137138

buildReplayPolicy: (ctx: ProviderReplayPolicyContext) =>

138-

buildOpenAICompatibleReplayPolicy(ctx.modelApi),

139+

buildOpenAICompatibleReplayPolicy(ctx.modelApi, policyOptions),

139140

};

141+

}

140142

case "anthropic-by-model":

141143

return {

142144

buildReplayPolicy: ({ modelId }: ProviderReplayPolicyContext) =>

Original file line numberDiff line numberDiff line change

@@ -22,6 +22,32 @@ describe("provider replay helpers", () => {

2222

});

2323

});

2424
25+

it("omits tool-call id sanitization when opted out for openai-completions", () => {

26+

const policy = buildOpenAICompatibleReplayPolicy("openai-completions", {

27+

sanitizeToolCallIds: false,

28+

});

29+

expect(policy).toMatchObject({

30+

applyAssistantFirstOrderingFix: true,

31+

validateGeminiTurns: true,

32+

validateAnthropicTurns: true,

33+

});

34+

expect(policy).not.toHaveProperty("sanitizeToolCallIds");

35+

expect(policy).not.toHaveProperty("toolCallIdMode");

36+

});

37+
38+

it("omits tool-call id sanitization when opted out for openai-responses", () => {

39+

const policy = buildOpenAICompatibleReplayPolicy("openai-responses", {

40+

sanitizeToolCallIds: false,

41+

});

42+

expect(policy).toMatchObject({

43+

applyAssistantFirstOrderingFix: false,

44+

validateGeminiTurns: false,

45+

validateAnthropicTurns: false,

46+

});

47+

expect(policy).not.toHaveProperty("sanitizeToolCallIds");

48+

expect(policy).not.toHaveProperty("toolCallIdMode");

49+

});

50+
2551

it("builds strict anthropic replay policy", () => {

2652

expect(buildStrictAnthropicReplayPolicy({ dropThinkingBlocks: true })).toMatchObject({

2753

sanitizeMode: "full",

Original file line numberDiff line numberDiff line change

@@ -11,6 +11,7 @@ import type {

1111
1212

export function buildOpenAICompatibleReplayPolicy(

1313

modelApi: string | null | undefined,

14+

options: { sanitizeToolCallIds?: boolean } = {},

1415

): ProviderReplayPolicy | undefined {

1516

if (

1617

modelApi !== "openai-completions" &&

@@ -21,9 +22,12 @@ export function buildOpenAICompatibleReplayPolicy(

2122

return undefined;

2223

}

2324
25+

const sanitizeToolCallIds = options.sanitizeToolCallIds ?? true;

26+
2427

return {

25-

sanitizeToolCallIds: true,

26-

toolCallIdMode: "strict",

28+

...(sanitizeToolCallIds

29+

? { sanitizeToolCallIds: true, toolCallIdMode: "strict" as const }

30+

: {}),

2731

...(modelApi === "openai-completions"

2832

? {

2933

applyAssistantFirstOrderingFix: true,