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
test(test): add inFlightThreadKeys helper and update chat harness tests
Steven Enamakel534747c817a0
diff --git a/app/test/playwright/helpers/chat-transcript.ts b/app/test/playwright/helpers/chat-transcript.tsindex 8f691bbf84..c23b2b65ef 100644--- a/app/test/playwright/helpers/chat-transcript.ts+++ b/app/test/playwright/helpers/chat-transcript.ts@@ -52,3 +52,13 @@ export async function listedThreadTranscripts(): Promise<expect(Array.isArray(entries), 'workspace file list contains entries').toBe(true);return entries as Array<{ rel_path: string; size: number; is_dir: boolean }>;}++export async function inFlightThreadKeys(): Promise<string[]> {+ const status = unwrapResult(+ await callCoreRpc<unknown>('openhuman.test_support_in_flight_chats', {})+ );+ expect(status && typeof status === 'object' && 'entries' in status, 'in-flight test support returns entries').toBe(true);+ const entries = (status as { entries: unknown }).entries;+ expect(Array.isArray(entries), 'in-flight entries are a list').toBe(true);+ return (entries as Array<{ key: string }>).map(entry => entry.key);+}diff --git a/app/test/playwright/specs/chat-harness-cancel.spec.ts b/app/test/playwright/specs/chat-harness-cancel.spec.tsindex bd991d7c5b..f776ce07de 100644--- a/app/test/playwright/specs/chat-harness-cancel.spec.ts+++ b/app/test/playwright/specs/chat-harness-cancel.spec.ts@@ -5,6 +5,7 @@ import {dismissWalkthroughIfPresent,waitForAppReady,} from '../helpers/core-rpc';+import { inFlightThreadKeys, selectedThreadTranscript } from '../helpers/chat-transcript';const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;const USER_ID = 'pw-chat-cancel';@@ -128,6 +129,7 @@ test.describe('Chat Harness - Cancel', () => {// Mid-stream, the composer's Send button morphs into a Stop button (the// cancel control now lives in the composer for the text composer).await expect(page.getByTestId('stop-generation-button')).toBeVisible({ timeout: 10_000 });+ await expect.poll(async () => page.locator('#root').innerText()).toContain('one two');await page.getByTestId('stop-generation-button').click();@@ -135,6 +137,12 @@ test.describe('Chat Harness - Cancel', () => {for (const piece of LATE_PIECES) {await expect(page.getByText(piece, { exact: false })).toHaveCount(0, { timeout: 5_000 });}+ await expect.poll(inFlightThreadKeys).toEqual([]);+ await expect.poll(async () => page.locator('#root').innerText()).toContain('one two');+ const transcript = await selectedThreadTranscript(page);+ expect(transcript.content).toContain(PROMPT);+ expect(transcript.content).toContain('one two');+ for (const piece of LATE_PIECES) expect(transcript.content).not.toContain(piece);const composer = page.getByTestId('chat-message-input');await expect(composer).toBeEnabled();diff --git a/app/test/playwright/specs/chat-harness-send-stream.spec.ts b/app/test/playwright/specs/chat-harness-send-stream.spec.tsindex c3fd94ba49..da3dfd6e13 100644--- a/app/test/playwright/specs/chat-harness-send-stream.spec.ts+++ b/app/test/playwright/specs/chat-harness-send-stream.spec.ts@@ -5,6 +5,11 @@ import {dismissWalkthroughIfPresent,waitForAppReady,} from '../helpers/core-rpc';+import {+ inFlightThreadKeys,+ listedThreadTranscripts,+ selectedThreadTranscript,+} from '../helpers/chat-transcript';const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;const USER_ID = 'pw-chat-send-stream';@@ -153,5 +158,23 @@ test.describe('Chat Harness - Send Stream', () => {);}).toBe(true);++ await expect+ .poll(async () => {+ try {+ return (await selectedThreadTranscript(page)).content;+ } catch {+ return '';+ }+ }, { timeout: 10_000 })+ .toContain(CANARY);+ const durable = await selectedThreadTranscript(page);+ expect(durable.content).toContain(PROMPT);+ expect(durable.content).toContain(REPLY_PIECES.join(''));+ const files = await listedThreadTranscripts();+ const durableFile = files.find(file => file.rel_path === durable.path);+ expect(durableFile).toBeDefined();+ expect(durableFile?.size).toBeGreaterThan(0);+ await expect.poll(inFlightThreadKeys).not.toContain(`::${durable.threadId}`);});});