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

推荐订阅源

IT之家
IT之家
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
L
LangChain Blog
爱范儿
爱范儿
博客园_首页
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 三生石上(FineUI控件)
大猫的无限游戏
大猫的无限游戏
宝玉的分享
宝玉的分享
GbyAI
GbyAI
H
Help Net Security
A
About on SuperTechFans
Recent Announcements
Recent Announcements
Hugging Face - Blog
Hugging Face - Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网
D
Docker
博客园 - Franky
有赞技术团队
有赞技术团队
G
Google Developers 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
fix(discord): clear failed partial preview finals · openc...
steipete · 2026-05-15 · via Recent Commits to openclaw:main

@@ -204,27 +204,31 @@ vi.mock("openclaw/plugin-sdk/reply-runtime", () => ({

204204

createReplyDispatcherWithTyping: (opts: {

205205

deliver: (payload: unknown, info: { kind: string }) => Promise<void> | void;

206206

onReplyStart?: () => Promise<void> | void;

207-

}) => ({

208-

dispatcher: {

209-

sendToolResult: vi.fn(() => true),

210-

sendBlockReply: vi.fn((payload: unknown) => {

211-

void opts.deliver(payload, { kind: "block" });

212-

return true;

213-

}),

214-

sendFinalReply: vi.fn((payload: unknown) => {

215-

void opts.deliver(payload, { kind: "final" });

216-

return true;

217-

}),

218-

waitForIdle: vi.fn(async () => {}),

219-

getQueuedCounts: vi.fn(() => ({ tool: 0, block: 0, final: 0 })),

220-

markComplete: vi.fn(),

221-

},

222-

replyOptions: {

223-

onReplyStart: opts.onReplyStart,

224-

},

225-

markDispatchIdle: vi.fn(),

226-

markRunComplete: vi.fn(),

227-

}),

207+

}) => {

208+

const pendingDeliveries: Promise<void>[] = [];

209+

const queueDelivery = (payload: unknown, info: { kind: "block" | "final" }) => {

210+

const delivery = Promise.resolve(opts.deliver(payload, info)).catch(() => undefined);

211+

pendingDeliveries.push(delivery);

212+

return true;

213+

};

214+

return {

215+

dispatcher: {

216+

sendToolResult: vi.fn(() => true),

217+

sendBlockReply: vi.fn((payload: unknown) => queueDelivery(payload, { kind: "block" })),

218+

sendFinalReply: vi.fn((payload: unknown) => queueDelivery(payload, { kind: "final" })),

219+

waitForIdle: vi.fn(async () => {

220+

await Promise.all(pendingDeliveries);

221+

}),

222+

getQueuedCounts: vi.fn(() => ({ tool: 0, block: 0, final: 0 })),

223+

markComplete: vi.fn(),

224+

},

225+

replyOptions: {

226+

onReplyStart: opts.onReplyStart,

227+

},

228+

markDispatchIdle: vi.fn(),

229+

markRunComplete: vi.fn(),

230+

};

231+

},

228232

}));

229233230234

vi.mock("openclaw/plugin-sdk/conversation-runtime", () => ({

@@ -1473,6 +1477,32 @@ describe("processDiscordMessage draft streaming", () => {

14731477

expect(deliverDiscordReply).toHaveBeenCalledTimes(1);

14741478

});

147514791480+

it("clears partial drafts when fallback final delivery fails before completion", async () => {

1481+

const draftStream = createMockDraftStreamForTest();

1482+

deliverDiscordReply.mockRejectedValueOnce(new Error("send failed"));

1483+

dispatchInboundMessage.mockImplementationOnce(async (params?: DispatchInboundParams) => {

1484+

await params?.replyOptions?.onPartialReply?.({ text: "partial answer..." });

1485+

await params?.dispatcher.sendFinalReply({ text: "complete\nanswer" });

1486+

return {

1487+

queuedFinal: true,

1488+

counts: { final: 1, tool: 0, block: 0 },

1489+

failedCounts: { final: 1 },

1490+

};

1491+

});

1492+1493+

const ctx = await createAutomaticSourceDeliveryContext({

1494+

discordConfig: { streamMode: "partial", maxLinesPerMessage: 1 },

1495+

});

1496+1497+

await runProcessDiscordMessage(ctx);

1498+1499+

expect(draftStream.update).toHaveBeenCalledWith("partial answer...");

1500+

expect(editMessageDiscord).not.toHaveBeenCalled();

1501+

expect(deliverDiscordReply).toHaveBeenCalledTimes(1);

1502+

expect(draftStream.discardPending).toHaveBeenCalled();

1503+

expect(draftStream.clear).toHaveBeenCalledTimes(1);

1504+

});

1505+14761506

it("uses root discord maxLinesPerMessage for preview finalization when runtime config omits it", async () => {

14771507

const longReply = Array.from({ length: 20 }, (_value, index) => `Line ${index + 1}`).join("\n");

14781508

dispatchInboundMessage.mockImplementationOnce(async (params?: DispatchInboundParams) => {