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

推荐订阅源

V
Visual Studio Blog
爱范儿
爱范儿
GbyAI
GbyAI
博客园 - 叶小钗
Last Week in AI
Last Week in AI
Jina AI
Jina AI
Microsoft Security Blog
Microsoft Security Blog
云风的 BLOG
云风的 BLOG
C
Check Point Blog
H
Help Net Security
P
Proofpoint News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
大猫的无限游戏
大猫的无限游戏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog RSS Feed
Y
Y Combinator Blog
U
Unit 42
T
Tailwind CSS Blog
MyScale Blog
MyScale Blog
N
Netflix TechBlog - Medium
S
SegmentFault 最新的问题
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
fix(agents): mediate async media completions · openclaw/o...
steipete · 2026-05-05 · via Recent Commits to openclaw:main

@@ -60,6 +60,7 @@ async function deliverSlackThreadAnnouncement(params: {

6060

queueEmbeddedPiMessage?: (sessionId: string, message: string) => boolean;

6161

sendMessage?: typeof runtimeSendMessage;

6262

internalEvents?: AgentInternalEvent[];

63+

sourceTool?: string;

6364

}) {

6465

__testing.setDepsForTest({

6566

callGateway: params.callGateway,

@@ -88,13 +89,15 @@ async function deliverSlackThreadAnnouncement(params: {

8889

bestEffortDeliver: true,

8990

directIdempotencyKey: params.directIdempotencyKey,

9091

internalEvents: params.internalEvents,

92+

sourceTool: params.sourceTool,

9193

});

9294

}

93959496

async function deliverDiscordDirectMessageCompletion(params: {

9597

callGateway: typeof runtimeCallGateway;

9698

sendMessage?: typeof runtimeSendMessage;

9799

internalEvents?: AgentInternalEvent[];

100+

sourceTool?: string;

98101

}) {

99102

const origin = {

100103

channel: "discord",

@@ -125,6 +128,7 @@ async function deliverDiscordDirectMessageCompletion(params: {

125128

bestEffortDeliver: true,

126129

directIdempotencyKey: "announce-dm-fallback-empty",

127130

internalEvents: params.internalEvents,

131+

sourceTool: params.sourceTool,

128132

});

129133

}

130134

@@ -185,6 +189,7 @@ async function deliverSlackChannelAnnouncement(params: {

185189

queueEmbeddedPiMessage?: (sessionId: string, message: string) => boolean;

186190

sendMessage?: typeof runtimeSendMessage;

187191

internalEvents?: AgentInternalEvent[];

192+

sourceTool?: string;

188193

}) {

189194

const origin = {

190195

channel: "slack",

@@ -219,6 +224,7 @@ async function deliverSlackChannelAnnouncement(params: {

219224

bestEffortDeliver: true,

220225

directIdempotencyKey: params.directIdempotencyKey,

221226

internalEvents: params.internalEvents,

227+

sourceTool: params.sourceTool,

222228

});

223229

}

224230

@@ -1141,6 +1147,119 @@ describe("deliverSubagentAnnouncement completion delivery", () => {

11411147

expect(sendMessage).not.toHaveBeenCalled();

11421148

});

114311491150+

it("delivers generated media completions through the announce agent in automatic DMs", async () => {

1151+

const callGateway = createGatewayMock({

1152+

result: {

1153+

payloads: [

1154+

{

1155+

text: "The track is ready.",

1156+

mediaUrls: ["/tmp/generated-night-drive.mp3"],

1157+

},

1158+

],

1159+

},

1160+

});

1161+

const sendMessage = createSendMessageMock();

1162+

const result = await deliverDiscordDirectMessageCompletion({

1163+

callGateway,

1164+

sendMessage,

1165+

sourceTool: "music_generate",

1166+

internalEvents: [

1167+

{

1168+

type: "task_completion",

1169+

source: "music_generation",

1170+

childSessionKey: "music_generate:task-123",

1171+

childSessionId: "task-123",

1172+

announceType: "music generation task",

1173+

taskLabel: "night-drive synthwave",

1174+

status: "ok",

1175+

statusLabel: "completed successfully",

1176+

result: "Generated 1 track.\nMEDIA:/tmp/generated-night-drive.mp3",

1177+

mediaUrls: ["/tmp/generated-night-drive.mp3"],

1178+

replyInstruction:

1179+

"Tell the user the music is ready. If visible source delivery requires the message tool, send it there with the generated media attached.",

1180+

},

1181+

],

1182+

});

1183+1184+

expect(result).toEqual(

1185+

expect.objectContaining({

1186+

delivered: true,

1187+

path: "direct",

1188+

}),

1189+

);

1190+

expect(callGateway).toHaveBeenCalledWith(

1191+

expect.objectContaining({

1192+

method: "agent",

1193+

params: expect.objectContaining({

1194+

deliver: true,

1195+

channel: "discord",

1196+

accountId: "acct-1",

1197+

to: "dm:U123",

1198+

threadId: undefined,

1199+

}),

1200+

}),

1201+

);

1202+

expect(sendMessage).not.toHaveBeenCalled();

1203+

});

1204+1205+

it("requires message-tool delivery for generated media completions in default group routes", async () => {

1206+

const callGateway = createGatewayMock({

1207+

result: {

1208+

payloads: [

1209+

{

1210+

text: "The track is ready.",

1211+

},

1212+

],

1213+

},

1214+

});

1215+

const sendMessage = createSendMessageMock();

1216+

const result = await deliverSlackChannelAnnouncement({

1217+

callGateway,

1218+

sendMessage,

1219+

sessionId: "requester-session-channel",

1220+

isActive: false,

1221+

expectsCompletionMessage: true,

1222+

directIdempotencyKey: "announce-channel-media-message-tool",

1223+

sourceTool: "music_generate",

1224+

internalEvents: [

1225+

{

1226+

type: "task_completion",

1227+

source: "music_generation",

1228+

childSessionKey: "music_generate:task-123",

1229+

childSessionId: "task-123",

1230+

announceType: "music generation task",

1231+

taskLabel: "night-drive synthwave",

1232+

status: "ok",

1233+

statusLabel: "completed successfully",

1234+

result: "Generated 1 track.\nMEDIA:/tmp/generated-night-drive.mp3",

1235+

mediaUrls: ["/tmp/generated-night-drive.mp3"],

1236+

replyInstruction:

1237+

"Tell the user the music is ready. If visible source delivery requires the message tool, send it there with the generated media attached.",

1238+

},

1239+

],

1240+

});

1241+1242+

expect(result).toEqual(

1243+

expect.objectContaining({

1244+

delivered: false,

1245+

path: "direct",

1246+

}),

1247+

);

1248+

expect(callGateway).toHaveBeenCalledWith(

1249+

expect.objectContaining({

1250+

method: "agent",

1251+

params: expect.objectContaining({

1252+

deliver: false,

1253+

channel: "slack",

1254+

accountId: "acct-1",

1255+

to: "channel:C123",

1256+

threadId: undefined,

1257+

}),

1258+

}),

1259+

);

1260+

expect(sendMessage).not.toHaveBeenCalled();

1261+

});

1262+11441263

it("uses a direct channel fallback when announce-agent returns no visible output", async () => {

11451264

const callGateway = createGatewayMock({

11461265

result: {