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

推荐订阅源

Vercel News
Vercel News
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
G
Google Developers Blog
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
P
Proofpoint News Feed
J
Java Code Geeks
U
Unit 42
云风的 BLOG
云风的 BLOG
阮一峰的网络日志
阮一峰的网络日志
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
Docker
V
Visual Studio Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
V
V2EX
T
Tailwind CSS 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
test: tighten transport transform assertions · openclaw/o...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -6,6 +6,28 @@ function makeModel(api: Api, provider: string, id: string): Model<Api> {

66

return { api, provider, id, input: [], output: [] } as unknown as Model<Api>;

77

}

889+

type ToolResultMessage = Extract<Context["messages"][number], { role: "toolResult" }>;

10+11+

function requireToolResultMessage(

12+

message: Context["messages"][number] | undefined,

13+

): ToolResultMessage {

14+

if (!message || message.role !== "toolResult") {

15+

throw new Error(`expected toolResult message, got ${message?.role ?? "missing"}`);

16+

}

17+

return message;

18+

}

19+20+

function toolResultSummaries(messages: Context["messages"]) {

21+

return messages.map((message) => {

22+

const toolResult = requireToolResultMessage(message);

23+

return {

24+

role: toolResult.role,

25+

toolCallId: toolResult.toolCallId,

26+

content: toolResult.content,

27+

};

28+

});

29+

}

30+931

function assistantToolCall(

1032

id: string,

1133

name = "read",

@@ -35,12 +57,10 @@ describe("transformTransportMessages synthetic tool-result policy", () => {

3557

);

36583759

expect(result.map((msg) => msg.role)).toEqual(["assistant", "toolResult", "user"]);

38-

expect(result[1]).toMatchObject({

39-

role: "toolResult",

40-

toolCallId: "call_openai_1",

41-

isError: true,

42-

content: [{ type: "text", text: "aborted" }],

43-

});

60+

const toolResult = requireToolResultMessage(result[1]);

61+

expect(toolResult.toolCallId).toBe("call_openai_1");

62+

expect(toolResult.isError).toBe(true);

63+

expect(toolResult.content).toEqual([{ type: "text", text: "aborted" }]);

4464

});

45654666

it("preserves real OpenAI transport results and aborts missing parallel siblings", () => {

@@ -74,7 +94,7 @@ describe("transformTransportMessages synthetic tool-result policy", () => {

7494

"toolResult",

7595

"user",

7696

]);

77-

expect(result.slice(1, 3)).toMatchObject([

97+

expect(toolResultSummaries(result.slice(1, 3))).toEqual([

7898

{ role: "toolResult", toolCallId: "call_keep", content: [{ type: "text", text: "ok" }] },

7999

{

80100

role: "toolResult",

@@ -115,7 +135,7 @@ describe("transformTransportMessages synthetic tool-result policy", () => {

115135

"toolResult",

116136

"user",

117137

]);

118-

expect(result.slice(1, 3)).toMatchObject([

138+

expect(toolResultSummaries(result.slice(1, 3))).toEqual([

119139

{ role: "toolResult", toolCallId: "call_keep", content: [{ type: "text", text: "late ok" }] },

120140

{

121141

role: "toolResult",

@@ -208,11 +228,9 @@ describe("transformTransportMessages synthetic tool-result policy", () => {

208228

);

209229210230

expect(result.map((msg) => msg.role)).toEqual(["assistant", "toolResult", "user"]);

211-

expect(result[1]).toMatchObject({

212-

role: "toolResult",

213-

toolCallId: "call_anthropic_1",

214-

isError: true,

215-

});

231+

const toolResult = requireToolResultMessage(result[1]);

232+

expect(toolResult.toolCallId).toBe("call_anthropic_1");

233+

expect(toolResult.isError).toBe(true);

216234

});

217235218236

it("still synthesizes missing tool results for transport alias apis that own replay repair", () => {

@@ -232,10 +250,8 @@ describe("transformTransportMessages synthetic tool-result policy", () => {

232250

makeModel("openclaw-google-generative-ai-transport" as Api, "google", "gemini-2.5-pro"),

233251

);

234252

expect(googleAlias.map((msg) => msg.role)).toEqual(["assistant", "toolResult", "user"]);

235-

expect(googleAlias[1]).toMatchObject({

236-

role: "toolResult",

237-

content: [{ type: "text", text: "No result provided" }],

238-

});

253+

const googleToolResult = requireToolResultMessage(googleAlias[1]);

254+

expect(googleToolResult.content).toEqual([{ type: "text", text: "No result provided" }]);

239255240256

const bedrockCanonical = transformTransportMessages(

241257

messages,