Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(conversations): update attachment persistence logic

Steven Enamakel72b13e6354d0
diff --git a/app/src/features/conversations/Conversations.processSourceCommand.test.tsx b/app/src/features/conversations/Conversations.processSourceCommand.test.tsx
index 52355e963d..a8f4569cb8 100644
--- a/app/src/features/conversations/Conversations.processSourceCommand.test.tsx
+++ b/app/src/features/conversations/Conversations.processSourceCommand.test.tsx
@@ -331,12 +331,22 @@ describe('the agent-process-source command follows the panel that hosts it', ()
registry.reset();
});
- it('persists raw uploads once and sends the core returned durable reference', async () => {
- const staged =
- '[ATTACHMENT:%7B%22path%22%3A%22uploads%2Ft%2Fa%2Fphoto.png%22%2C%22name%22%3A%22photo.png%22%2C%22mime%22%3A%22image%2Fpng%22%2C%22size_bytes%22%3A3%7D]';
+ it('persists raw uploads once and sends the core returned opaque reference', async () => {
+ const persistedAttachment = {
+ kind: 'image',
+ media: {
+ opaqueId: 'stored-photo',
+ contentType: 'image/png',
+ fileName: 'photo.png',
+ sizeBytes: 3,
+ },
+ caption: null,
+ altText: null,
+ } as const;
vi.mocked(threadApi.appendMessage).mockImplementationOnce(async (_id, message) => ({
...message,
- content: staged,
+ id: 'persisted-user-row',
+ attachments: [persistedAttachment],
}));
await renderChat('text');
const picker = document.querySelector('input[type="file"]');
@@ -362,7 +372,12 @@ describe('the agent-process-source command follows the panel that hosts it', ()
expect(JSON.stringify(uploaded.extraMetadata)).not.toContain('base64');
expect(uploaded.extraMetadata).not.toHaveProperty('attachmentDataUris');
expect(chatSend).toHaveBeenLastCalledWith(
- expect.objectContaining({ threadId: THREAD_ID, message: staged })
+ expect.objectContaining({
+ threadId: THREAD_ID,
+ message: 'text',
+ persistedMessageId: 'persisted-user-row',
+ attachments: [persistedAttachment],
+ })
);
});