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

推荐订阅源

爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
Y
Y Combinator Blog
I
InfoQ
美团技术团队
罗磊的独立博客
B
Blog RSS Feed
GbyAI
GbyAI
小众软件
小众软件
IT之家
IT之家
Engineering at Meta
Engineering at Meta
Blog — PlanetScale
Blog — PlanetScale
V
V2EX
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
Jina AI
Jina AI
MyScale Blog
MyScale Blog
博客园 - 聂微东
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
Apple Machine Learning Research
Apple Machine Learning Research
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss

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: forward chat images to acp dispatch · openclaw/openc...
steipete · 2026-04-24 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -75,3 +75,17 @@ export async function resolveAcpAttachments(params: {

7575

}

7676

return results;

7777

}

78+
79+

export function resolveAcpInlineImageAttachments(

80+

images: Array<{ data: string; mimeType: string }> | undefined,

81+

): AcpTurnAttachment[] {

82+

if (!Array.isArray(images)) {

83+

return [];

84+

}

85+

return images

86+

.map((image) => ({

87+

mediaType: image.mimeType,

88+

data: image.data,

89+

}))

90+

.filter((image) => image.mediaType.startsWith("image/") && image.data.trim().length > 0);

91+

}

Original file line numberDiff line numberDiff line change

@@ -414,6 +414,32 @@ describe("createAcpDispatchDeliveryCoordinator", () => {

414414

);

415415

});

416416
417+

it("mirrors routed ACP replies into the target ACP session", async () => {

418+

const coordinator = createAcpDispatchDeliveryCoordinator({

419+

cfg: createAcpTestConfig(),

420+

ctx: buildTestCtx({

421+

Provider: "visiblechat",

422+

Surface: "visiblechat",

423+

SessionKey: "agent:main:main",

424+

}),

425+

dispatcher: createDispatcher(),

426+

inboundAudio: false,

427+

sessionKey: "agent:claude:acp:spawned",

428+

shouldRouteToOriginating: true,

429+

originatingChannel: "visiblechat",

430+

originatingTo: "channel:thread-1",

431+

});

432+
433+

await coordinator.deliver("block", { text: "hello" }, { skipTts: true });

434+
435+

expect(deliveryMocks.routeReply).toHaveBeenCalledWith(

436+

expect.objectContaining({

437+

sessionKey: "agent:claude:acp:spawned",

438+

policySessionKey: "agent:main:main",

439+

}),

440+

);

441+

});

442+
417443

it("routes ACP replies when cfg.channels is missing", async () => {

418444

await expectVisibleChatBlockRoutesToAccount({} as OpenClawConfig, undefined);

419445

});

Original file line numberDiff line numberDiff line change

@@ -156,6 +156,7 @@ export function createAcpDispatchDeliveryCoordinator(params: {

156156

ctx: FinalizedMsgContext;

157157

dispatcher: ReplyDispatcher;

158158

inboundAudio: boolean;

159+

sessionKey?: string;

159160

sessionTtsAuto?: TtsAutoMode;

160161

ttsChannel?: string;

161162

suppressUserDelivery?: boolean;

@@ -182,6 +183,7 @@ export function createAcpDispatchDeliveryCoordinator(params: {

182183

};

183184

const directChannel = normalizeOptionalLowercaseString(params.ctx.Provider ?? params.ctx.Surface);

184185

const routedChannel = normalizeOptionalLowercaseString(params.originatingChannel);

186+

const deliverySessionKey = normalizeOptionalString(params.sessionKey) ?? params.ctx.SessionKey;

185187

const explicitAccountId = normalizeOptionalString(params.ctx.AccountId);

186188

const resolvedAccountId =

187189

explicitAccountId ??

@@ -319,7 +321,10 @@ export function createAcpDispatchDeliveryCoordinator(params: {

319321

payload: ttsPayload,

320322

channel: params.originatingChannel,

321323

to: params.originatingTo,

322-

sessionKey: params.ctx.SessionKey,

324+

sessionKey: deliverySessionKey,

325+

...(deliverySessionKey !== params.ctx.SessionKey

326+

? { policySessionKey: params.ctx.SessionKey }

327+

: {}),

323328

accountId: resolvedAccountId,

324329

requesterSenderId: params.ctx.SenderId,

325330

requesterSenderName: params.ctx.SenderName,

Original file line numberDiff line numberDiff line change

@@ -8,7 +8,10 @@ import type { OpenClawConfig } from "../../config/config.js";

88

import type { SessionBindingRecord } from "../../infra/outbound/session-binding-service.js";

99

import type { MediaUnderstandingSkipError } from "../../media-understanding/errors.js";

1010

import { withFetchPreconnect } from "../../test-utils/fetch-mock.js";

11-

import { resolveAcpAttachments } from "./dispatch-acp-attachments.js";

11+

import {

12+

resolveAcpAttachments,

13+

resolveAcpInlineImageAttachments,

14+

} from "./dispatch-acp-attachments.js";

1215

import { tryDispatchAcpReply } from "./dispatch-acp.js";

1316

import type { ReplyDispatcher } from "./reply-dispatcher.js";

1417

import { buildTestCtx } from "./test-ctx.js";

@@ -210,6 +213,7 @@ async function runDispatch(params: {

210213

originatingChannel?: string;

211214

originatingTo?: string;

212215

onReplyStart?: () => void;

216+

images?: Array<{ data: string; mimeType: string }>;

213217

ctxOverrides?: Record<string, unknown>;

214218

sessionKeyOverride?: string;

215219

}) {

@@ -225,6 +229,7 @@ async function runDispatch(params: {

225229

cfg: params.cfg ?? createAcpTestConfig(),

226230

dispatcher: params.dispatcher ?? createDispatcher().dispatcher,

227231

sessionKey: targetSessionKey,

232+

images: params.images,

228233

inboundAudio: false,

229234

shouldRouteToOriginating: params.shouldRouteToOriginating ?? false,

230235

...(params.shouldRouteToOriginating

@@ -545,6 +550,38 @@ describe("tryDispatchAcpReply", () => {

545550

}

546551

});

547552
553+

it("forwards chat.send inline image attachments into ACP turns", async () => {

554+

setReadyAcpResolution();

555+

const image = {

556+

mimeType: "image/png",

557+

data: Buffer.from("image-bytes").toString("base64"),

558+

};

559+
560+

expect(resolveAcpInlineImageAttachments([image])).toEqual([

561+

{

562+

mediaType: "image/png",

563+

data: image.data,

564+

},

565+

]);

566+
567+

await runDispatch({

568+

bodyForAgent: "describe image",

569+

images: [image],

570+

});

571+
572+

expect(managerMocks.runTurn).toHaveBeenCalledWith(

573+

expect.objectContaining({

574+

text: "describe image",

575+

attachments: [

576+

{

577+

mediaType: "image/png",

578+

data: image.data,

579+

},

580+

],

581+

}),

582+

);

583+

});

584+
548585

it("skips ACP attachments outside allowed inbound roots", async () => {

549586

setReadyAcpResolution();

550587

const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "dispatch-acp-"));

Original file line numberDiff line numberDiff line change

@@ -23,7 +23,11 @@ import { resolveStatusTtsSnapshot } from "../../tts/status-config.js";

2323

import { resolveConfiguredTtsMode } from "../../tts/tts-config.js";

2424

import type { FinalizedMsgContext } from "../templating.js";

2525

import { createAcpReplyProjector } from "./acp-projector.js";

26-

import { loadDispatchAcpMediaRuntime, resolveAcpAttachments } from "./dispatch-acp-attachments.js";

26+

import {

27+

loadDispatchAcpMediaRuntime,

28+

resolveAcpAttachments,

29+

resolveAcpInlineImageAttachments,

30+

} from "./dispatch-acp-attachments.js";

2731

import {

2832

createAcpDispatchDeliveryCoordinator,

2933

type AcpDispatchDeliveryCoordinator,

@@ -265,6 +269,7 @@ export async function tryDispatchAcpReply(params: {

265269

dispatcher: ReplyDispatcher;

266270

runId?: string;

267271

sessionKey?: string;

272+

images?: Array<{ data: string; mimeType: string }>;

268273

abortSignal?: AbortSignal;

269274

inboundAudio: boolean;

270275

sessionTtsAuto?: TtsAutoMode;

@@ -301,6 +306,7 @@ export async function tryDispatchAcpReply(params: {

301306

ctx: params.ctx,

302307

dispatcher: params.dispatcher,

303308

inboundAudio: params.inboundAudio,

309+

sessionKey: canonicalSessionKey,

304310

sessionTtsAuto: params.sessionTtsAuto,

305311

ttsChannel: params.ttsChannel,

306312

suppressUserDelivery: params.suppressUserDelivery,

@@ -400,9 +406,13 @@ export async function tryDispatchAcpReply(params: {

400406

}

401407
402408

const promptText = resolveAcpPromptText(params.ctx);

403-

const attachments = hasInboundMedia(params.ctx)

409+

const mediaAttachments = hasInboundMedia(params.ctx)

404410

? await resolveAcpAttachments({ ctx: params.ctx, cfg: params.cfg })

405411

: [];

412+

const attachments =

413+

mediaAttachments.length > 0

414+

? mediaAttachments

415+

: resolveAcpInlineImageAttachments(params.images);

406416

if (!promptText && attachments.length === 0) {

407417

const counts = params.dispatcher.getQueuedCounts();

408418

delivery.applyRoutedCounts(counts);

Original file line numberDiff line numberDiff line change

@@ -708,6 +708,7 @@ export async function dispatchReplyFromConfig(

708708

ctx,

709709

runId: params.replyOptions?.runId,

710710

sessionKey: acpDispatchSessionKey,

711+

images: params.replyOptions?.images,

711712

inboundAudio,

712713

sessionTtsAuto,

713714

ttsChannel,

@@ -1036,6 +1037,7 @@ export async function dispatchReplyFromConfig(

10361037

ctx,

10371038

runId: params.replyOptions?.runId,

10381039

sessionKey: acpDispatchSessionKey,

1040+

images: params.replyOptions?.images,

10391041

inboundAudio,

10401042

sessionTtsAuto,

10411043

ttsChannel,

Original file line numberDiff line numberDiff line change

@@ -598,6 +598,40 @@ describe("createFollowupRunner runtime config", () => {

598598

agentAccountId: "bot-account",

599599

});

600600

});

601+
602+

it("passes queued images into queued embedded followup runs", async () => {

603+

runEmbeddedPiAgentMock.mockResolvedValueOnce({

604+

payloads: [],

605+

meta: {},

606+

});

607+

const images = [{ type: "image" as const, data: "base64-cat", mimeType: "image/png" }];

608+

const imageOrder = ["inline" as const];

609+

const runner = createFollowupRunner({

610+

typing: createMockTypingController(),

611+

typingMode: "instant",

612+

defaultModel: "openai/gpt-5.4",

613+

opts: {

614+

images: [{ type: "image", data: "fallback", mimeType: "image/png" }],

615+

imageOrder: ["inline"],

616+

},

617+

});

618+
619+

await runner(

620+

createQueuedRun({

621+

images,

622+

imageOrder,

623+

}),

624+

);

625+
626+

const call = runEmbeddedPiAgentMock.mock.calls.at(-1)?.[0] as

627+

| {

628+

images?: unknown;

629+

imageOrder?: unknown;

630+

}

631+

| undefined;

632+

expect(call?.images).toBe(images);

633+

expect(call?.imageOrder).toBe(imageOrder);

634+

});

601635

});

602636
603637

describe("createFollowupRunner compaction", () => {

Original file line numberDiff line numberDiff line change

@@ -135,6 +135,8 @@ export function createFollowupRunner(params: {

135135

};

136136
137137

return async (queued: FollowupRun) => {

138+

const queuedImages = queued.images ?? opts?.images;

139+

const queuedImageOrder = queued.imageOrder ?? opts?.imageOrder;

138140

queued.run.config = await resolveQueuedReplyExecutionConfig(queued.run.config, {

139141

originatingChannel: queued.originatingChannel,

140142

messageProvider: queued.run.messageProvider,

@@ -253,6 +255,8 @@ export function createFollowupRunner(params: {

253255

bashElevated: run.bashElevated,

254256

timeoutMs: run.timeoutMs,

255257

runId,

258+

images: queuedImages,

259+

imageOrder: queuedImageOrder,

256260

allowTransientCooldownProbe: runOptions?.allowTransientCooldownProbe,

257261

blockReplyBreak: run.blockReplyBreak,

258262

bootstrapPromptWarningSignaturesSeen,

Original file line numberDiff line numberDiff line change

@@ -684,6 +684,8 @@ export async function runPreparedReply(

684684

messageId: sessionCtx.MessageSidFull ?? sessionCtx.MessageSid,

685685

summaryLine: baseBodyTrimmedRaw,

686686

enqueuedAt: Date.now(),

687+

images: opts?.images,

688+

imageOrder: opts?.imageOrder,

687689

// Originating channel for reply routing.

688690

originatingChannel: ctx.OriginatingChannel,

689691

originatingTo: ctx.OriginatingTo,

Original file line numberDiff line numberDiff line change

@@ -95,6 +95,57 @@ describe("followup queue collect routing", () => {

9595

expect(calls[0]?.originatingTo).toBe("channel:A");

9696

});

9797
98+

it("carries image payloads across collected batches", async () => {

99+

const key = `test-collect-images-${Date.now()}`;

100+

const calls: FollowupRun[] = [];

101+

const done = createDeferred<void>();

102+

const runFollowup = async (run: FollowupRun) => {

103+

calls.push(run);

104+

done.resolve();

105+

};

106+

const settings: QueueSettings = {

107+

mode: "collect",

108+

debounceMs: 0,

109+

cap: 50,

110+

dropPolicy: "summarize",

111+

};

112+

const firstImage = { type: "image" as const, data: "first", mimeType: "image/png" };

113+

const secondImage = { type: "image" as const, data: "second", mimeType: "image/png" };

114+
115+

enqueueFollowupRun(

116+

key,

117+

{

118+

...createRun({

119+

prompt: "one",

120+

originatingChannel: "slack",

121+

originatingTo: "channel:A",

122+

}),

123+

images: [firstImage],

124+

imageOrder: ["inline"],

125+

},

126+

settings,

127+

);

128+

enqueueFollowupRun(

129+

key,

130+

{

131+

...createRun({

132+

prompt: "two",

133+

originatingChannel: "slack",

134+

originatingTo: "channel:A",

135+

}),

136+

images: [secondImage],

137+

imageOrder: ["inline"],

138+

},

139+

settings,

140+

);

141+
142+

scheduleFollowupDrain(key, runFollowup);

143+

await done.promise;

144+
145+

expect(calls[0]?.images).toEqual([firstImage, secondImage]);

146+

expect(calls[0]?.imageOrder).toEqual(["inline", "inline"]);

147+

});

148+
98149

it("splits collect batches when sender authorization changes", async () => {

99150

const key = `test-collect-auth-split-${Date.now()}`;

100151

const calls: FollowupRun[] = [];