Skip to content

Commit 59aa733

Browse files
committed
test(discord): cover progress warning finalization
1 parent 653d1cb commit 59aa733

2 files changed

Lines changed: 43 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Docs: https://docs.openclaw.ai
106106
- Providers/DeepSeek: normalize MCP tool schemas with `anyOf`/`oneOf` unions before normal and compaction requests reach DeepSeek, preventing union-shaped parameters from being rejected. (#83766) Thanks @TurboTheTurtle.
107107
- Control UI: render live tool progress from session-scoped `session.tool` Gateway events so externally started runs show their tool cards in the active session. (#83734) Thanks @TurboTheTurtle.
108108
- Outbound: resolve send-capable channel plugins from the active runtime registry when the pinned startup registry only has setup metadata. (#83733) Thanks @TurboTheTurtle.
109-
- Discord: preserve streamed reply previews when recovered tool-warning finals are delivered before or after the assistant's final reply. (#83844) Thanks @neeravmakwana.
109+
- Discord: preserve streamed reply previews when recovered tool-warning finals are delivered before or after the assistant's final reply. (#84169) Thanks @neeravmakwana.
110110
- Control UI: keep the chat delete confirmation popover clamped inside the visible viewport on small screens. (#83804) Thanks @ThiagoCAltoe.
111111
- Browser: enforce current-tab URL allowlist checks for `/act` evaluate/batch actions and `/highlight` routes while leaving tab-management actions unblocked. (#78523)
112112
- CI: require real-behavior-proof verdict markers to come from the ClawSweeper GitHub App before accepting exact-head proof. (#83692)

extensions/discord/src/monitor/message-handler.process.test.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,6 +2272,48 @@ describe("processDiscordMessage draft streaming", () => {
22722272
expectPreviewEditContent("done");
22732273
});
22742274

2275+
it("keeps finalized progress previews when later tool warning finals are delivered", async () => {
2276+
const draftStream = createMockDraftStreamForTest();
2277+
2278+
dispatchInboundMessage.mockImplementationOnce(async (params?: DispatchInboundParams) => {
2279+
await params?.replyOptions?.onToolStart?.({ name: "exec", phase: "start" });
2280+
await params?.replyOptions?.onItemEvent?.({ progressText: "exec done" });
2281+
await params?.dispatcher.sendFinalReply({ text: "delivery survived" });
2282+
await params?.dispatcher.sendFinalReply({
2283+
text: "⚠️ 🛠️ `run openclaw definitely-not-a-real-subcommand (agent)` failed",
2284+
isError: true,
2285+
} as never);
2286+
return { queuedFinal: true, counts: { final: 2, tool: 0, block: 0 } };
2287+
});
2288+
2289+
const ctx = await createAutomaticSourceDeliveryContext({
2290+
discordConfig: {
2291+
streaming: {
2292+
mode: "progress",
2293+
progress: {
2294+
label: "Shelling",
2295+
},
2296+
},
2297+
},
2298+
});
2299+
2300+
await runProcessDiscordMessage(ctx);
2301+
2302+
expect(draftStream.update).toHaveBeenCalledWith("Shelling\n\n🛠️ Exec\n• exec done");
2303+
expectPreviewEditContent("delivery survived");
2304+
expect(draftStream.clear).not.toHaveBeenCalled();
2305+
expect(draftStream.messageId()).toBe("preview-1");
2306+
expect(deliverDiscordReply).toHaveBeenCalledTimes(1);
2307+
expect(firstMockArg(deliverDiscordReply, "deliverDiscordReply")).toMatchObject({
2308+
replies: [
2309+
{
2310+
text: "⚠️ 🛠️ `run openclaw definitely-not-a-real-subcommand (agent)` failed",
2311+
isError: true,
2312+
},
2313+
],
2314+
});
2315+
});
2316+
22752317
it("uses raw tool-progress detail in Discord progress drafts", async () => {
22762318
const draftStream = createMockDraftStreamForTest();
22772319

0 commit comments

Comments
 (0)