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

推荐订阅源

WordPress大学
WordPress大学
博客园 - 司徒正美
I
InfoQ
宝玉的分享
宝玉的分享
G
Google Developers Blog
J
Java Code Geeks
Martin Fowler
Martin Fowler
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
罗磊的独立博客
腾讯CDC
F
Fortinet All Blogs
A
About on SuperTechFans
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Recent Announcements
Recent Announcements
Last Week in AI
Last Week in AI
B
Blog RSS Feed
博客园 - 聂微东
D
DataBreaches.Net
Hugging Face - Blog
Hugging Face - Blog
The Cloudflare Blog
L
LangChain Blog
Microsoft Azure Blog
Microsoft Azure Blog
aimingoo的专栏
aimingoo的专栏

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): fallback subagent completion delivery · open...
vincentkoc · 2026-04-26 · via Recent Commits to openclaw:main

@@ -115,6 +115,48 @@ async function deliverDiscordDirectMessageCompletion(params: {

115115

});

116116

}

117117118+

async function deliverTelegramDirectMessageCompletion(params: {

119+

callGateway: typeof runtimeCallGateway;

120+

sendMessage?: typeof runtimeSendMessage;

121+

internalEvents?: AgentInternalEvent[];

122+

isActive?: boolean;

123+

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

124+

}) {

125+

const origin = {

126+

channel: "telegram",

127+

to: "123456789",

128+

accountId: "bot-1",

129+

};

130+

__testing.setDepsForTest({

131+

callGateway: params.callGateway,

132+

getRequesterSessionActivity: () => ({

133+

sessionId: "requester-session-telegram",

134+

isActive: params.isActive === true,

135+

}),

136+

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

137+

...(params.queueEmbeddedPiMessage

138+

? { queueEmbeddedPiMessage: params.queueEmbeddedPiMessage }

139+

: {}),

140+

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

141+

});

142+143+

return deliverSubagentAnnouncement({

144+

requesterSessionKey: "agent:main:telegram:123456789",

145+

targetRequesterSessionKey: "agent:main:telegram:123456789",

146+

triggerMessage: "child done",

147+

steerMessage: "child done",

148+

requesterOrigin: origin,

149+

requesterSessionOrigin: origin,

150+

completionDirectOrigin: origin,

151+

directOrigin: origin,

152+

requesterIsSubagent: false,

153+

expectsCompletionMessage: true,

154+

bestEffortDeliver: true,

155+

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

156+

internalEvents: params.internalEvents,

157+

});

158+

}

159+118160

async function deliverSlackChannelAnnouncement(params: {

119161

callGateway: typeof runtimeCallGateway;

120162

isActive: boolean;

@@ -510,6 +552,92 @@ describe("deliverSubagentAnnouncement completion delivery", () => {

510552

);

511553

});

512554555+

it("uses direct fallback for Telegram DMs when announce-agent delivery fails", async () => {

556+

const callGateway = vi.fn(async () => {

557+

throw new Error("UNAVAILABLE: requester wake failed");

558+

}) as unknown as typeof runtimeCallGateway;

559+

const sendMessage = createSendMessageMock();

560+

const result = await deliverTelegramDirectMessageCompletion({

561+

callGateway,

562+

sendMessage,

563+

internalEvents: [

564+

{

565+

type: "task_completion",

566+

source: "subagent",

567+

childSessionKey: "agent:worker:subagent:child",

568+

childSessionId: "child-session-id",

569+

announceType: "subagent task",

570+

taskLabel: "telegram completion smoke",

571+

status: "ok",

572+

statusLabel: "completed successfully",

573+

result: "child completion output",

574+

replyInstruction: "Summarize the result.",

575+

},

576+

],

577+

});

578+579+

expect(result).toEqual(

580+

expect.objectContaining({

581+

delivered: true,

582+

path: "direct-fallback",

583+

}),

584+

);

585+

expect(sendMessage).toHaveBeenCalledWith(

586+

expect.objectContaining({

587+

channel: "telegram",

588+

accountId: "bot-1",

589+

to: "123456789",

590+

threadId: undefined,

591+

content: "child completion output",

592+

requesterSessionKey: "agent:main:telegram:123456789",

593+

bestEffort: true,

594+

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

595+

}),

596+

);

597+

});

598+599+

it("uses direct fallback when an active Telegram requester cannot be woken", async () => {

600+

const callGateway = createGatewayMock();

601+

const sendMessage = createSendMessageMock();

602+

const queueEmbeddedPiMessage = vi.fn(() => false);

603+

const result = await deliverTelegramDirectMessageCompletion({

604+

callGateway,

605+

sendMessage,

606+

isActive: true,

607+

queueEmbeddedPiMessage,

608+

internalEvents: [

609+

{

610+

type: "task_completion",

611+

source: "subagent",

612+

childSessionKey: "agent:worker:subagent:child",

613+

childSessionId: "child-session-id",

614+

announceType: "subagent task",

615+

taskLabel: "telegram wake smoke",

616+

status: "ok",

617+

statusLabel: "completed successfully",

618+

result: "child completion output",

619+

replyInstruction: "Summarize the result.",

620+

},

621+

],

622+

});

623+624+

expect(result).toEqual(

625+

expect.objectContaining({

626+

delivered: true,

627+

path: "direct-fallback",

628+

}),

629+

);

630+

expect(queueEmbeddedPiMessage).toHaveBeenCalledWith("requester-session-telegram", "child done");

631+

expect(callGateway).not.toHaveBeenCalled();

632+

expect(sendMessage).toHaveBeenCalledWith(

633+

expect.objectContaining({

634+

channel: "telegram",

635+

to: "123456789",

636+

content: "child completion output",

637+

}),

638+

);

639+

});

640+513641

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

514642

const callGateway = createGatewayMock({

515643

result: {