Skip to content

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

fix(conversations): correct composer sync test and e2e spec for live history parity

Steven Enamakelc5d586513325
diff --git a/app/src/features/conversations/components/AssistantUiChat.composerSync.test.tsx b/app/src/features/conversations/components/AssistantUiChat.composerSync.test.tsx
index c7835054ef..5716a4df64 100644
--- a/app/src/features/conversations/components/AssistantUiChat.composerSync.test.tsx
+++ b/app/src/features/conversations/components/AssistantUiChat.composerSync.test.tsx
@@ -19,7 +19,7 @@ import {
useExternalStoreRuntime,
} from '@assistant-ui/react';
import { act, render, waitFor } from '@testing-library/react';
-import { type ReactNode, useState } from 'react';
+import { type ReactNode, useLayoutEffect, useState } from 'react';
import { flushSync } from 'react-dom';
import { describe, expect, it } from 'vitest';
@@ -41,14 +41,18 @@ function Harness({ handles }: { handles: Partial<Handles> }) {
const [value, setValue] = useState('');
const aui = useAui();
const composerText = useAuiState(s => s.composer.text);
- handles.hostSet = setValue;
- handles.hostValue = () => value;
- handles.composerText = () => composerText;
- handles.type = text => {
- for (let n = 1; n <= text.length; n += 1) {
- flushSync(() => aui.composer.setText(text.slice(0, n)));
- }
- };
+ useLayoutEffect(() => {
+ Object.assign(handles, {
+ hostSet: setValue,
+ hostValue: () => value,
+ composerText: () => composerText,
+ type: (text: string) => {
+ for (let n = 1; n <= text.length; n += 1) {
+ flushSync(() => aui.composer.setText(text.slice(0, n)));
+ }
+ },
+ });
+ });
return <ComposerTextBridge value={value} onChange={setValue} />;
}
diff --git a/app/test/e2e/specs/chat-live-history-parity.spec.ts b/app/test/e2e/specs/chat-live-history-parity.spec.ts
index f7b6d705e0..54c8e433a7 100644
--- a/app/test/e2e/specs/chat-live-history-parity.spec.ts
+++ b/app/test/e2e/specs/chat-live-history-parity.spec.ts
@@ -81,8 +81,8 @@ interface Block {
}
/**
- * The last assistant message's top-level blocks, in document order: tool
- * cards, delegation cards, reasoning disclosures and markdown text. Nested
+ * The last assistant message's top-level blocks, in document order: activity
+ * groups, tool cards, delegation cards, reasoning disclosures and markdown text. Nested
* blocks (markdown inside a reasoning block) belong to their parent.
*/
async function replyBlocks(): Promise<Block[]> {