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

推荐订阅源

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: mock durable channel send seam · openclaw/openclaw@...
steipete · 2026-05-09 · via Recent Commits to openclaw:main

@@ -16,6 +16,7 @@ import {

16161717

const deliverOutboundPayloads = vi.hoisted(() => vi.fn());

1818

const resolveOutboundDurableFinalDeliverySupport = vi.hoisted(() => vi.fn());

19+

const sendDurableMessageBatch = vi.hoisted(() => vi.fn());

19202021

vi.mock("../../infra/outbound/deliver.js", async (importOriginal) => {

2122

const actual = await importOriginal<typeof import("../../infra/outbound/deliver.js")>();

@@ -26,6 +27,14 @@ vi.mock("../../infra/outbound/deliver.js", async (importOriginal) => {

2627

};

2728

});

282930+

vi.mock("../message/send.js", async (importOriginal) => {

31+

const actual = await importOriginal<typeof import("../message/send.js")>();

32+

return {

33+

...actual,

34+

sendDurableMessageBatch,

35+

};

36+

});

37+2938

const cfg = {} as OpenClawConfig;

30393140

function createCtx(overrides: Partial<FinalizedMsgContext> = {}): FinalizedMsgContext {

@@ -62,14 +71,26 @@ function createDispatch(

6271

}) as DispatchReplyWithBufferedBlockDispatcher;

6372

}

647374+

function createDurableSendResult(messageIds: string[]) {

75+

return {

76+

status: "sent",

77+

results: messageIds.map((messageId) => ({ messageId })),

78+

receipt: {

79+

platformMessageIds: messageIds,

80+

parts: [],

81+

sentAt: 1,

82+

},

83+

};

84+

}

85+6586

describe("channel turn kernel", () => {

6687

beforeEach(() => {

6788

vi.clearAllMocks();

6889

resolveOutboundDurableFinalDeliverySupport.mockResolvedValue({ ok: true });

6990

});

70917192

it("routes assembled final replies through durable outbound delivery", async () => {

72-

deliverOutboundPayloads.mockResolvedValueOnce([{ messageId: "tg-1" }]);

93+

sendDurableMessageBatch.mockResolvedValueOnce(createDurableSendResult(["tg-1"]));

7394

const deliver = vi.fn();

7495

const recordInboundSession = createRecordInboundSession();

7596

const dispatchReplyWithBufferedBlockDispatcher = createDispatch();

@@ -96,13 +117,13 @@ describe("channel turn kernel", () => {

9611797118

expect(result.dispatched).toBe(true);

98119

expect(deliver).not.toHaveBeenCalled();

99-

expect(deliverOutboundPayloads).toHaveBeenCalledWith(

120+

expect(sendDurableMessageBatch).toHaveBeenCalledWith(

100121

expect.objectContaining({

101122

channel: "telegram",

102123

to: "123",

103124

accountId: "acct",

104125

payloads: [expect.objectContaining({ text: "reply" })],

105-

queuePolicy: "best_effort",

126+

durability: "best_effort",

106127

replyToMode: "first",

107128

threadId: 777,

108129

session: expect.objectContaining({

@@ -127,7 +148,7 @@ describe("channel turn kernel", () => {

127148

});

128149129150

it("returns durable delivery result to the buffered dispatcher", async () => {

130-

deliverOutboundPayloads.mockResolvedValueOnce([{ messageId: "tg-1" }, { messageId: "tg-2" }]);

151+

sendDurableMessageBatch.mockResolvedValueOnce(createDurableSendResult(["tg-1", "tg-2"]));

131152

let deliveredResult: unknown;

132153

const dispatchReplyWithBufferedBlockDispatcher = vi.fn(

133154

async (params: Parameters<DispatchReplyWithBufferedBlockDispatcher>[0]) => {

@@ -167,7 +188,7 @@ describe("channel turn kernel", () => {

167188

});

168189169190

it("prepares payloads before durable enqueue and observes handled delivery", async () => {

170-

deliverOutboundPayloads.mockResolvedValueOnce([{ messageId: "tlon-1" }]);

191+

sendDurableMessageBatch.mockResolvedValueOnce(createDurableSendResult(["tlon-1"]));

171192

const onDelivered = vi.fn();

172193

const dispatchReplyWithBufferedBlockDispatcher = createDispatch();

173194

@@ -195,7 +216,7 @@ describe("channel turn kernel", () => {

195216

},

196217

});

197218198-

expect(deliverOutboundPayloads).toHaveBeenCalledWith(

219+

expect(sendDurableMessageBatch).toHaveBeenCalledWith(

199220

expect.objectContaining({

200221

payloads: [expect.objectContaining({ text: "reply\n\n_[Generated by test]_" })],

201222

}),