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

推荐订阅源

D
Docker
IT之家
IT之家
Microsoft Security Blog
Microsoft Security Blog
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
D
DataBreaches.Net
B
Blog RSS Feed
博客园_首页
The GitHub Blog
The GitHub Blog
I
InfoQ
L
LangChain Blog
G
Google Developers Blog
M
MIT News - Artificial intelligence
美团技术团队
腾讯CDC
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
博客园 - 聂微东
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Apple Machine Learning Research
Apple Machine Learning Research
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
博客园 - 叶小钗

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
test: tighten zai provider assertions · openclaw/openclaw...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -20,37 +20,59 @@ function createGlm47Template() {

2020

};

2121

}

222223+

function expectReplayPolicyFields(

24+

policy: Record<string, unknown> | undefined,

25+

fields: Record<string, unknown>,

26+

): void {

27+

expect(policy).toBeDefined();

28+

for (const [key, value] of Object.entries(fields)) {

29+

expect(policy?.[key]).toEqual(value);

30+

}

31+

}

32+33+

function expectModelFields(

34+

model: Record<string, unknown> | undefined,

35+

fields: Record<string, unknown>,

36+

): void {

37+

expect(model).toBeDefined();

38+

for (const [key, value] of Object.entries(fields)) {

39+

expect(model?.[key]).toEqual(value);

40+

}

41+

}

42+2343

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

2444

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

2545

const provider = await registerSingleProviderPlugin(plugin);

264627-

expect(

47+

expectReplayPolicyFields(

2848

provider.buildReplayPolicy?.({

2949

provider: "zai",

3050

modelApi: "openai-completions",

3151

modelId: "glm-5.1",

32-

} as never),

33-

).toMatchObject({

34-

sanitizeToolCallIds: true,

35-

toolCallIdMode: "strict",

36-

applyAssistantFirstOrderingFix: true,

37-

validateGeminiTurns: true,

38-

validateAnthropicTurns: true,

39-

});

52+

} as never) as Record<string, unknown> | undefined,

53+

{

54+

sanitizeToolCallIds: true,

55+

toolCallIdMode: "strict",

56+

applyAssistantFirstOrderingFix: true,

57+

validateGeminiTurns: true,

58+

validateAnthropicTurns: true,

59+

},

60+

);

406141-

expect(

62+

expectReplayPolicyFields(

4263

provider.buildReplayPolicy?.({

4364

provider: "zai",

4465

modelApi: "openai-responses",

4566

modelId: "glm-5.1",

46-

} as never),

47-

).toMatchObject({

48-

sanitizeToolCallIds: true,

49-

toolCallIdMode: "strict",

50-

applyAssistantFirstOrderingFix: false,

51-

validateGeminiTurns: false,

52-

validateAnthropicTurns: false,

53-

});

67+

} as never) as Record<string, unknown> | undefined,

68+

{

69+

sanitizeToolCallIds: true,

70+

toolCallIdMode: "strict",

71+

applyAssistantFirstOrderingFix: false,

72+

validateGeminiTurns: false,

73+

validateAnthropicTurns: false,

74+

},

75+

);

5476

});

55775678

it("resolves persisted GLM-5 family models with provider-owned metadata", async () => {

@@ -79,15 +101,14 @@ describe("zai provider plugin", () => {

79101

] as const;

8010281103

for (const testCase of cases) {

82-

expect(

83-

provider.resolveDynamicModel?.({

84-

provider: "zai",

85-

modelId: testCase.modelId,

86-

modelRegistry: {

87-

find: (_provider: string, modelId: string) => (modelId === "glm-4.7" ? template : null),

88-

},

89-

} as never),

90-

).toMatchObject({

104+

const resolved = provider.resolveDynamicModel?.({

105+

provider: "zai",

106+

modelId: testCase.modelId,

107+

modelRegistry: {

108+

find: (_provider: string, modelId: string) => (modelId === "glm-4.7" ? template : null),

109+

},

110+

} as never) as Record<string, unknown> | undefined;

111+

expectModelFields(resolved, {

91112

provider: "zai",

92113

api: "openai-completions",

93114

baseUrl: "https://api.z.ai/api/paas/v4",

@@ -129,15 +150,14 @@ describe("zai provider plugin", () => {

129150

const provider = await registerSingleProviderPlugin(plugin);

130151

const template = createGlm47Template();

131152132-

expect(

133-

provider.resolveDynamicModel?.({

134-

provider: "zai",

135-

modelId: "glm-5-turbo",

136-

modelRegistry: {

137-

find: (_provider: string, modelId: string) => (modelId === "glm-4.7" ? template : null),

138-

},

139-

} as never),

140-

).toMatchObject({

153+

const resolved = provider.resolveDynamicModel?.({

154+

provider: "zai",

155+

modelId: "glm-5-turbo",

156+

modelRegistry: {

157+

find: (_provider: string, modelId: string) => (modelId === "glm-4.7" ? template : null),

158+

},

159+

} as never) as Record<string, unknown> | undefined;

160+

expectModelFields(resolved, {

141161

id: "glm-5-turbo",

142162

name: "GLM-5 Turbo",

143163

provider: "zai",

@@ -175,9 +195,7 @@ describe("zai provider plugin", () => {

175195

{},

176196

);

177197178-

expect(capturedPayload).toMatchObject({

179-

tool_stream: true,

180-

});

198+

expect(capturedPayload?.tool_stream).toBe(true);

181199182200

const disabledWrapped = provider.wrapStreamFn?.({

183201

provider: "zai",

@@ -227,10 +245,8 @@ describe("zai provider plugin", () => {

227245

{},

228246

);

229247230-

expect(capturedPayload).toMatchObject({

231-

tool_stream: true,

232-

thinking: { type: "disabled" },

233-

});

248+

expect(capturedPayload?.tool_stream).toBe(true);

249+

expect(capturedPayload?.thinking).toEqual({ type: "disabled" });

234250

});

235251236252

it("enables Z.AI preserved thinking only when requested", async () => {

@@ -261,7 +277,7 @@ describe("zai provider plugin", () => {

261277

{},

262278

);

263279264-

expect(capturedPayload).toMatchObject({ tool_stream: true });

280+

expect(capturedPayload?.tool_stream).toBe(true);

265281

expect(capturedPayload).not.toHaveProperty("thinking");

266282267283

const wrappedWithPreserve = provider.wrapStreamFn?.({

@@ -282,10 +298,8 @@ describe("zai provider plugin", () => {

282298

{},

283299

);

284300285-

expect(capturedPayload).toMatchObject({

286-

tool_stream: true,

287-

thinking: { type: "enabled", clear_thinking: false },

288-

});

301+

expect(capturedPayload?.tool_stream).toBe(true);

302+

expect(capturedPayload?.thinking).toEqual({ type: "enabled", clear_thinking: false });

289303

});

290304291305

it("preserves replayed reasoning_content for Z.AI preserved thinking", async () => {

@@ -352,14 +366,11 @@ describe("zai provider plugin", () => {

352366353367

void wrapped?.(model, context, {});

354368355-

expect(capturedPayload).toMatchObject({

356-

thinking: { type: "enabled", clear_thinking: false },

357-

});

358-

expect((capturedPayload?.messages as Array<Record<string, unknown>>)[1]).toMatchObject({

359-

role: "assistant",

360-

content: "visible reply",

361-

reasoning_content: "prior reasoning",

362-

});

369+

expect(capturedPayload?.thinking).toEqual({ type: "enabled", clear_thinking: false });

370+

const assistantMessage = (capturedPayload?.messages as Array<Record<string, unknown>>)[1];

371+

expect(assistantMessage?.role).toBe("assistant");

372+

expect(assistantMessage?.content).toBe("visible reply");

373+

expect(assistantMessage?.reasoning_content).toBe("prior reasoning");

363374

});

364375365376

it("defaults tool_stream extra params but preserves explicit values", async () => {