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

推荐订阅源

C
Check Point Blog
GbyAI
GbyAI
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
U
Unit 42
Engineering at Meta
Engineering at Meta
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
Vercel News
Vercel News
美团技术团队
雷峰网
雷峰网
Recent Announcements
Recent Announcements
有赞技术团队
有赞技术团队
D
DataBreaches.Net
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
罗磊的独立博客
MyScale Blog
MyScale Blog
博客园_首页
IT之家
IT之家
F
Fortinet All Blogs
博客园 - Franky

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 command delivery assertions · openclaw/open...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -30,6 +30,13 @@ vi.mock("../../auto-reply/reply/reply-media-paths.runtime.js", () => ({

3030

type NormalizeParams = Parameters<typeof normalizeAgentCommandReplyPayloads>[0];

3131

type RunResult = NormalizeParams["result"];

3232

type DeliverParams = Parameters<typeof deliverAgentCommandResult>[0];

33+

type TextPayloadLike = { text?: unknown };

34+

type MediaNormalizerOptions = {

35+

sessionKey?: unknown;

36+

agentId?: unknown;

37+

workspaceDir?: unknown;

38+

messageProvider?: unknown;

39+

};

33403441

const slackOutboundForTest: ChannelOutboundAdapter = {

3542

deliveryMode: "direct",

@@ -66,6 +73,38 @@ function createResult(overrides: Partial<RunResult> = {}): RunResult {

6673

} as RunResult;

6774

}

687576+

function expectTextPayload(payload: TextPayloadLike | undefined, text: string): void {

77+

expect(payload?.text).toBe(text);

78+

}

79+80+

function requirePayload(payloads: readonly ReplyPayload[], index: number): ReplyPayload {

81+

const payload = payloads.at(index);

82+

if (!payload) {

83+

throw new Error(`expected payload at index ${index}`);

84+

}

85+

return payload;

86+

}

87+88+

function latestNormalizerOptions(): MediaNormalizerOptions {

89+

const options = createReplyMediaPathNormalizerMock.mock.calls.at(-1)?.[0];

90+

if (!options || typeof options !== "object") {

91+

throw new Error("expected media normalizer options");

92+

}

93+

return options as MediaNormalizerOptions;

94+

}

95+96+

function latestOutboundDeliveryArgs(): {

97+

payloads: ReplyPayload[];

98+

bestEffort?: boolean;

99+

queuePolicy?: string;

100+

} {

101+

const args = deliverOutboundPayloadsMock.mock.calls.at(-1)?.[0];

102+

if (!args || typeof args !== "object") {

103+

throw new Error("expected outbound delivery arguments");

104+

}

105+

return args as { payloads: ReplyPayload[]; bestEffort?: boolean; queuePolicy?: string };

106+

}

107+69108

async function deliverMediaReplyForTest(outboundSession: DeliverParams["outboundSession"]) {

70109

const runtime = { log: vi.fn(), error: vi.fn() };

71110

return await deliverAgentCommandResult({

@@ -114,11 +153,8 @@ describe("normalizeAgentCommandReplyPayloads", () => {

114153

result: createResult(),

115154

});

116155117-

expect(normalized).toMatchObject([

118-

{

119-

text: "Choose [[slack_buttons: Retry:retry]]",

120-

},

121-

]);

156+

expect(normalized).toHaveLength(1);

157+

expectTextPayload(normalized[0], "Choose [[slack_buttons: Retry:retry]]");

122158

});

123159124160

it("renders response prefix templates with the selected runtime model", () => {

@@ -144,11 +180,8 @@ describe("normalizeAgentCommandReplyPayloads", () => {

144180

}),

145181

});

146182147-

expect(normalized).toMatchObject([

148-

{

149-

text: "[openai-codex/gpt-5.4] Ready.",

150-

},

151-

]);

183+

expect(normalized).toHaveLength(1);

184+

expectTextPayload(normalized[0], "[openai-codex/gpt-5.4] Ready.");

152185

});

153186154187

it("keeps Slack options text intact for local preview when delivery is disabled", async () => {

@@ -178,7 +211,8 @@ describe("normalizeAgentCommandReplyPayloads", () => {

178211179212

expect(runtime.log).toHaveBeenCalledTimes(1);

180213

expect(runtime.log).toHaveBeenCalledWith("Options: on, off.");

181-

expect(delivered.payloads).toMatchObject([{ text: "Options: on, off." }]);

214+

expect(delivered.payloads).toHaveLength(1);

215+

expectTextPayload(delivered.payloads[0], "Options: on, off.");

182216

});

183217184218

it("normalizes reply-media paths before outbound delivery", async () => {

@@ -197,23 +231,19 @@ describe("normalizeAgentCommandReplyPayloads", () => {

197231

agentId: "tester",

198232

} as never);

199233200-

expect(createReplyMediaPathNormalizerMock).toHaveBeenCalledWith(

201-

expect.objectContaining({

202-

sessionKey: "agent:tester:slack:direct:alice",

203-

agentId: "tester",

204-

workspaceDir: "/tmp/agent-workspace",

205-

messageProvider: "slack",

206-

}),

207-

);

208-

expect(normalizerFn).toHaveBeenCalledWith(

209-

expect.objectContaining({ mediaUrls: ["./out/photo.png"] }),

210-

);

234+

const normalizerOptions = latestNormalizerOptions();

235+

expect(normalizerOptions.sessionKey).toBe("agent:tester:slack:direct:alice");

236+

expect(normalizerOptions.agentId).toBe("tester");

237+

expect(normalizerOptions.workspaceDir).toBe("/tmp/agent-workspace");

238+

expect(normalizerOptions.messageProvider).toBe("slack");

239+240+

const normalizedInput = normalizerFn.mock.calls.at(0)?.[0];

241+

expect(normalizedInput?.mediaUrls).toStrictEqual(["./out/photo.png"]);

211242

expect(deliverOutboundPayloadsMock).toHaveBeenCalledTimes(1);

212-

const [firstCallArg] = deliverOutboundPayloadsMock.mock.calls[0] ?? [];

213-

const deliverArgs = firstCallArg as { payloads: ReplyPayload[] } | undefined;

214-

expect(deliverArgs?.payloads[0]).toMatchObject({

215-

mediaUrls: ["/tmp/agent-workspace/out/photo.png"],

216-

});

243+

const deliverArgs = latestOutboundDeliveryArgs();

244+

expect(requirePayload(deliverArgs.payloads, 0).mediaUrls).toStrictEqual([

245+

"/tmp/agent-workspace/out/photo.png",

246+

]);

217247

});

218248219249

it("reports successful requested delivery", async () => {

@@ -288,12 +318,9 @@ describe("normalizeAgentCommandReplyPayloads", () => {

288318289319

expect(delivered.deliverySucceeded).toBe(false);

290320

expect(runtime.error).toHaveBeenCalledWith(expect.stringContaining("send failed"));

291-

expect(deliverOutboundPayloadsMock).toHaveBeenCalledWith(

292-

expect.objectContaining({

293-

bestEffort: true,

294-

queuePolicy: "best_effort",

295-

}),

296-

);

321+

const deliverArgs = latestOutboundDeliveryArgs();

322+

expect(deliverArgs.bestEffort).toBe(true);

323+

expect(deliverArgs.queuePolicy).toBe("best_effort");

297324

});

298325299326

it("threads agentId into the normalizer when sessionKey is unresolved", async () => {

@@ -302,13 +329,10 @@ describe("normalizeAgentCommandReplyPayloads", () => {

302329303330

await deliverMediaReplyForTest({ agentId: "tester" } as never);

304331305-

expect(createReplyMediaPathNormalizerMock).toHaveBeenCalledWith(

306-

expect.objectContaining({

307-

agentId: "tester",

308-

sessionKey: undefined,

309-

workspaceDir: "/tmp/agent-workspace",

310-

}),

311-

);

332+

const normalizerOptions = latestNormalizerOptions();

333+

expect(normalizerOptions.agentId).toBe("tester");

334+

expect(normalizerOptions.sessionKey).toBeUndefined();

335+

expect(normalizerOptions.workspaceDir).toBe("/tmp/agent-workspace");

312336

});

313337314338

it("keeps LINE directive-only replies intact for local preview when delivery is disabled", async () => {

@@ -338,11 +362,11 @@ describe("normalizeAgentCommandReplyPayloads", () => {

338362

expect(runtime.log).toHaveBeenCalledWith(

339363

"[[buttons: Release menu | Choose an action | Retry:retry, Ignore:ignore]]",

340364

);

341-

expect(delivered.payloads).toMatchObject([

342-

{

343-

text: "[[buttons: Release menu | Choose an action | Retry:retry, Ignore:ignore]]",

344-

},

345-

]);

365+

expect(delivered.payloads).toHaveLength(1);

366+

expectTextPayload(

367+

delivered.payloads[0],

368+

"[[buttons: Release menu | Choose an action | Retry:retry, Ignore:ignore]]",

369+

);

346370

});

347371348372

it("merges result metadata overrides into JSON output and returned results", async () => {

@@ -382,10 +406,8 @@ describe("normalizeAgentCommandReplyPayloads", () => {

382406

},

383407

2,

384408

);

385-

expect(delivered.meta).toMatchObject({

386-

durationMs: 1,

387-

transport: "embedded",

388-

fallbackFrom: "gateway",

389-

});

409+

expect(delivered.meta.durationMs).toBe(1);

410+

expect(delivered.meta.transport).toBe("embedded");

411+

expect(delivered.meta.fallbackFrom).toBe("gateway");

390412

});

391413

});