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

推荐订阅源

雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
V
V2EX
T
The Blog of Author Tim Ferriss
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Hugging Face - Blog
Hugging Face - Blog
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
Recent Announcements
Recent Announcements
Vercel News
Vercel News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tailwind CSS Blog
美团技术团队
Martin Fowler
Martin Fowler
宝玉的分享
宝玉的分享
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks

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(telegram): prove edited message context · openclaw/o...
obviyus · 2026-05-11 · via Recent Commits to openclaw:main

@@ -1681,6 +1681,103 @@ describe("createTelegramBot", () => {

16811681

expect(messagesById.get("201")?.body).toBe("After the incident review.");

16821682

});

168316831684+

it("updates cached bot messages from Telegram edit updates", async () => {

1685+

onSpy.mockClear();

1686+

replySpy.mockClear();

1687+1688+

loadConfig.mockReturnValue({

1689+

agents: {

1690+

defaults: {

1691+

envelopeTimezone: "utc",

1692+

},

1693+

},

1694+

channels: {

1695+

telegram: {

1696+

groupPolicy: "open",

1697+

groups: { "*": { requireMention: false } },

1698+

},

1699+

},

1700+

});

1701+1702+

createTelegramBot({ token: "tok" });

1703+

const handler = getOnHandler("message") as (ctx: Record<string, unknown>) => Promise<void>;

1704+

const editedHandler = getOnHandler("edited_message") as (

1705+

ctx: Record<string, unknown>,

1706+

) => Promise<void>;

1707+

const baseCtx = {

1708+

me: { id: 999, username: "openclaw_bot" },

1709+

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

1710+

};

1711+

const chat = { id: 42, type: "group", title: "Ops" };

1712+

const question = {

1713+

chat,

1714+

text: "/ask which bikes can reach 383kmph",

1715+

date: 1778474813,

1716+

message_id: 35014,

1717+

from: { id: 201, is_bot: false, first_name: "Kesava" },

1718+

};

1719+

const fullAnswer =

1720+

"Kawasaki Ninja H2R (claimed 400 km/h) and MTT 420RR turbine (claimed up to 439 km/h) exceed 383 km/h. Dodge Tomahawk reaches higher but is a 4-wheeled concept, not a standard bike.";

1721+1722+

await handler({

1723+

...baseCtx,

1724+

message: question,

1725+

});

1726+

await handler({

1727+

...baseCtx,

1728+

message: {

1729+

chat,

1730+

text: "K",

1731+

date: 1778474823,

1732+

message_id: 35016,

1733+

from: { id: 777, is_bot: true, first_name: "Super Serious Bot" },

1734+

reply_to_message: question,

1735+

},

1736+

});

1737+1738+

replySpy.mockClear();

1739+

await editedHandler({

1740+

...baseCtx,

1741+

editedMessage: {

1742+

chat,

1743+

text: fullAnswer,

1744+

date: 1778474823,

1745+

edit_date: 1778474824,

1746+

message_id: 35016,

1747+

from: { id: 777, is_bot: true, first_name: "Super Serious Bot" },

1748+

reply_to_message: question,

1749+

},

1750+

});

1751+

expect(replySpy).not.toHaveBeenCalled();

1752+1753+

await handler({

1754+

...baseCtx,

1755+

message: {

1756+

chat,

1757+

text: "wtf",

1758+

date: 1778474850,

1759+

message_id: 35018,

1760+

from: { id: 202, is_bot: false, first_name: "Kesava" },

1761+

},

1762+

});

1763+1764+

expect(replySpy).toHaveBeenCalledTimes(1);

1765+

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

1766+

const [conversationContext] = requireArray(

1767+

payload.UntrustedStructuredContext,

1768+

"structured context",

1769+

);

1770+

const contextRecord = requireRecord(conversationContext, "conversation context");

1771+

const contextPayload = requireRecord(contextRecord.payload, "conversation context payload");

1772+

const messages = requireArray(contextPayload.messages, "conversation context messages").map(

1773+

(message, index) => requireRecord(message, `conversation context message ${index + 1}`),

1774+

);

1775+

const messagesById = new Map(messages.map((message) => [message.message_id, message]));

1776+

expect(messagesById.get("35016")?.sender).toBe("Super Serious Bot");

1777+

expect(messagesById.get("35016")?.body).toBe(fullAnswer);

1778+

expect(messagesById.get("35016")?.body).not.toBe("K");

1779+

});

1780+16841781

it("uses quote text when a Telegram partial reply is received", async () => {

16851782

onSpy.mockClear();

16861783

sendMessageSpy.mockClear();