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

推荐订阅源

Y
Y Combinator Blog
T
The Exploit Database - CXSecurity.com
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
O
OpenAI News
阮一峰的网络日志
阮一峰的网络日志
博客园 - 【当耐特】
Forbes - Security
Forbes - Security
F
Fortinet All Blogs
Hacker News: Ask HN
Hacker News: Ask HN
Blog — PlanetScale
Blog — PlanetScale
S
Schneier on Security
雷峰网
雷峰网
I
Intezer
博客园_首页
罗磊的独立博客
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V2EX - 技术
V2EX - 技术
G
GRAHAM CLULEY
MyScale Blog
MyScale Blog
Recent Announcements
Recent Announcements
N
News and Events Feed by Topic
T
Troy Hunt's Blog
S
Security Affairs
S
Securelist
Attack and Defense Labs
Attack and Defense Labs
IT之家
IT之家
V
Visual Studio Blog
WordPress大学
WordPress大学
T
Tenable Blog
T
Threat Research - Cisco Blogs
小众软件
小众软件
A
About on SuperTechFans
Spread Privacy
Spread Privacy
T
Tor Project blog
V
V2EX
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
P
Proofpoint News Feed
博客园 - 叶小钗
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
C
CERT Recently Published Vulnerability Notes
P
Proofpoint News Feed
L
LINUX DO - 热门话题
大猫的无限游戏
大猫的无限游戏

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 test: trim doctor command hotspots · openclaw/openclaw@c66f16a test: isolate agent auth and spawn hotspots · openclaw/openclaw@9285935 test: stabilize MCP startup disposal race · openclaw/openclaw@dd9d2eb test: merge browser contract server suites · openclaw/openclaw@5817a76 test: narrow ollama provider discovery setup · openclaw/openclaw@a0d9598 build: declare qa-lab aimock runtime dependency · openclaw/openclaw@24431e5 test: speed up safe-bins exec harness · openclaw/openclaw@ee856ab test: preserve tool helpers in embedded runner mocks · openclaw/openclaw@acd86a0 refactor: move memory embeddings into provider plugins · openclaw/openclaw@77e6e4c test: reuse system-run temp fixtures · openclaw/openclaw@7e9ff0f test: trim hotspot wait overhead · openclaw/openclaw@12a59b0 Check: avoid duplicate boundary prep · openclaw/openclaw@baf11b8 test: reduce hotspot fixture overhead · openclaw/openclaw@3a59edd feat(ui): overhaul settings and slash command UX (#67819) thanks @Bun… · openclaw/openclaw@2cfb660 QA Matrix: exit cleanly on failure · openclaw/openclaw@42805d2 QA Matrix: isolate scenario coverage · openclaw/openclaw@7e659e1 Matrix: refresh crypto bootstrap state · openclaw/openclaw@94081d8 QA Lab: add provider registry · openclaw/openclaw@bb7e982 Matrix: add plugin changelog · openclaw/openclaw@4acab55 test: trim more hotspot overhead · openclaw/openclaw@f485311 test: trim remaining hotspot tests · openclaw/openclaw@6ba8626 test: narrow hotspot mocks · openclaw/openclaw@dbc8179 test: isolate gemini embedding request helpers · openclaw/openclaw@cd330f5 test: trim memory and mcp hotspots · openclaw/openclaw@fd48dfa test: slim provider registry mocks · openclaw/openclaw@2e08c77 test: harden Parallels update smoke · openclaw/openclaw@1a98090 feat: default Anthropic to Opus 4.7 · openclaw/openclaw@628b454 fix: harden node-host shell payload mutability checks · openclaw/openclaw@75c551e fix: land node-host approval binding for native binaries (#66731) (th… · openclaw/openclaw@29919bb CI: add daily schedule to CodeQL workflow (#67645) · openclaw/openclaw@69d25f5 fix(gateway): capture config hash after plugin auto-enable to prevent… · openclaw/openclaw@8c11210 fix: repair sanitized replay tool results before send (#67620) (thank… · openclaw/openclaw@c3c7a99 fix: restrict HTML timeout short-circuit to transient statuses · openclaw/openclaw@de129a6 fix: keep TUI watchdog bound to active run (#67401) (thanks @xantorres) · openclaw/openclaw@3525273 Gateway/skills: dedupe skills prefix-match + drop dead fallback on log · openclaw/openclaw@d7f489f Extensions/lmstudio: back off inference preload after consecutive fai… · openclaw/openclaw@b555214 TUI/streaming: add watchdog that resets the activity indicator after … · openclaw/openclaw@f44ab20 Agents/tool-loop: enable unknown-tool stream guard by default · openclaw/openclaw@36ed367 Gateway/skills: invalidate session skills snapshot on config write · openclaw/openclaw@b23d59a fix: classify HTML provider error pages correctly (#67642) (thanks @s… · openclaw/openclaw@e588e90 fix(skills): remove unused model-usage import (#67641) · openclaw/openclaw@55f05df docs(changelog): credit codex fix superseded PRs · openclaw/openclaw@e485f24 fix(openai-codex): normalize stale transport metadata in resolution a… · openclaw/openclaw@90801ba CI: pin Docker-related GitHub Actions (#67632) · openclaw/openclaw@f697b01 Android: modernize WebView and discovery API usage (#67627) · openclaw/openclaw@44a6e50 fix(deps): bump hono to 4.12.14 and @hono/node-server to 1.19.14 (GHS… · openclaw/openclaw@fbccc18 fix(deps): bump dompurify to 3.4.0 (#67614) · openclaw/openclaw@2c2dc00 CI: add explicit permissions to all workflow jobs (fixes code-scannin… · openclaw/openclaw@01b7516 fix: register bundled TTS providers and route overrides correctly (#6… · openclaw/openclaw@6ea3cdd fix: align host tilde paths with OS home (#62804) (thanks @stainlu) · openclaw/openclaw@ecfaf64 fix: flush creds queue before reconnect socket open (#67464) (thanks … · openclaw/openclaw@405c63f fix: strip standalone <function> tool call tags from visible text (#6… · openclaw/openclaw@78df859 fix(agents): preserve cli session metadata before transcript persist … · openclaw/openclaw@898fd04 docs(changelog): move cli transcript entry · openclaw/openclaw@c1817c6 fix(agents): normalize cli transcript api field · openclaw/openclaw@3a3fae0 docs(changelog): note cli transcript persistence · openclaw/openclaw@6c343f1 fix(agents): persist cli transcript turns · openclaw/openclaw@b8ef507 fix(msteams): harden security-sensitive flows (#65841) · openclaw/openclaw@c56b56e [Dashboard] Fix exec approval modal overflow for long command content… · openclaw/openclaw@053c5b0 Docs: remove QA changelog entry · openclaw/openclaw@7fd5771 QA: fix private runtime source loading (#67428) · openclaw/openclaw@d5933af docs(gateway): correct protocol.md schema path, hello-ok example, aut… · openclaw/openclaw@489404d CI: pin Node 22 runners to 22.18.0 · openclaw/openclaw@4ffa621 models.authStatus: normalize provider ids + tighten env-backed escape… · openclaw/openclaw@f2fdb9d Update CHANGELOG.md · openclaw/openclaw@7694a92 test(parallels): clean up npm update guard jobs · openclaw/openclaw@045ea7b Plugins: prefer scanDir override paths · openclaw/openclaw@b2974da fix(dreaming): default storage.mode to "separate" so phase blocks sto… · openclaw/openclaw@8c392f0 fix(memory-core): skip dreaming transcript ingestion via session stor… · openclaw/openclaw@a1b01f0 fix: dedupe replayed exec.finished node events (#67281) · openclaw/openclaw@5dcf526
test: guard telegram bot mock calls · openclaw/openclaw@aa97993
steipete · 2026-05-12 · via Recent Commits to openclaw:main

@@ -186,7 +186,10 @@ function expectRecordFields(

186186

}

187187188188

function getBotCtorOptions(callIndex = 0): Record<string, unknown> {

189-

const call = requireValue(botCtorSpy.mock.calls[callIndex], `bot constructor call ${callIndex}`);

189+

const call = requireValue(

190+

botCtorSpy.mock.calls.at(callIndex),

191+

`bot constructor call ${callIndex}`,

192+

);

190193

expect(call[0]).toBe("tok");

191194

return requireRecord(call[1], `bot constructor options ${callIndex}`);

192195

}

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

246249

const catchMock = bot.catch as unknown as {

247250

mock: { calls: Array<[(err: unknown) => void]> };

248251

};

249-

const errorHandler = catchMock.mock.calls[0]?.[0];

252+

const errorHandler = catchMock.mock.calls.at(0)?.[0];

250253251254

expect(errorHandler).toBeTypeOf("function");

252255

errorHandler?.(new Error("handler boom"));

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

265268

const fetchImpl = resolveTelegramFetch();

266269

expect(fetchImpl).toBeTypeOf("function");

267270

expect(fetchImpl).not.toBe(fetchSpy);

268-

const clientFetch = (botCtorSpy.mock.calls[0]?.[1] as { client?: { fetch?: unknown } })

271+

const clientFetch = (botCtorSpy.mock.calls.at(0)?.[1] as { client?: { fetch?: unknown } })

269272

?.client?.fetch;

270273

expect(clientFetch).toBeTypeOf("function");

271274

expect(clientFetch).not.toBe(fetchSpy);

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

753756

});

754757755758

expect(replySpy).toHaveBeenCalledTimes(1);

756-

const payload = replySpy.mock.calls[0][0];

759+

const payload = requireValue(replySpy.mock.calls.at(0), "replySpy call")[0];

757760

expect(payload.Body).toContain("cmd:option_a");

758761

expect(answerCallbackQuerySpy).toHaveBeenCalledWith("cbq-1");

759762

});

@@ -825,7 +828,9 @@ describe("createTelegramBot", () => {

825828

});

826829827830

expect(replySpy).toHaveBeenCalledTimes(1);

828-

expect(replySpy.mock.calls[0][0].Body).toContain("Multi-select submitted: env|prod");

831+

expect(requireValue(replySpy.mock.calls.at(0), "replySpy call")[0].Body).toContain(

832+

"Multi-select submitted: env|prod",

833+

);

829834

});

830835831836

it("submits OC_SELECT values as a synthetic inbound message and clears buttons", async () => {

@@ -859,7 +864,9 @@ describe("createTelegramBot", () => {

859864

reply_markup: { inline_keyboard: [] },

860865

});

861866

expect(replySpy).toHaveBeenCalledTimes(1);

862-

expect(replySpy.mock.calls[0][0].Body).toContain("Single-select submitted: env|canary");

867+

expect(requireValue(replySpy.mock.calls.at(0), "replySpy call")[0].Body).toContain(

868+

"Single-select submitted: env|canary",

869+

);

863870

});

864871865872

it("preserves native command source for prefixed callback_query payloads", async () => {

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

894901

});

895902896903

expect(replySpy).toHaveBeenCalledTimes(1);

897-

const payload = replySpy.mock.calls[0][0];

904+

const payload = requireValue(replySpy.mock.calls.at(0), "replySpy call")[0];

898905

expect(payload.CommandBody).toBe("/fast status");

899906

expect(payload.CommandSource).toBe("native");

900907

expect(answerCallbackQuerySpy).toHaveBeenCalledWith("cbq-native-1");

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

976983

});

977984978985

expect(replySpy).toHaveBeenCalledTimes(1);

979-

const payload = replySpy.mock.calls[0][0];

986+

const payload = requireValue(replySpy.mock.calls.at(0), "replySpy call")[0];

980987

const expectedTimestamp = formatEnvelopeTimestamp(new Date("2025-01-09T00:00:00Z"));

981988

const timestampPattern = escapeRegExp(expectedTimestamp);

982989

expect(payload.Body).toMatch(

@@ -1043,12 +1050,16 @@ describe("createTelegramBot", () => {

1043105010441051

expect(replySpy, testCase.name).not.toHaveBeenCalled();

10451052

expect(sendMessageSpy, testCase.name).toHaveBeenCalledTimes(testCase.expectedSendCount);

1046-

expect(sendMessageSpy.mock.calls[0]?.[0], testCase.name).toBe(1234);

1047-

const pairingText = String(sendMessageSpy.mock.calls[0]?.[1]);

1053+

expect(sendMessageSpy.mock.calls.at(0)?.[0], testCase.name).toBe(1234);

1054+

const pairingText = String(sendMessageSpy.mock.calls.at(0)?.[1]);

10481055

expect(pairingText, testCase.name).toContain(`Your Telegram user id: ${senderId}`);

10491056

expect(pairingText, testCase.name).toContain("Pairing code:");

10501057

expect(pairingText, testCase.name).toContain("openclaw pairing approve telegram");

1051-

expectRecordFields(sendMessageSpy.mock.calls[0]?.[2], { parse_mode: "HTML" }, testCase.name);

1058+

expectRecordFields(

1059+

sendMessageSpy.mock.calls.at(0)?.[2],

1060+

{ parse_mode: "HTML" },

1061+

testCase.name,

1062+

);

10521063

}

10531064

});

10541065

@@ -1125,11 +1136,11 @@ describe("createTelegramBot", () => {

11251136

expect(getFileSpy).not.toHaveBeenCalled();

11261137

expect(fetchSpy).not.toHaveBeenCalled();

11271138

expect(sendMessageSpy).toHaveBeenCalledTimes(1);

1128-

const pairingText = String(sendMessageSpy.mock.calls[0]?.[1]);

1139+

const pairingText = String(sendMessageSpy.mock.calls.at(0)?.[1]);

11291140

expect(pairingText).toContain("Pairing code:");

11301141

expect(pairingText).toContain("<pre><code>");

11311142

expectRecordFields(

1132-

sendMessageSpy.mock.calls[0]?.[2],

1143+

sendMessageSpy.mock.calls.at(0)?.[2],

11331144

{ parse_mode: "HTML" },

11341145

"pairing reply options",

11351146

);

@@ -1247,11 +1258,11 @@ describe("createTelegramBot", () => {

12471258

expect(getFileSpy).not.toHaveBeenCalled();

12481259

expect(fetchSpy).not.toHaveBeenCalled();

12491260

expect(sendMessageSpy).toHaveBeenCalledTimes(1);

1250-

const pairingText = String(sendMessageSpy.mock.calls[0]?.[1]);

1261+

const pairingText = String(sendMessageSpy.mock.calls.at(0)?.[1]);

12511262

expect(pairingText).toContain("Pairing code:");

12521263

expect(pairingText).toContain("<pre><code>");

12531264

expectRecordFields(

1254-

sendMessageSpy.mock.calls[0]?.[2],

1265+

sendMessageSpy.mock.calls.at(0)?.[2],

12551266

{ parse_mode: "HTML" },

12561267

"album pairing reply options",

12571268

);

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

20042015

});

2005201620062017

expect(replySpy).toHaveBeenCalledTimes(1);

2007-

const payload = replySpy.mock.calls[0][0];

2018+

const payload = requireValue(replySpy.mock.calls.at(0), "replySpy call")[0];

20082019

expect(payload.AccountId).toBe("opie");

20092020

expect(payload.SessionKey).toBe("agent:opie:main");

20102021

});

@@ -2060,14 +2071,14 @@ describe("createTelegramBot", () => {

2060207120612072

await sendDm(42, "hello one");

20622073

expect(replySpy).toHaveBeenCalledTimes(1);

2063-

expect(replySpy.mock.calls[0]?.[0].AccountId).toBe("opie");

2064-

expect(replySpy.mock.calls[0]?.[0].SessionKey).toContain("agent:agent-a:");

2074+

expect(replySpy.mock.calls.at(0)?.[0].AccountId).toBe("opie");

2075+

expect(replySpy.mock.calls.at(0)?.[0].SessionKey).toContain("agent:agent-a:");

2065207620662077

boundAgentId = "agent-b";

20672078

await sendDm(43, "hello two");

20682079

expect(replySpy).toHaveBeenCalledTimes(2);

2069-

expect(replySpy.mock.calls[1]?.[0].AccountId).toBe("opie");

2070-

expect(replySpy.mock.calls[1]?.[0].SessionKey).toContain("agent:agent-b:");

2080+

expect(replySpy.mock.calls.at(1)?.[0].AccountId).toBe("opie");

2081+

expect(replySpy.mock.calls.at(1)?.[0].SessionKey).toContain("agent:agent-b:");

20712082

});

2072208320732084

it("reloads topic agent overrides between messages without recreating the bot", async () => {

@@ -2113,12 +2124,12 @@ describe("createTelegramBot", () => {

2113212421142125

await sendTopicMessage(301);

21152126

expect(replySpy).toHaveBeenCalledTimes(1);

2116-

expect(replySpy.mock.calls[0]?.[0].SessionKey).toContain("agent:topic-a:");

2127+

expect(replySpy.mock.calls.at(0)?.[0].SessionKey).toContain("agent:topic-a:");

2117212821182129

topicAgentId = "topic-b";

21192130

await sendTopicMessage(302);

21202131

expect(replySpy).toHaveBeenCalledTimes(2);

2121-

expect(replySpy.mock.calls[1]?.[0].SessionKey).toContain("agent:topic-b:");

2132+

expect(replySpy.mock.calls.at(1)?.[0].SessionKey).toContain("agent:topic-b:");

21222133

});

2123213421242135

it("routes non-default account DMs to the per-account fallback session without explicit bindings", async () => {

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

21582169

});

2159217021602171

expect(replySpy).toHaveBeenCalledTimes(1);

2161-

const payload = replySpy.mock.calls[0]?.[0];

2172+

const payload = requireValue(replySpy.mock.calls.at(0), "reply call")[0];

21622173

expect(payload.AccountId).toBe("opie");

21632174

expect(payload.SessionKey).toContain("agent:main:telegram:opie:");

21642175

});

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

23422353

},

23432354

});

23442355

expect(replySpy).toHaveBeenCalledTimes(1);

2345-

const payload = replySpy.mock.calls[0][0];

2356+

const payload = requireValue(replySpy.mock.calls.at(0), "replySpy call")[0];

23462357

expect(payload.SessionKey).toContain(testCase.expectedSessionKeyFragment);

23472358

expect(payload.BodyForAgent).toBe(testCase.text);

23482359

expect(payload.BodyForAgent).not.toContain("t.me/c/");

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

23752386

});

2376238723772388

expect(sendAnimationSpy).toHaveBeenCalledTimes(1);

2378-

const animationCall = requireValue(sendAnimationSpy.mock.calls[0], "animation send call");

2389+

const animationCall = requireValue(sendAnimationSpy.mock.calls.at(0), "animation send call");

23792390

expect(animationCall[0]).toBe("1234");

23802391

requireValue(animationCall[1], "animation payload");

23812392

expect(animationCall[2]).toEqual({

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

23852396

});

23862397

expect(sendPhotoSpy).not.toHaveBeenCalled();

23872398

expect(loadWebMedia).toHaveBeenCalledTimes(1);

2388-

expect(loadWebMedia.mock.calls[0]?.[0]).toBe("https://example.com/fun");

2399+

expect(loadWebMedia.mock.calls.at(0)?.[0]).toBe("https://example.com/fun");

23892400

});

2390240123912402

function resetHarnessSpies() {

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

24612472

});

2462247324632474

expect(replySpy.mock.calls.length, testCase.name).toBe(1);

2464-

const payload = replySpy.mock.calls[0][0];

2475+

const payload = requireValue(replySpy.mock.calls.at(0), "replySpy call")[0];

24652476

expect(payload.WasMentioned, testCase.name).toBe(true);

24662477

if (testCase.assertEnvelope) {

24672478

expect(payload.SenderName).toBe("Ada");

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

25072518

});

2508251925092520

expect(replySpy).toHaveBeenCalledTimes(1);

2510-

const payload = replySpy.mock.calls[0][0];

2521+

const payload = requireValue(replySpy.mock.calls.at(0), "replySpy call")[0];

25112522

expect(payload.SenderName).toBe("Ada Lovelace");

25122523

expect(payload.SenderId).toBe("99");

25132524

expect(payload.SenderUsername).toBe("ada");

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

2604261526052616

expect(replySpy.mock.calls.length, testCase.name).toBe(testCase.expectedReplyCount);

26062617

if (testCase.expectedWasMentioned != null) {

2607-

const payload = replySpy.mock.calls[0][0];

2618+

const payload = requireValue(replySpy.mock.calls.at(0), "replySpy call")[0];

26082619

expect(payload.WasMentioned, testCase.name).toBe(testCase.expectedWasMentioned);

26092620

}

26102621

}

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

26262637

});

2627263826282639

expect(replySpy).toHaveBeenCalledTimes(1);

2629-

const payload = replySpy.mock.calls[0][0];

2640+

const payload = requireValue(replySpy.mock.calls.at(0), "replySpy call")[0];

26302641

expect(payload.Body).toContain("[Reply chain - nearest first]");

26312642

expect(payload.Body).toContain("[1. Ada id:9001]");

26322643

expect(payload.Body).toContain("Can you summarize this?");

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

28742885

await handler(makeForumGroupMessageCtx({ threadId: testCase.threadId }));

2875288628762887

expect(sendMessageSpy.mock.calls.length, testCase.name).toBe(1);

2877-

const sendParams = sendMessageSpy.mock.calls[0]?.[2] as { message_thread_id?: number };

2888+

const sendParams = sendMessageSpy.mock.calls.at(0)?.[2] as { message_thread_id?: number };

28782889

if (testCase.expectedMessageThreadId == null) {

28792890

expect(sendParams?.message_thread_id, testCase.name).toBeUndefined();

28802891

} else {

@@ -3078,7 +3089,9 @@ describe("createTelegramBot", () => {

30783089

});

3079309030803091

expect(sendMessageSpy).toHaveBeenCalledTimes(1);

3081-

expect(sendMessageSpy.mock.calls[0][1]).toBe("PFX final reply");

3092+

expect(requireValue(sendMessageSpy.mock.calls.at(0), "sendMessageSpy call")[1]).toBe(

3093+

"PFX final reply",

3094+

);

30823095

});

3083309630843097

it("sends Codex usage-limit reset details as the Telegram reply body", async () => {

@@ -3104,11 +3117,15 @@ describe("createTelegramBot", () => {

31043117

});

3105311831063119

expect(sendMessageSpy).toHaveBeenCalledTimes(1);

3107-

expect(String(sendMessageSpy.mock.calls[0][0])).toBe("5");

3108-

expect(sendMessageSpy.mock.calls[0][1]).toBe(codexRateLimitText);

3109-

expect(String(sendMessageSpy.mock.calls[0][1])).not.toContain(

3110-

"All models are temporarily rate-limited",

3120+

expect(String(requireValue(sendMessageSpy.mock.calls.at(0), "sendMessageSpy call")[0])).toBe(

3121+

"5",

3122+

);

3123+

expect(requireValue(sendMessageSpy.mock.calls.at(0), "sendMessageSpy call")[1]).toBe(

3124+

codexRateLimitText,

31113125

);

3126+

expect(

3127+

String(requireValue(sendMessageSpy.mock.calls.at(0), "sendMessageSpy call")[1]),

3128+

).not.toContain("All models are temporarily rate-limited");

31123129

});

3113313031143131

it("honors threaded replies for replyToMode=first/all", async () => {

@@ -3271,14 +3288,16 @@ describe("createTelegramBot", () => {

3271328832723289

createTelegramBot({ token: "tok" });

32733290

expect(commandSpy).toHaveBeenCalled();

3274-

const handler = commandSpy.mock.calls[0][1] as (ctx: Record<string, unknown>) => Promise<void>;

3291+

const handler = requireValue(commandSpy.mock.calls.at(0), "commandSpy call")[1] as (

3292+

ctx: Record<string, unknown>,

3293+

) => Promise<void>;

3275329432763295

await handler({

32773296

...makeForumGroupMessageCtx({ threadId: 99, text: "/status" }),

32783297

match: "",

32793298

});

328032993281-

const statusCall = requireValue(sendMessageSpy.mock.calls[0], "status reply call");

3300+

const statusCall = requireValue(sendMessageSpy.mock.calls.at(0), "status reply call");

32823301

expect(statusCall[0]).toBe("-1001234567890");

32833302

expect(statusCall[1]).toBeTypeOf("string");

32843303

expectRecordFields(

@@ -3334,12 +3353,12 @@ describe("createTelegramBot", () => {

3334335333353354

await invokeStatus(401);

33363355

expect(replySpy).toHaveBeenCalledTimes(1);

3337-

expect(replySpy.mock.calls[0]?.[0].SessionKey).toContain("agent:agent-a:");

3356+

expect(replySpy.mock.calls.at(0)?.[0].SessionKey).toContain("agent:agent-a:");

3338335733393358

boundAgentId = "agent-b";

33403359

await invokeStatus(402);

33413360

expect(replySpy).toHaveBeenCalledTimes(2);

3342-

expect(replySpy.mock.calls[1]?.[0].SessionKey).toContain("agent:agent-b:");

3361+

expect(replySpy.mock.calls.at(1)?.[0].SessionKey).toContain("agent:agent-b:");

33433362

});

33443363

it("skips tool summaries for native slash commands", async () => {

33453364

commandSpy.mockClear();

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

33783397

});

3379339833803399

expect(sendMessageSpy).toHaveBeenCalledTimes(1);

3381-

expect(sendMessageSpy.mock.calls[0]?.[1]).toContain("final reply");

3400+

expect(sendMessageSpy.mock.calls.at(0)?.[1]).toContain("final reply");

33823401

});

33833402

it("dedupes duplicate message updates by update_id", async () => {

33843403

onSpy.mockReset();

@@ -3665,10 +3684,10 @@ describe("createTelegramBot", () => {

3665368436663685

expect(buildModelsProviderDataMock).toHaveBeenCalledTimes(2);

36673686

expect(editMessageTextSpy).toHaveBeenCalledTimes(1);

3668-

expect(editMessageTextSpy.mock.calls[0]?.[2]).toContain("Select a provider:");

3687+

expect(editMessageTextSpy.mock.calls.at(0)?.[2]).toContain("Select a provider:");

36693688

expect(

36703689

(

3671-

editMessageTextSpy.mock.calls[0]?.[3] as {

3690+

editMessageTextSpy.mock.calls.at(0)?.[3] as {

36723691

reply_markup?: { inline_keyboard?: unknown[][] };

36733692

}

36743693

)?.reply_markup?.inline_keyboard?.[0]?.[0],

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

3936395539373956

expect(editMessageReplyMarkupSpy).toHaveBeenCalledTimes(1);

39383957

expect(sendMessageSpy).toHaveBeenCalledTimes(1);

3939-

expect(sendMessageSpy.mock.calls[0]?.[1]).toContain("plugin bind approval");

3958+

expect(sendMessageSpy.mock.calls.at(0)?.[1]).toContain("plugin bind approval");

39403959

});

3941396039423961

it("retries exec approval callbacks after a bubbled resolution failure", async () => {