Skip to content

Commit b5c3379

Browse files
committed
fix(telegram): clear progress draft before answer
1 parent dc7fab4 commit b5c3379

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Docs: https://docs.openclaw.ai
1010

1111
### Fixes
1212

13+
- Telegram: delete tool-progress-only draft bubbles before rotating to the real answer, preventing orphaned progress messages in streamed replies.
1314
- ACP: preserve redacted numeric JSON-RPC `RequestError` details in runtime failure text, so backend diagnostics are visible instead of only `Internal error`. Fixes #81126. (#81188) Thanks @vyctorbrzezowski.
1415
- Agents: cache unchanged PI model discovery stores and model lookups, reducing repeated model-resolution startup latency under large model configs. Fixes #78851.
1516
- Security/Windows ACL audit: classify Anonymous Logon, Guests, Interactive, Local, and Network SIDs as world-equivalent principals so broadly writable paths stay critical instead of being downgraded to group-writable. Fixes #74350. (#74383) Thanks @dwc1997.

extensions/telegram/src/bot-message-dispatch.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,9 +1190,11 @@ describe("dispatchTelegramMessage draft streaming", () => {
11901190
);
11911191
expect(answerDraftStream.update).toHaveBeenNthCalledWith(2, "Branch is up to date");
11921192
expect(answerDraftStream.forceNewMessage).toHaveBeenCalledTimes(1);
1193-
expect(answerDraftStream.clear).not.toHaveBeenCalled();
1193+
expect(answerDraftStream.clear).toHaveBeenCalledTimes(1);
1194+
const clearOrder = answerDraftStream.clear.mock.invocationCallOrder[0];
11941195
const rotationOrder = answerDraftStream.forceNewMessage.mock.invocationCallOrder[0];
11951196
const finalUpdateOrder = answerDraftStream.update.mock.invocationCallOrder[1];
1197+
expect(clearOrder).toBeLessThan(rotationOrder);
11961198
expect(rotationOrder).toBeLessThan(finalUpdateOrder);
11971199
});
11981200

@@ -1209,9 +1211,11 @@ describe("dispatchTelegramMessage draft streaming", () => {
12091211
expect(answerDraftStream.update).toHaveBeenNthCalledWith(1, "🛠️ Exec: pnpm test");
12101212
expect(answerDraftStream.update).toHaveBeenNthCalledWith(2, "Tests passed");
12111213
expect(answerDraftStream.forceNewMessage).toHaveBeenCalledTimes(1);
1212-
expect(answerDraftStream.clear).not.toHaveBeenCalled();
1214+
expect(answerDraftStream.clear).toHaveBeenCalledTimes(1);
1215+
const clearOrder = answerDraftStream.clear.mock.invocationCallOrder[0];
12131216
const rotationOrder = answerDraftStream.forceNewMessage.mock.invocationCallOrder[0];
12141217
const finalUpdateOrder = answerDraftStream.update.mock.invocationCallOrder[1];
1218+
expect(clearOrder).toBeLessThan(rotationOrder);
12151219
expect(rotationOrder).toBeLessThan(finalUpdateOrder);
12161220
});
12171221

@@ -1241,7 +1245,7 @@ describe("dispatchTelegramMessage draft streaming", () => {
12411245
);
12421246
expect(answerDraftStream.update).not.toHaveBeenCalledWith("Branch is up to date");
12431247
expect(answerDraftStream.forceNewMessage).toHaveBeenCalledTimes(1);
1244-
expect(answerDraftStream.clear).not.toHaveBeenCalled();
1248+
expect(answerDraftStream.clear).toHaveBeenCalledTimes(1);
12451249
expectDeliveredReply(0, { text: "Branch is up to date" });
12461250
expect(editMessageTelegram).not.toHaveBeenCalled();
12471251
});
@@ -1364,7 +1368,7 @@ describe("dispatchTelegramMessage draft streaming", () => {
13641368
);
13651369
expect(draftStream.forceNewMessage).toHaveBeenCalledTimes(1);
13661370
expect(draftStream.materialize).not.toHaveBeenCalled();
1367-
expect(draftStream.clear).not.toHaveBeenCalled();
1371+
expect(draftStream.clear).toHaveBeenCalledTimes(1);
13681372
expectDeliveredReply(0, { text: "Final after tool" });
13691373
expect(editMessageTelegram).not.toHaveBeenCalled();
13701374
});

extensions/telegram/src/bot-message-dispatch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ export const dispatchTelegramMessage = async ({
764764
if (!activeAnswerDraftIsToolProgressOnly) {
765765
return false;
766766
}
767-
await answerLane.stream?.stop();
767+
await answerLane.stream?.clear();
768768
answerLane.stream?.forceNewMessage();
769769
resetDraftLaneState(answerLane);
770770
streamToolProgressSuppressed = true;

0 commit comments

Comments
 (0)