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

推荐订阅源

博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
美团技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
aimingoo的专栏
aimingoo的专栏
腾讯CDC
WordPress大学
WordPress大学
Apple Machine Learning Research
Apple Machine Learning Research
F
Fortinet All Blogs
G
Google Developers Blog
MongoDB | Blog
MongoDB | Blog
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
Engineering at Meta
Engineering at Meta
博客园_首页
B
Blog RSS Feed
D
Docker
M
MIT News - Artificial intelligence
爱范儿
爱范儿
I
InfoQ

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): dispatch MEDIA directives as attachments (...
vincentkoc · 2026-06-16 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -2845,6 +2845,23 @@ describe("dispatchTelegramMessage draft streaming", () => {

28452845

expectDeliveredReply(0, { text: undefined, mediaUrl: "https://example.com/a.png" });

28462846

});

28472847
2848+

it("sends standalone MEDIA directive final replies as media", async () => {

2849+

const { answerDraftStream } = setupDraftStreams({ answerMessageId: 2001 });

2850+

dispatchReplyWithBufferedBlockDispatcher.mockImplementation(async ({ dispatcherOptions }) => {

2851+

await dispatcherOptions.deliver({ text: "MEDIA:/tmp/reply-image.png" }, { kind: "final" });

2852+

return { queuedFinal: true };

2853+

});

2854+
2855+

await dispatchWithContext({ context: createContext() });

2856+
2857+

expect(answerDraftStream.update).not.toHaveBeenCalledWith("MEDIA:/tmp/reply-image.png");

2858+

expectDeliveredReply(0, {

2859+

text: "",

2860+

mediaUrl: "/tmp/reply-image.png",

2861+

mediaUrls: ["/tmp/reply-image.png"],

2862+

});

2863+

});

2864+
28482865

it("attaches interactive buttons to streamed text when late media arrives", async () => {

28492866

const { answerDraftStream } = setupDraftStreams({ answerMessageId: 2001 });

28502867

dispatchReplyWithBufferedBlockDispatcher.mockImplementation(

Original file line numberDiff line numberDiff line change

@@ -1620,6 +1620,15 @@ export const dispatchTelegramMessage = async ({

16201620

}

16211621

return { ...payload, replyToId: implicitQuoteReplyTargetId };

16221622

};

1623+

const normalizeDeliveryPayload = (payload: ReplyPayload): ReplyPayload | undefined => {

1624+

return projectOutboundPayloadPlanForDelivery(

1625+

createOutboundPayloadPlan([payload], {

1626+

cfg,

1627+

sessionKey: ctxPayload.SessionKey,

1628+

surface: "telegram",

1629+

}),

1630+

)[0];

1631+

};

16231632

const usesNativeTelegramQuote = (payload: ReplyPayload): boolean => {

16241633

if (replyQuoteText != null) {

16251634

return true;

@@ -1961,10 +1970,14 @@ export const dispatchTelegramMessage = async ({

19611970

return;

19621971

}

19631972
1973+

const normalizedPayload = normalizeDeliveryPayload(payload);

1974+

if (!normalizedPayload) {

1975+

return;

1976+

}

19641977

const deduped =

19651978

info.kind === "final"

1966-

? deduplicateBlockSentMedia(payload, sentBlockMediaUrls)

1967-

: payload;

1979+

? deduplicateBlockSentMedia(normalizedPayload, sentBlockMediaUrls)

1980+

: normalizedPayload;

19681981

if (deduped === undefined) {

19691982

return;

19701983

}

@@ -1974,7 +1987,7 @@ export const dispatchTelegramMessage = async ({

19741987

shouldSuppressLocalTelegramExecApprovalPrompt({

19751988

cfg,

19761989

accountId: route.accountId,

1977-

payload,

1990+

payload: effectivePayload,

19781991

})

19791992

) {

19801993

queuedFinal = true;

@@ -2196,8 +2209,12 @@ export const dispatchTelegramMessage = async ({

21962209

}

21972210

}

21982211

const trackBlockMedia = (delivered: boolean) => {

2199-

if (delivered && info.kind === "block" && payload.mediaUrls?.length) {

2200-

for (const url of payload.mediaUrls) {

2212+

if (

2213+

delivered &&

2214+

info.kind === "block" &&

2215+

effectivePayload.mediaUrls?.length

2216+

) {

2217+

for (const url of effectivePayload.mediaUrls) {

22012218

sentBlockMediaUrls.add(url);

22022219

}

22032220

}