mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
fix(telegram): show buttonless ask-user prompts (#130200)
Telegram progress streaming treated buttonless ask-user replies as transient progress, so multi-question prompts could disappear without a visible delivery. Keep ask-user payloads on the durable question path and cover the owner boundary with a regression test. Co-authored-by: Ayaan Zaidi <hi@obviy.us>
This commit is contained in:
@@ -329,6 +329,7 @@ export async function deliverReply(
|
||||
const canRepresentAsTransientProgress =
|
||||
!reply.hasMedia &&
|
||||
telegramButtons === undefined &&
|
||||
effectivePayload.channelData?.askUser === undefined &&
|
||||
!hasExecApprovalPayload(effectivePayload);
|
||||
const isFastModeProgressPayload = isFastModeAutoProgressPayload(effectivePayload);
|
||||
if (turn.streamMode === "progress") {
|
||||
|
||||
@@ -479,6 +479,27 @@ describeTelegramDispatch("dispatchTelegramMessage progress-rendering", () => {
|
||||
expect(finalText.length).toBeLessThanOrEqual(80);
|
||||
});
|
||||
|
||||
it("delivers buttonless ask_user prompts outside transient progress", async () => {
|
||||
const { answerDraftStream } = setupDraftStreams({ answerMessageId: 2001 });
|
||||
dispatchReplyWithBufferedBlockDispatcher.mockImplementation(async ({ dispatcherOptions }) => {
|
||||
await dispatcherOptions.deliver(
|
||||
{
|
||||
text: "Pick one or more",
|
||||
channelData: {
|
||||
askUser: { questionId: "ask_0123456789abcdef0123456789abcdef" },
|
||||
},
|
||||
},
|
||||
{ kind: "tool" },
|
||||
);
|
||||
return { queuedFinal: true };
|
||||
});
|
||||
|
||||
await dispatchWithContext({ context: createContext(), streamMode: "progress" });
|
||||
|
||||
expect(answerDraftStream.update).toHaveBeenCalledWith("Pick one or more");
|
||||
expect(registerChannelDelivery).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("streams interactive buttons into the same message", async () => {
|
||||
const { answerDraftStream } = setupDraftStreams({ answerMessageId: 2001 });
|
||||
dispatchReplyWithBufferedBlockDispatcher.mockImplementation(async ({ dispatcherOptions }) => {
|
||||
|
||||
Reference in New Issue
Block a user