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

推荐订阅源

云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
博客园 - Franky
J
Java Code Geeks
V
Visual Studio Blog
G
Google Developers Blog
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Recent Announcements
Recent Announcements
Last Week in AI
Last Week in AI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
The GitHub Blog
The GitHub Blog
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
博客园 - 【当耐特】
IT之家
IT之家
I
InfoQ
U
Unit 42
C
Check Point Blog
Martin Fowler
Martin Fowler

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(telegram): drop expired approval callbacks (#82455) ·...
joshavant · 2026-05-16 · via Recent Commits to openclaw:main

@@ -866,7 +866,7 @@ describe("createTelegramBot", () => {

866866

expect(answerCallbackQuerySpy).toHaveBeenCalledWith("cbq-approve-target");

867867

});

868868869-

it("keeps legacy plugin fallback approval failures retryable for target-only recipients", async () => {

869+

it("drops target-only approval not-found misses without clearing legacy fallback buttons", async () => {

870870

onSpy.mockClear();

871871

editMessageReplyMarkupSpy.mockClear();

872872

editMessageTextSpy.mockClear();

@@ -898,23 +898,21 @@ describe("createTelegramBot", () => {

898898

throw new Error("Expected Telegram callback_query handler");

899899

}

900900901-

await expect(

902-

callbackHandler({

903-

callbackQuery: {

904-

id: "cbq-legacy-plugin-fallback-blocked",

905-

data: "/approve 138e9b8c allow-once",

906-

from: { id: 9, first_name: "Ada", username: "ada_bot" },

907-

message: {

908-

chat: { id: 1234, type: "private" },

909-

date: 1736380800,

910-

message_id: 25,

911-

text: "Legacy plugin approval required.",

912-

},

901+

await callbackHandler({

902+

callbackQuery: {

903+

id: "cbq-legacy-plugin-fallback-blocked",

904+

data: "/approve 138e9b8c allow-once",

905+

from: { id: 9, first_name: "Ada", username: "ada_bot" },

906+

message: {

907+

chat: { id: 1234, type: "private" },

908+

date: 1736380800,

909+

message_id: 25,

910+

text: "Legacy plugin approval required.",

913911

},

914-

me: { username: "openclaw_bot" },

915-

getFile: async () => ({ download: async () => new Uint8Array() }),

916-

}),

917-

).rejects.toThrow("unknown or expired approval id");

912+

},

913+

me: { username: "openclaw_bot" },

914+

getFile: async () => ({ download: async () => new Uint8Array() }),

915+

});

918916919917

const approvalCall = execApprovalCall();

920918

const execApprovals = execApprovalTargetConfig(approvalCall);

@@ -930,6 +928,63 @@ describe("createTelegramBot", () => {

930928

expect(answerCallbackQuerySpy).toHaveBeenCalledWith("cbq-legacy-plugin-fallback-blocked");

931929

});

932930931+

it("drops expired approval callbacks for configured approvers after clearing buttons", async () => {

932+

onSpy.mockClear();

933+

editMessageReplyMarkupSpy.mockClear();

934+

editMessageTextSpy.mockClear();

935+

resolveExecApprovalSpy.mockClear();

936+

replySpy.mockClear();

937+

sendMessageSpy.mockClear();

938+

resolveExecApprovalSpy.mockRejectedValueOnce(new Error("unknown or expired approval id"));

939+940+

loadConfig.mockReturnValue({

941+

channels: {

942+

telegram: {

943+

dmPolicy: "open",

944+

allowFrom: ["*"],

945+

execApprovals: {

946+

enabled: true,

947+

approvers: ["9"],

948+

target: "dm",

949+

},

950+

},

951+

},

952+

});

953+

createTelegramBot({ token: "tok" });

954+

const callbackHandler = onSpy.mock.calls.find((call) => call[0] === "callback_query")?.[1] as (

955+

ctx: Record<string, unknown>,

956+

) => Promise<void>;

957+

if (!callbackHandler) {

958+

throw new Error("Expected Telegram callback_query handler");

959+

}

960+961+

await callbackHandler({

962+

callbackQuery: {

963+

id: "cbq-expired-approval",

964+

data: "/approve 138e9b8c allow-once",

965+

from: { id: 9, first_name: "Ada", username: "ada_bot" },

966+

message: {

967+

chat: { id: 1234, type: "private" },

968+

date: 1736380800,

969+

message_id: 26,

970+

text: "Approval required.",

971+

},

972+

},

973+

me: { username: "openclaw_bot" },

974+

getFile: async () => ({ download: async () => new Uint8Array() }),

975+

});

976+977+

const approvalCall = execApprovalCall();

978+

expect(approvalCall.approvalId).toBe("138e9b8c");

979+

expect(approvalCall.decision).toBe("allow-once");

980+

expect(approvalCall.allowPluginFallback).toBe(true);

981+

expect(approvalCall.senderId).toBe("9");

982+

expect(editMessageReplyMarkupSpy).toHaveBeenCalledTimes(1);

983+

expect(replySpy).not.toHaveBeenCalled();

984+

expect(sendMessageSpy).not.toHaveBeenCalled();

985+

expect(answerCallbackQuerySpy).toHaveBeenCalledWith("cbq-expired-approval");

986+

});

987+933988

it("keeps plugin approval callback buttons for target-only recipients", async () => {

934989

onSpy.mockClear();

935990

editMessageReplyMarkupSpy.mockClear();