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

推荐订阅源

博客园_首页
H
Help Net Security
量子位
The Cloudflare Blog
博客园 - Franky
博客园 - 聂微东
博客园 - 司徒正美
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
罗磊的独立博客
GbyAI
GbyAI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
MongoDB | Blog
MongoDB | Blog

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): fall back for threadless completion delivery...
steipete · 2026-04-25 · via Recent Commits to openclaw:main

@@ -76,6 +76,43 @@ async function deliverSlackThreadAnnouncement(params: {

7676

});

7777

}

787879+

async function deliverDiscordDirectMessageCompletion(params: {

80+

callGateway: typeof runtimeCallGateway;

81+

sendMessage?: typeof runtimeSendMessage;

82+

internalEvents?: AgentInternalEvent[];

83+

}) {

84+

const origin = {

85+

channel: "discord",

86+

to: "dm:U123",

87+

accountId: "acct-1",

88+

};

89+

__testing.setDepsForTest({

90+

callGateway: params.callGateway,

91+

getRequesterSessionActivity: () => ({

92+

sessionId: "requester-session-dm",

93+

isActive: false,

94+

}),

95+

loadConfig: () => ({}) as never,

96+

...(params.sendMessage ? { sendMessage: params.sendMessage } : {}),

97+

});

98+99+

return deliverSubagentAnnouncement({

100+

requesterSessionKey: "agent:main:discord:dm:U123",

101+

targetRequesterSessionKey: "agent:main:discord:dm:U123",

102+

triggerMessage: "child done",

103+

steerMessage: "child done",

104+

requesterOrigin: origin,

105+

requesterSessionOrigin: origin,

106+

completionDirectOrigin: origin,

107+

directOrigin: origin,

108+

requesterIsSubagent: false,

109+

expectsCompletionMessage: true,

110+

bestEffortDeliver: true,

111+

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

112+

internalEvents: params.internalEvents,

113+

});

114+

}

115+79116

describe("resolveAnnounceOrigin threaded route targets", () => {

80117

it("preserves stored thread ids when requester origin omits one for the same chat", () => {

81118

expect(

@@ -332,6 +369,65 @@ describe("deliverSubagentAnnouncement completion delivery", () => {

332369

);

333370

});

334371372+

it("uses direct fallback for completion DMs without a thread id when announce-agent returns no visible output", async () => {

373+

const callGateway = createGatewayMock({

374+

result: {

375+

payloads: [],

376+

},

377+

});

378+

const sendMessage = createSendMessageMock();

379+

const result = await deliverDiscordDirectMessageCompletion({

380+

callGateway,

381+

sendMessage,

382+

internalEvents: [

383+

{

384+

type: "task_completion",

385+

source: "music_generation",

386+

childSessionKey: "music_generate:task-123",

387+

childSessionId: "task-123",

388+

announceType: "music generation task",

389+

taskLabel: "night-drive synthwave",

390+

status: "ok",

391+

statusLabel: "completed successfully",

392+

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

393+

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

394+

replyInstruction: "Deliver the generated music.",

395+

},

396+

],

397+

});

398+399+

expect(result).toEqual(

400+

expect.objectContaining({

401+

delivered: true,

402+

path: "direct-thread-fallback",

403+

}),

404+

);

405+

expect(callGateway).toHaveBeenCalledWith(

406+

expect.objectContaining({

407+

method: "agent",

408+

params: expect.objectContaining({

409+

deliver: true,

410+

channel: "discord",

411+

accountId: "acct-1",

412+

to: "dm:U123",

413+

threadId: undefined,

414+

}),

415+

}),

416+

);

417+

expect(sendMessage).toHaveBeenCalledWith(

418+

expect.objectContaining({

419+

channel: "discord",

420+

accountId: "acct-1",

421+

to: "dm:U123",

422+

threadId: undefined,

423+

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

424+

requesterSessionKey: "agent:main:discord:dm:U123",

425+

bestEffort: true,

426+

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

427+

}),

428+

);

429+

});

430+335431

it("keeps direct external delivery for non-completion announces", async () => {

336432

const callGateway = createGatewayMock();

337433

await deliverSlackThreadAnnouncement({