mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:30:42 +00:00
fix: unblock Telegram approval callback deadlock (#64979) (thanks @nk3750)
* fix(telegram): bypass sequentializer for approval callback_queries Approval callback_queries from clicking inline buttons get the same sequential key as the blocked agent turn (telegram:<chatId>), causing a deadlock: the callback can't run because the lane is held, and the lane can't release because it's waiting for the callback. Give approval callbacks a separate lane (telegram:<chatId>:approval), same pattern as abort requests (telegram:<chatId>:control) and btw requests (telegram:<chatId>:btw). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * style(telegram): trim approval lane comments * fix: unblock Telegram approval callback deadlock (#64979) (thanks @nk3750) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Ayaan Zaidi <hi@obviy.us>
This commit is contained in:
@@ -10,6 +10,7 @@ Docs: https://docs.openclaw.ai
|
||||
|
||||
- Matrix/mentions: keep room mention gating strict while accepting visible `@displayName` Matrix URI labels, so `requireMention` works for non-OpenClaw Matrix clients again. (#64796) Thanks @hclsys.
|
||||
- Doctor: warn when on-disk agent directories still exist under `~/.openclaw/agents/<id>/agent` but the matching `agents.list[]` entries are missing from config. (#65113) Thanks @neeravmakwana.
|
||||
- Telegram: route approval button callback queries onto a separate sequentializer lane so plugin approval clicks can resolve immediately instead of deadlocking behind the blocked agent turn. (#64979) Thanks @nk3750.
|
||||
|
||||
## 2026.4.11
|
||||
|
||||
|
||||
@@ -94,6 +94,50 @@ describe("getTelegramSequentialKey", () => {
|
||||
{ message: mockMessage({ chat: mockChat({ id: 123 }), text: "halt" }) },
|
||||
"telegram:123:control",
|
||||
],
|
||||
[
|
||||
{
|
||||
update: {
|
||||
callback_query: {
|
||||
message: mockMessage({ chat: mockChat({ id: 123 }) }),
|
||||
data: "/approve plugin:abc123 allow-once",
|
||||
},
|
||||
},
|
||||
},
|
||||
"telegram:123:approval",
|
||||
],
|
||||
[
|
||||
{
|
||||
update: {
|
||||
callback_query: {
|
||||
message: mockMessage({ chat: mockChat({ id: 456 }) }),
|
||||
data: "/approve exec:def456 deny",
|
||||
},
|
||||
},
|
||||
},
|
||||
"telegram:456:approval",
|
||||
],
|
||||
[
|
||||
{
|
||||
update: {
|
||||
callback_query: {
|
||||
message: mockMessage({ chat: mockChat({ id: 789 }) }),
|
||||
data: "/approve plugin:ghi789 always",
|
||||
},
|
||||
},
|
||||
},
|
||||
"telegram:789:approval",
|
||||
],
|
||||
[
|
||||
{
|
||||
update: {
|
||||
callback_query: {
|
||||
message: mockMessage({ chat: mockChat({ id: 123 }) }),
|
||||
data: "some-other-button",
|
||||
},
|
||||
},
|
||||
},
|
||||
"telegram:123",
|
||||
],
|
||||
[{ message: mockMessage({ chat: mockChat({ id: 123 }), text: "/abort" }) }, "telegram:123"],
|
||||
[{ message: mockMessage({ chat: mockChat({ id: 123 }), text: "/abort now" }) }, "telegram:123"],
|
||||
[
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { type Message, type UserFromGetMe } from "@grammyjs/types";
|
||||
import { parseExecApprovalCommandText } from "openclaw/plugin-sdk/infra-runtime";
|
||||
import { isAbortRequestText } from "openclaw/plugin-sdk/reply-runtime";
|
||||
import { isBtwRequestText } from "openclaw/plugin-sdk/reply-runtime";
|
||||
import { resolveTelegramForumThreadId } from "./bot/helpers.js";
|
||||
@@ -14,7 +15,7 @@ export type TelegramSequentialKeyContext = {
|
||||
edited_message?: Message;
|
||||
channel_post?: Message;
|
||||
edited_channel_post?: Message;
|
||||
callback_query?: { message?: Message };
|
||||
callback_query?: { message?: Message; data?: string };
|
||||
message_reaction?: { chat?: { id?: number } };
|
||||
};
|
||||
};
|
||||
@@ -52,6 +53,13 @@ export function getTelegramSequentialKey(ctx: TelegramSequentialKeyContext): str
|
||||
}
|
||||
return "telegram:btw";
|
||||
}
|
||||
const callbackData = ctx.update?.callback_query?.data;
|
||||
if (callbackData && parseExecApprovalCommandText(callbackData) !== null) {
|
||||
if (typeof chatId === "number") {
|
||||
return `telegram:${chatId}:approval`;
|
||||
}
|
||||
return "telegram:approval";
|
||||
}
|
||||
const isGroup = msg?.chat?.type === "group" || msg?.chat?.type === "supergroup";
|
||||
const messageThreadId = msg?.message_thread_id;
|
||||
const isForum = msg?.chat?.is_forum;
|
||||
|
||||
Reference in New Issue
Block a user