The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(chat): snapshot the file list before queuing ingest
Shanu4a1c4047e5ea
diff --git a/app/src/features/conversations/Conversations.tsx b/app/src/features/conversations/Conversations.tsxindex 1140e0de69..a0d364f180 100644--- a/app/src/features/conversations/Conversations.tsx+++ b/app/src/features/conversations/Conversations.tsx@@ -1064,9 +1064,18 @@ const Conversations = ({* same budget — a paste landing while a dropped file is still being read, for* instance. Each run starts only once the one before it has finished writing* `attachmentsRef`, so the budget it counts from is current.+ *+ * The list is copied here, synchronously, and that is load-bearing: every+ * caller hands over a list owned by a DOM event that does not outlive the+ * handler. The picker clears its `FileList` on the next line+ * (`event.target.value = ''`), and a drop's `DataTransfer` is neutered once+ * the handler returns. Reading either from inside the queued continuation+ * finds an empty list — and an empty list produces no attachment and no+ * error, which is a silent failure rather than a visible one.*/const handleAttachFiles = (files: FileList | File[] | null): Promise<void> => {- const run = ingestQueueRef.current.then(() => ingestFiles(files));+ const snapshot = files ? Array.from(files) : null;+ const run = ingestQueueRef.current.then(() => ingestFiles(snapshot));// The queue must survive a rejected run, or one failure wedges every later// attachment. Errors still surface to the caller through `run`.ingestQueueRef.current = run.then(diff --git a/app/src/pages/__tests__/Conversations.attachments.test.tsx b/app/src/pages/__tests__/Conversations.attachments.test.tsxindex f3cbc374ce..a22c4d6267 100644--- a/app/src/pages/__tests__/Conversations.attachments.test.tsx+++ b/app/src/pages/__tests__/Conversations.attachments.test.tsx@@ -422,6 +422,28 @@ describe('Conversations — attachment feature', () => {});});+ // The list every caller hands over belongs to a DOM event that does not+ // outlive its handler: the picker clears its `FileList` on the next line, and+ // a drop's `DataTransfer` is neutered on return. Ingest is queued, so reading+ // the list inside the continuation finds it already empty — and an empty list+ // yields no attachment and no error, which is silent rather than visible.+ it('keeps a picked file when the input clears its list right after the event', async () => {+ await renderWithSelectedThread();++ const fileInput = document.querySelector('input[type="file"]') as HTMLInputElement;+ const live = [makeFile('cleared-after.png', 'image/png', 512)];++ await act(async () => {+ fireEvent.change(fileInput, { target: { files: live } });+ // Stands in for `event.target.value = ''` emptying the live FileList.+ live.length = 0;+ });++ await waitFor(() => {+ expect(screen.getByText('cleared-after.png')).toBeInTheDocument();+ });+ });+it('marks the composer while files are dragged over it, and clears on leave', async () => {await renderWithSelectedThread();