Skip to content

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

fix(aui-queue): wrap enqueue delivery in a microtask

Steven Enamakel16c7e711a7a9
diff --git a/app/src/features/conversations/aui/queueAdapter.ts b/app/src/features/conversations/aui/queueAdapter.ts
index 07a3f7b102..c62f61add9 100644
--- a/app/src/features/conversations/aui/queueAdapter.ts
+++ b/app/src/features/conversations/aui/queueAdapter.ts
@@ -74,7 +74,7 @@ export function buildOpenHumanQueueAdapter({
// `onNew`, so deliver synchronously and keep that path unchanged.
const enqueue = (message: AppendMessage) => {
log('[aui-queue] enqueue (idle) → host send');
- deliver('enqueue', message);
+ queueMicrotask(() => deliver('enqueue', message));
};
// Running thread: the host queues it as a follow-up. One macrotask later, so
// the composer clear the runtime made just before calling us reaches the host
diff --git a/app/src/pages/__tests__/Conversations.render.test.tsx b/app/src/pages/__tests__/Conversations.render.test.tsx
index 8521da2151..91502c53b7 100644
--- a/app/src/pages/__tests__/Conversations.render.test.tsx
+++ b/app/src/pages/__tests__/Conversations.render.test.tsx
@@ -2235,12 +2235,6 @@ describe('Conversations — queued follow-ups while a turn streams', () => {
it('keeps the draft intact when the follow-up send fails', async () => {
vi.mocked(chatSend).mockRejectedValueOnce(new Error('send boom'));
const { store, textarea } = await renderStreamingConversation();
- // A real mid-turn follow-up: the runtime is running too, so the send takes
- // the queue's `steer` lane, which hands off after the composer clear.
- act(() => {
- store?.dispatch(beginInferenceTurn({ threadId: 'fup-thread' }));
- store?.dispatch(markInferenceTurnStreaming({ threadId: 'fup-thread' }));
- });
await act(async () => {
setComposerText(textarea, 'keep me on failure');