Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

πŸ› fix(hetero): steer uploaded images into connected Codex turns (#23330)

Mocha4a55123c9510
diff --git a/apps/cli/src/utils/heteroSteer.test.ts b/apps/cli/src/utils/heteroSteer.test.ts
index 3bc1eb9e5c5..5037248111a 100644
--- a/apps/cli/src/utils/heteroSteer.test.ts
+++ b/apps/cli/src/utils/heteroSteer.test.ts
@@ -176,6 +176,37 @@ describe('withHeteroSteer', () => {
expect(giveBack).not.toHaveBeenCalled();
});
+ it('returns an uploaded image follow-up intact when its image cannot be loaded', async () => {
+ const { client, giveBack, wait } = createClient([
+ {
+ content: 'see the screenshot',
+ imageList: [{ id: 'f', url: 'https://x/expired' }],
+ messageId: 'msg-1',
+ requiresImages: true,
+ },
+ ]);
+ const sendUserMessage = vi.fn(async (prompt: unknown) => {
+ if (typeof prompt !== 'string') throw new Error('image fetch failed: 403');
+ return true;
+ });
+ const stream = createStream();
+
+ const out = collect(
+ withHeteroSteer(
+ { events: stream.events, sendUserMessage, supportsSteerImageAttachments: true },
+ { getTrpcClient: async () => client, operationId: 'op-1' },
+ ),
+ );
+ await vi.waitFor(() => expect(sendUserMessage).toHaveBeenCalled());
+ await flush();
+ stream.end();
+ await out;
+
+ expect(wait.mock.calls[0][0]).toMatchObject({ acceptsImageAttachments: true });
+ expect(sendUserMessage).toHaveBeenCalledTimes(1);
+ expect(giveBack).toHaveBeenCalledWith({ messageId: 'msg-1', operationId: 'op-1' });
+ });
+
it('gives a refused message back and stops polling', async () => {
const { client, giveBack, wait } = createClient([{ content: 'hi', messageId: 'msg-1' }]);
const stream = createStream();
diff --git a/apps/cli/src/utils/heteroSteer.ts b/apps/cli/src/utils/heteroSteer.ts
index 48a4d6903d3..34f97b09ca4 100644
--- a/apps/cli/src/utils/heteroSteer.ts
+++ b/apps/cli/src/utils/heteroSteer.ts
@@ -31,6 +31,7 @@ export interface HeteroSteerClient {
mutate: (
input: {
acceptsControl?: boolean;
+ acceptsImageAttachments?: boolean;
acceptsImages?: boolean;
blockMs?: number;
holdSteer?: boolean;
@@ -54,11 +55,12 @@ export interface HeteroSteerClient {
};
}
-/** A follow-up to type into the session; `imageList` holds images pasted into its body. */
+/** A follow-up to type into the session, including uploaded and inline images. */
export interface HeteroSteerMessage {
content: string;
imageList?: { id: string; url: string }[];
messageId: string;
+ requiresImages?: true;
}
/** The prompt a follow-up is typed in as: its text, then its images as image blocks. */
@@ -87,6 +89,7 @@ interface SteerableHandle {
request: ClaudeCodeControlRequest,
) => ClaudeCodeControlRequestHandle | undefined;
sendUserMessage?: (prompt: AgentPromptInput, options?: { uuid?: string }) => Promise<boolean>;
+ supportsSteerImageAttachments?: true;
}
const RETRY_MS = 2000;
@@ -202,6 +205,7 @@ export async function* withHeteroSteer<E extends { data?: any; type: string }>(
const res = await client.aiAgent.waitHeteroSteer.mutate(
{
...(acceptsControl && { acceptsControl: true }),
+ ...(handle.supportsSteerImageAttachments && { acceptsImageAttachments: true }),
// The session takes image blocks, so pasted images come along.
acceptsImages: true,
// The first poll answers at once, so the run is marked steerable early.
@@ -239,7 +243,7 @@ export async function* withHeteroSteer<E extends { data?: any; type: string }>(
const steer = message;
const options = { uuid: steer.messageId };
const accepted = await send(buildSteerPrompt(steer), options).catch(async (error) => {
- if (!steer.imageList?.length) return false;
+ if (steer.requiresImages || !steer.imageList?.length) return false;
// An image that cannot be fetched must not cost the message: its
// markdown still names the image.
log.debug('Steer images failed, sending the text: %s', String(error));
diff --git a/apps/server/src/routers/lambda/aiAgent/hetero.ts b/apps/server/src/routers/lambda/aiAgent/hetero.ts
index 6c73fe85a11..e84bef0f2a7 100644
--- a/apps/server/src/routers/lambda/aiAgent/hetero.ts
+++ b/apps/server/src/routers/lambda/aiAgent/hetero.ts
@@ -153,6 +153,8 @@ const WaitHeteroSteerSchema = z.object({
* it: they never get one, so a control message for their run expires.
*/
acceptsControl: z.boolean().optional(),
+ /** The producer can deliver uploaded images without falling back to text on failure. */
+ acceptsImageAttachments: z.boolean().optional(),
/**
* The producer types image blocks into the session (`imageList` on the
* message). Older producers omit it and only ever get text-only follow-ups.
@@ -601,7 +603,14 @@ export const heteroRouter = router({
waitHeteroSteer: heteroAgentProcedure
.input(WaitHeteroSteerSchema)
.mutation(async ({ input, ctx, signal }): Promise<WaitHeteroSteerAnswer> => {
- const { acceptsControl, acceptsImages, holdSteer, operationId, blockMs } = input;
+ const {
+ acceptsControl,
+ acceptsImageAttachments,
+ acceptsImages,
+ blockMs,
+ holdSteer,
+ operationId,
+ } = input;
await authorizeOperationCallback(ctx, operationId, 'hetero:ingest');
@@ -667,6 +676,7 @@ export const heteroRouter = router({
}
if (scope && followUpMode !== 'queue' && !holdSteer) {
const message = await takeHeteroSteer(storeCtx, {
+ acceptsImageAttachments,
acceptsImages,
agentId: operation.agentId,
mode: followUpMode,
diff --git a/apps/server/src/services/aiAgent/steerQueue/hetero.test.ts b/apps/server/src/services/aiAgent/steerQueue/hetero.test.ts
index 131aac663ca..0416803b651 100644
--- a/apps/server/src/services/aiAgent/steerQueue/hetero.test.ts
+++ b/apps/server/src/services/aiAgent/steerQueue/hetero.test.ts
@@ -21,7 +21,9 @@ const mocks = vi.hoisted(() => ({
drain: vi.fn(),
findById: vi.fn(),
isRunAlive: vi.fn(),
+ queryByIds: vi.fn(),
renew: vi.fn(),
+ resolveAttachmentMetadata: vi.fn(),
resolveInlineImages: vi.fn(),
settle: vi.fn(),
}));
@@ -31,6 +33,10 @@ vi.mock('@/server/services/file/inlineImages', async (importOriginal) => ({
resolveInlineImages: mocks.resolveInlineImages,
}));
+vi.mock('@/server/services/file/resolveAttachments', () => ({
+ resolveAttachmentMetadata: mocks.resolveAttachmentMetadata,
+}));
+
vi.mock('@/server/services/redis', () => ({
redisService: {
steerQueue: {
@@ -84,7 +90,11 @@ const followUp = (
const scope = { threadId: null, topicId: 'tpc-1', userId: 'user-1' };
const ctx = { db: {} as any, userId: 'user-1', workspaceId: 'ws-1' };
const take = () => takeHeteroSteer(ctx, { agentId: 'agt-1', operationId: 'op-1', scope });
-const messageModel = { create: mocks.create, findById: mocks.findById } as any;
+const messageModel = {
+ create: mocks.create,
+ findById: mocks.findById,
+ queryByIds: mocks.queryByIds,
+} as any;
beforeEach(() => {
vi.clearAllMocks();
@@ -92,8 +102,10 @@ beforeEach(() => {
mocks.boundOperations.mockResolvedValue({ operationIds: ['op-1'], total: 1 });
mocks.drain.mockResolvedValue([]);
mocks.findById.mockResolvedValue(undefined);
+ mocks.queryByIds.mockResolvedValue([]);
mocks.settle.mockResolvedValue(undefined);
mocks.renew.mockResolvedValue(true);
+ mocks.resolveAttachmentMetadata.mockResolvedValue([]);
mocks.resolveInlineImages.mockResolvedValue([]);
});
@@ -186,15 +198,86 @@ describe('takeHeteroSteer', () => {
});
});
- it('leaves the queue to the run end when the first follow-up cannot join', async () => {
+ it('leaves uploaded attachments queued for a producer that only opts into inline images', async () => {
mocks.drain.mockResolvedValue([followUp('a', 1, { fileIds: ['f1'] }), followUp('b', 2)]);
- await expect(take()).resolves.toBeUndefined();
+ await expect(
+ takeHeteroSteer(ctx, { acceptsImages: true, agentId: 'agt-1', operationId: 'op-1', scope }),
+ ).resolves.toBeUndefined();
expect(mocks.settle.mock.calls[0][2]).toEqual(['a', 'b']);
expect(mocks.deliveries.size).toBe(0);
});
+ describe('uploaded image attachments', () => {
+ const screenshot = {
+ fileType: 'image/png',
+ id: 'file_screen',
+ name: 'screen.png',
+ url: 'https://bucket.example.com/screen.png?sig=s',
+ };
+ const steer = () =>
+ takeHeteroSteer(ctx, {
+ acceptsImageAttachments: true,
+ acceptsImages: true,
+ agentId: 'agt-1',
+ mode: 'steer',
+ operationId: 'op-1',
+ scope,
+ });
+
+ it('delivers an uploaded screenshot with the text and persists the attachment on replay', async () => {
+ mocks.drain.mockResolvedValue([
+ followUp('a', 1, { fileIds: [screenshot.id], prompt: 'add the department filter' }),
+ ]);
+ mocks.resolveAttachmentMetadata.mockResolvedValue([screenshot]);
+
+ await expect(steer()).resolves.toEqual({
+ content: 'add the department filter',
+ imageList: [{ id: screenshot.id, url: screenshot.url }],
+ messageId: 'msg-a',
+ requiresImages: true,
+ });
+
+ const imageList = [{ alt: screenshot.name, id: screenshot.id, url: '/f/file_screen' }];
+ mocks.queryByIds.mockResolvedValue([{ id: 'msg-a', imageList }]);
+ await expect(
+ consumeHeteroSteer(messageModel, {
+ agentId: 'agt-1',
+ messageId: 'msg-a',
+ operationId: 'op-1',
+ parentId: 'asst-1',
+ topicId: 'tpc-1',
+ }),
+ ).resolves.toMatchObject({ id: 'msg-a', imageList });
+ expect(mocks.create).toHaveBeenCalledWith(
+ expect.objectContaining({ files: [screenshot.id] }),
+ 'msg-a',
+ );
+ });
+
+ it.each([
+ ['an inaccessible file', [screenshot]],
+ [
+ 'a PDF',
+ [
+ screenshot,
+ { fileType: 'application/pdf', id: 'file_other', url: 'https://x/report.pdf' },
+ ],
+ ],
+ ])('keeps a batch with %s and the messages behind it in order', async (_kind, files) => {
+ mocks.drain.mockResolvedValue([
+ followUp('a', 1),
+ followUp('b', 2, { fileIds: [screenshot.id, 'file_other'] }),
+ followUp('c', 3),
+ ]);
+ mocks.resolveAttachmentMetadata.mockResolvedValue(files);
+
+ await expect(steer()).resolves.toEqual({ content: 'prompt a', messageId: 'msg-a' });
+ expect(mocks.settle).toHaveBeenCalledWith(scope, expect.any(String), ['b', 'c']);
+ });
+ });
+
describe('images pasted into the body', () => {
const pasted = '![image.png](https://app.lobehub.com/f/file_1)\n\nCI ζŒ‚δΊ†';
const image = { id: 'file_1', url: 'https://bucket.example.com/files/1.png?X-Amz-Signature=s' };
@@ -333,17 +416,21 @@ describe('consumeHeteroSteer', () => {
expect(mocks.create).not.toHaveBeenCalled();
});
- it('returns the written message on a retried batch', async () => {
- mocks.findById.mockResolvedValue({
- content: 'use pnpm',
+ it('returns the written message with its attachments on a retried batch', async () => {
+ const imageList = [{ alt: 'screen.png', id: 'file_screen', url: '/f/file_screen' }];
+ const written = {
+ content: 'see the screenshot',
id: 'msg-a',
+ imageList,
metadata: { steer: true },
parentId: 'asst-1',
role: 'user',
topicId: 'tpc-1',
- });
+ };
+ mocks.findById.mockResolvedValue(written);
+ mocks.queryByIds.mockResolvedValue([written]);
- await expect(consume()).resolves.toMatchObject({ id: 'msg-a', parentId: 'asst-1' });
+ await expect(consume()).resolves.toMatchObject({ id: 'msg-a', imageList, parentId: 'asst-1' });
expect(mocks.create).not.toHaveBeenCalled();
});
});
diff --git a/apps/server/src/services/aiAgent/steerQueue/hetero.ts b/apps/server/src/services/aiAgent/steerQueue/hetero.ts
index 3a5d9bbba79..aa321608f63 100644
--- a/apps/server/src/services/aiAgent/steerQueue/hetero.ts
+++ b/apps/server/src/services/aiAgent/steerQueue/hetero.ts
@@ -1,13 +1,16 @@
-import type { AgentSenderMetadata, FollowUpMode } from '@lobechat/types';
+import type { AgentSenderMetadata, ChatImageItem, FollowUpMode } from '@lobechat/types';
import { RequestTrigger } from '@lobechat/types';
import debug from 'debug';
import { MessageModel } from '@/database/models/message';
+import { isModelImageFileType } from '@/database/models/message/attachments';
+import { getFileProxyUrl } from '@/server/services/file';
import {
collectMarkdownImageUrls,
type InlineImage,
resolveInlineImages,
} from '@/server/services/file/inlineImages';
+import { resolveAttachmentMetadata } from '@/server/services/file/resolveAttachments';
import { redisService } from '@/server/services/redis';
import type { SteerQueueScope } from '@/server/services/redis/steerQueue';
@@ -41,6 +44,7 @@ export interface HeteroSteerDelivery {
entryId: string;
/** Every follow-up merged into this delivery, when there were several (Steer mode). */
entryIds?: string[];
+ fileIds?: string[];
groupId?: string;
scope: SteerQueueScope;
trigger?: string;
@@ -48,24 +52,25 @@ export interface HeteroSteerDelivery {
export interface HeteroSteerMessage {
content: string;
- /**
- * Images pasted into the follow-up's body, which `content` only holds as
- * markdown links: signed URLs for the session to take as image input.
- */
+ /** Signed URLs for uploaded attachments and images linked from the body. */
imageList?: InlineImage[];
messageId: string;
+ /** An upload is part of the message; a producer must return it if the image fails. */
+ requiresImages?: true;
}
/**
- * Whether a follow-up can be typed into the running agent session: plain text
- * for the same agent. Attachments, attached selections, tool or skill
- * selections and @-mentions need a turn configured for them, and wait for the
- * run to end.
+ * Whether a follow-up can use the existing session's configuration. Uploaded
+ * files also need a producer that takes attachments and a successful image lookup.
*/
-export const canSteerHeteroRun = (entry: QueuedFollowUp, agentId: string | null): boolean => {
+export const canSteerHeteroRun = (
+ entry: QueuedFollowUp,
+ agentId: string | null,
+ acceptsImageAttachments = false,
+): boolean => {
const { request } = entry;
if (!request.prompt.trim()) return false;
- if (request.fileIds?.length) return false;
+ if (request.fileIds?.length && !acceptsImageAttachments) return false;
if (request.userMessage?.metadata) return false;
if (request.selectedToolIds?.length || request.selectedSkillIds?.length) return false;
if (request.mentionedAgents?.length) return false;
@@ -111,6 +116,7 @@ const fitsSession = (entry: QueuedFollowUp, acceptsImages: boolean | undefined)
export const takeHeteroSteer = async (
ctx: StoreContext,
params: {
+ acceptsImageAttachments?: boolean;
acceptsImages?: boolean;
agentId: string | null;
mode?: FollowUpMode;
@@ -118,7 +124,7 @@ export const takeHeteroSteer = async (
scope: SteerQueueScope;
},
): Promise<HeteroSteerMessage | undefined> => {
- const { acceptsImages, agentId, operationId, scope } = params;
+ const { acceptsImageAttachments, acceptsImages, agentId, operationId, scope } = params;
const merging = params.mode === 'steer';
const drained = await drainOwnFollowUps(ctx, scope, operationId);
@@ -145,23 +151,50 @@ export const takeHeteroSteer = async (
return;
}
- // A session that only takes text gets no image follow-up: decided from the
- // markdown alone, since the run asks again on every poll.
const canGo = (entry: QueuedFollowUp) =>
- canSteerHeteroRun(entry, agentId) && fitsSession(entry, acceptsImages);
+ canSteerHeteroRun(entry, agentId, acceptsImages && acceptsImageAttachments) &&
+ fitsSession(entry, acceptsImages);
const firstHeld = drained.entries.findIndex((entry) => !canGo(entry));
const ready = firstHeld === -1 ? drained.entries : drained.entries.slice(0, firstHeld);
- const joining = merging ? takeSameSenderFollowUps(ready).taken : ready.slice(0, 1);
+ const candidates = merging ? takeSameSenderFollowUps(ready).taken : ready.slice(0, 1);
+
+ // Resolve only the files this poll could deliver. The metadata lookup checks
+ // file ownership without parsing documents that must wait for another turn.
+ const candidateFileIds = [...new Set(candidates.flatMap((entry) => entry.request.fileIds ?? []))];
+ const attachments = new Map<string, InlineImage>();
+ if (candidateFileIds.length > 0) {
+ try {
+ const files = await resolveAttachmentMetadata({
+ ...ctx,
+ fileIds: candidateFileIds,
+ workspaceId: ctx.workspaceId ?? undefined,
+ });
+ for (const { fileType, id, url } of files) {
+ if (url && isModelImageFileType(fileType)) attachments.set(id, { id, url });
+ }
+ } catch (error) {
+ await returnFollowUps(scope, drained, drained.entries, error);
+ return;
+ }
+ }
+ const firstUnsupported = candidates.findIndex((entry) =>
+ entry.request.fileIds?.some((id) => !attachments.has(id)),
+ );
+ const joining = firstUnsupported === -1 ? candidates : candidates.slice(0, firstUnsupported);
if (joining.length === 0) {
await returnFollowUps(scope, drained, drained.entries, 'needs a turn of its own');
return;
}
const request = joining.length === 1 ? joining[0].request : mergeQueuedFollowUps(joining);
- let imageList: InlineImage[] = [];
+ const fileIds = [...new Set(request.fileIds)];
+ const imageList = fileIds.map((id) => attachments.get(id)!);
if (collectMarkdownImageUrls(request.prompt).length > 0) {
try {
- imageList = await resolveInlineImages(ctx, request.prompt);
+ const inline = fileIds.length
+ ? await resolveInlineImages(ctx, request.prompt, fileIds)
+ : await resolveInlineImages(ctx, request.prompt);
+ imageList.push(...inline);
} catch (error) {
await returnFollowUps(scope, drained, drained.entries, error);
return;
@@ -208,6 +241,7 @@ export const takeHeteroSteer = async (
editorData: request.userMessage?.editorData,
entryId: joining[0].id,
...(joining.length > 1 && { entryIds: joining.map((entry) => entry.id) }),
+ ...(fileIds.length > 0 && { fileIds }),
groupId: request.appContext?.groupId ?? undefined,
scope,
trigger: request.trigger,
@@ -222,6 +256,7 @@ export const takeHeteroSteer = async (
content: request.prompt,
...(imageList.length > 0 && { imageList }),
messageId,
+ ...(fileIds.length > 0 && { requiresImages: true }),
};
};
@@ -260,6 +295,13 @@ export const releaseHeteroSteers = async (operationId: string) => {
}
};
+const readSteerImages = async (messageModel: MessageModel, messageId: string) => {
+ const [message] = await messageModel.queryByIds([messageId], {
+ postProcessUrl: async (path, file) => (file.id ? getFileProxyUrl(file.id) : (path ?? '')),
+ });
+ return message?.imageList?.length ? message.imageList : undefined;
+};
+
/**
* The agent replayed a delivered message: write it into the conversation as a
* steer user message under `parentId`, and acknowledge its follow-up.
@@ -279,7 +321,13 @@ export const consumeHeteroSteer = async (
messageId: string;
},
): Promise<
- | { content: string; id: string; metadata: Record<string, unknown>; parentId: string | null }
+ | {
+ content: string;
+ id: string;
+ imageList?: ChatImageItem[];
+ metadata: Record<string, unknown>;
+ parentId: string | null;
+ }
| undefined
> => {
const { messageId, operationId } = params;
@@ -289,10 +337,13 @@ export const consumeHeteroSteer = async (
if (!delivery) {
const written = await messageModel.findById(messageId);
if (written?.role !== 'user' || written.topicId !== params.topicId) return;
+ const metadata = (written.metadata ?? {}) as Record<string, unknown>;
+ const imageList = metadata.steer ? await readSteerImages(messageModel, messageId) : undefined;
return {
content: written.content ?? '',
id: written.id,
- metadata: (written.metadata ?? {}) as Record<string, unknown>,
+ ...(imageList && { imageList }),
+ metadata,
parentId: written.parentId ?? null,
};
}
@@ -313,6 +364,7 @@ export const consumeHeteroSteer = async (
agentId: params.agentId ?? undefined,
content: delivery.content,
editorData: delivery.editorData,
+ files: delivery.fileIds,
groupId: delivery.groupId,
metadata,
parentId: params.parentId,
@@ -324,8 +376,18 @@ export const consumeHeteroSteer = async (
);
}
+ const imageList = delivery.fileIds?.length
+ ? await readSteerImages(messageModel, messageId)
+ : undefined;
+
await ackFollowUps(delivery.scope, delivery);
await redisService.steerQueue.removeHeteroDelivery(operationId, messageId);
- return { content: delivery.content, id: messageId, metadata, parentId: params.parentId };
+ return {
+ content: delivery.content,
+ id: messageId,
+ ...(imageList && { imageList }),
+ metadata,
+ parentId: params.parentId,
+ };
};
diff --git a/packages/agent-gateway-client/src/types.ts b/packages/agent-gateway-client/src/types.ts
index 0d2c9411c42..620b7e5aa8e 100644
--- a/packages/agent-gateway-client/src/types.ts
+++ b/packages/agent-gateway-client/src/types.ts
@@ -211,6 +211,7 @@ export interface StreamStartParentMessage {
/** Server creation time (epoch ms). Absent from older servers. */
createdAt?: number;
id: string;
+ imageList?: UIChatMessage['imageList'];
metadata?: Record<string, unknown> | null;
parentId?: string | null;
role: 'user';
diff --git a/packages/heterogeneous-agents/src/codex/codexAgentHandle.ts b/packages/heterogeneous-agents/src/codex/codexAgentHandle.ts
index 23b78298ef2..ca5a1686a69 100644
--- a/packages/heterogeneous-agents/src/codex/codexAgentHandle.ts
+++ b/packages/heterogeneous-agents/src/codex/codexAgentHandle.ts
@@ -220,5 +220,6 @@ export const createCodexAgentHandle = async (
return nativeSessionId;
},
stderr,
+ supportsSteerImageAttachments: true,
};
};
diff --git a/packages/heterogeneous-agents/src/spawn/spawnAgent.ts b/packages/heterogeneous-agents/src/spawn/spawnAgent.ts
index e6fb0d8364b..e3bad47f3f1 100644
--- a/packages/heterogeneous-agents/src/spawn/spawnAgent.ts
+++ b/packages/heterogeneous-agents/src/spawn/spawnAgent.ts
@@ -181,6 +181,8 @@ export interface SpawnAgentHandle {
* collect for error reporting. The pipeline does not consume stderr.
*/
stderr: NodeJS.ReadableStream;
+ /** The live session accepts uploaded images with their follow-up message. */
+ supportsSteerImageAttachments?: true;
}
/**
diff --git a/src/store/chat/slices/agentRun/actions/transports/gateway/gatewayEventHandler/index.streaming.test.ts b/src/store/chat/slices/agentRun/actions/transports/gateway/gatewayEventHandler/index.streaming.test.ts
index af98f387e95..47f1c3009f7 100644
--- a/src/store/chat/slices/agentRun/actions/transports/gateway/gatewayEventHandler/index.streaming.test.ts
+++ b/src/store/chat/slices/agentRun/actions/transports/gateway/gatewayEventHandler/index.streaming.test.ts
@@ -286,7 +286,8 @@ describe('createGatewayEventHandler β€” stream lifecycle events', () => {
});
describe('step_complete user_message (live steer read by a heterogeneous run)', () => {
- it('shows the steer message as soon as the run reads it, before its reply starts', async () => {
+ it('shows the steer message and its images before the reply starts', async () => {
+ const imageList = [{ alt: 'screen.png', id: 'file_screen', url: '/f/file_screen' }];
const store = createMockStore();
const handler = createHandler(store);
@@ -297,6 +298,7 @@ describe('createGatewayEventHandler β€” stream lifecycle events', () => {
agentId: 'agent-executing',
content: 'summarize the refactor',
id: 'steer-1',
+ imageList,
metadata: { steer: true },
parentId: 'msg-step1',
role: 'user',
@@ -314,6 +316,7 @@ describe('createGatewayEventHandler β€” stream lifecycle events', () => {
// The persisted author, not the conversation owner (`agent-1`).
agentId: 'agent-executing',
content: 'summarize the refactor',
+ imageList,
metadata: { steer: true },
parentId: 'msg-step1',
role: 'user',
diff --git a/src/store/chat/slices/agentRun/actions/transports/gateway/streamStartSeed.ts b/src/store/chat/slices/agentRun/actions/transports/gateway/streamStartSeed.ts
index 2a838b87a6f..db2ea12d573 100644
--- a/src/store/chat/slices/agentRun/actions/transports/gateway/streamStartSeed.ts
+++ b/src/store/chat/slices/agentRun/actions/transports/gateway/streamStartSeed.ts
@@ -48,6 +48,7 @@ const insertSteerRow = (
...shared,
agentId: shared.agentId ?? undefined,
content: steer.content,
+ ...(steer.imageList?.length && { imageList: steer.imageList }),
metadata: steer.metadata ?? undefined,
parentId: steer.parentId ?? undefined,
role: 'user',