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

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
G
Google Developers Blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
S
SegmentFault 最新的问题
宝玉的分享
宝玉的分享
博客园 - Franky
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
月光博客
月光博客
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
小众软件
小众软件
Microsoft Security Blog
Microsoft Security Blog
Last Week in AI
Last Week in AI
Vercel News
Vercel News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
爱范儿
爱范儿
J
Java Code Geeks
博客园 - 叶小钗
Engineering at Meta
Engineering at Meta
阮一峰的网络日志
阮一峰的网络日志

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

@@ -12,6 +12,41 @@ const mocks = vi.hoisted(() => ({

1212

resolveOutboundTarget: vi.fn(() => ({ ok: true as const, to: "+15551234567" })),

1313

}));

141415+

type DeliveryCall = {

16+

accountId?: string;

17+

session?: {

18+

agentId?: string;

19+

key?: string;

20+

};

21+

};

22+23+

type ResolveTargetCall = {

24+

accountId?: string;

25+

channel?: string;

26+

mode?: string;

27+

to?: string;

28+

};

29+30+

function readDeliveryCall(): DeliveryCall {

31+

expect(mocks.deliverOutboundPayloads).toHaveBeenCalledOnce();

32+

const calls = mocks.deliverOutboundPayloads.mock.calls as unknown as Array<[unknown]>;

33+

const call = calls[0]?.[0];

34+

if (!call) {

35+

throw new Error("Expected delivery call");

36+

}

37+

return call as DeliveryCall;

38+

}

39+40+

function readResolveTargetCall(): ResolveTargetCall {

41+

expect(mocks.resolveOutboundTarget).toHaveBeenCalledOnce();

42+

const calls = mocks.resolveOutboundTarget.mock.calls as unknown as Array<[unknown]>;

43+

const call = calls[0]?.[0];

44+

if (!call) {

45+

throw new Error("Expected resolve target call");

46+

}

47+

return call as ResolveTargetCall;

48+

}

49+1550

vi.mock("../channels/plugins/index.js", () => ({

1651

getChannelPlugin: mocks.getChannelPlugin,

1752

getLoadedChannelPlugin: mocks.getChannelPlugin,

@@ -99,9 +134,7 @@ describe("deliverAgentCommandResult", () => {

99134

} as SessionEntry,

100135

});

101136102-

expect(mocks.deliverOutboundPayloads).toHaveBeenCalledWith(

103-

expect.objectContaining({ accountId: "kev" }),

104-

);

137+

expect(readDeliveryCall().accountId).toBe("kev");

105138

});

106139107140

it("falls back to session accountId for implicit delivery", async () => {

@@ -117,9 +150,7 @@ describe("deliverAgentCommandResult", () => {

117150

} as SessionEntry,

118151

});

119152120-

expect(mocks.deliverOutboundPayloads).toHaveBeenCalledWith(

121-

expect.objectContaining({ accountId: "legacy" }),

122-

);

153+

expect(readDeliveryCall().accountId).toBe("legacy");

123154

});

124155125156

it("does not infer accountId for explicit delivery targets", async () => {

@@ -136,12 +167,10 @@ describe("deliverAgentCommandResult", () => {

136167

} as SessionEntry,

137168

});

138169139-

expect(mocks.resolveOutboundTarget).toHaveBeenCalledWith(

140-

expect.objectContaining({ accountId: undefined, mode: "explicit" }),

141-

);

142-

expect(mocks.deliverOutboundPayloads).toHaveBeenCalledWith(

143-

expect.objectContaining({ accountId: undefined }),

144-

);

170+

const targetCall = readResolveTargetCall();

171+

expect(targetCall.accountId).toBeUndefined();

172+

expect(targetCall.mode).toBe("explicit");

173+

expect(readDeliveryCall().accountId).toBeUndefined();

145174

});

146175147176

it("skips session accountId when channel differs", async () => {

@@ -157,9 +186,9 @@ describe("deliverAgentCommandResult", () => {

157186

} as SessionEntry,

158187

});

159188160-

expect(mocks.resolveOutboundTarget).toHaveBeenCalledWith(

161-

expect.objectContaining({ accountId: undefined, channel: "whatsapp" }),

162-

);

189+

const targetCall = readResolveTargetCall();

190+

expect(targetCall.accountId).toBeUndefined();

191+

expect(targetCall.channel).toBe("whatsapp");

163192

});

164193165194

it("uses session last channel when none is provided", async () => {

@@ -174,9 +203,9 @@ describe("deliverAgentCommandResult", () => {

174203

} as SessionEntry,

175204

});

176205177-

expect(mocks.resolveOutboundTarget).toHaveBeenCalledWith(

178-

expect.objectContaining({ channel: "telegram", to: "123" }),

179-

);

206+

const targetCall = readResolveTargetCall();

207+

expect(targetCall.channel).toBe("telegram");

208+

expect(targetCall.to).toBe("123");

180209

});

181210182211

it("uses reply overrides for delivery routing", async () => {

@@ -196,9 +225,10 @@ describe("deliverAgentCommandResult", () => {

196225

} as SessionEntry,

197226

});

198227199-

expect(mocks.resolveOutboundTarget).toHaveBeenCalledWith(

200-

expect.objectContaining({ channel: "slack", to: "#reports", accountId: "ops" }),

201-

);

228+

const targetCall = readResolveTargetCall();

229+

expect(targetCall.channel).toBe("slack");

230+

expect(targetCall.to).toBe("#reports");

231+

expect(targetCall.accountId).toBe("ops");

202232

});

203233204234

it("stays silent for intentional empty payloads", async () => {

@@ -234,9 +264,10 @@ describe("deliverAgentCommandResult", () => {

234264

} as SessionEntry,

235265

});

236266237-

expect(mocks.resolveOutboundTarget).toHaveBeenCalledWith(

238-

expect.objectContaining({ channel: "whatsapp", to: "+15559876543", accountId: "work" }),

239-

);

267+

const targetCall = readResolveTargetCall();

268+

expect(targetCall.channel).toBe("whatsapp");

269+

expect(targetCall.to).toBe("+15559876543");

270+

expect(targetCall.accountId).toBe("work");

240271

});

241272242273

it("does not reuse session lastTo when runContext source omits currentChannelId", async () => {

@@ -254,9 +285,9 @@ describe("deliverAgentCommandResult", () => {

254285

} as SessionEntry,

255286

});

256287257-

expect(mocks.resolveOutboundTarget).toHaveBeenCalledWith(

258-

expect.objectContaining({ channel: "whatsapp", to: undefined }),

259-

);

288+

const targetCall = readResolveTargetCall();

289+

expect(targetCall.channel).toBe("whatsapp");

290+

expect(targetCall.to).toBeUndefined();

260291

});

261292262293

it("uses caller-provided outbound session context when opts.sessionKey is absent", async () => {

@@ -273,14 +304,9 @@ describe("deliverAgentCommandResult", () => {

273304

},

274305

});

275306276-

expect(mocks.deliverOutboundPayloads).toHaveBeenCalledWith(

277-

expect.objectContaining({

278-

session: expect.objectContaining({

279-

key: "agent:exec:hook:gmail:thread-1",

280-

agentId: "exec",

281-

}),

282-

}),

283-

);

307+

const deliveryCall = readDeliveryCall();

308+

expect(deliveryCall.session?.key).toBe("agent:exec:hook:gmail:thread-1");

309+

expect(deliveryCall.session?.agentId).toBe("exec");

284310

});

285311286312

it("prefixes nested agent outputs with context", async () => {