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(chat): update thread key checking in chat tests
Steven Enamakel1d5e120ab2cd
diff --git a/app/test/playwright/helpers/chat-transcript.ts b/app/test/playwright/helpers/chat-transcript.tsindex 2197373be9..47f8a31c81 100644--- a/app/test/playwright/helpers/chat-transcript.ts+++ b/app/test/playwright/helpers/chat-transcript.ts@@ -67,3 +67,9 @@ export async function inFlightThreadKeys(): Promise<string[]> {expect(Array.isArray(entries)).toBe(true);return (entries as Array<{ key: string }>).map(entry => entry.key);}++export async function inFlightThreadKey(threadId: string): Promise<string | undefined> {+ expect(threadId.length).toBeGreaterThan(0);+ const keys = await inFlightThreadKeys();+ return keys.find(key => key === threadId || key.endsWith(threadId));+}diff --git a/app/test/playwright/specs/chat-harness-cancel.spec.ts b/app/test/playwright/specs/chat-harness-cancel.spec.tsindex 02bf7fa4fd..c48ef9bacb 100644--- a/app/test/playwright/specs/chat-harness-cancel.spec.ts+++ b/app/test/playwright/specs/chat-harness-cancel.spec.ts@@ -5,7 +5,7 @@ import {dismissWalkthroughIfPresent,waitForAppReady,} from '../helpers/core-rpc';-import { inFlightThreadKeys, persistedThreadMessages } from '../helpers/chat-transcript';+import { inFlightThreadKey, persistedThreadMessages } 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';@@ -130,6 +130,7 @@ test.describe('Chat Harness - Cancel', () => {// 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 expect.poll(() => inFlightThreadKey(threadId)).toBeTruthy();await page.getByTestId('stop-generation-button').click();@@ -137,9 +138,7 @@ 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(async () => inFlightThreadKeys())- .not.toContain(`::${threadId}`);+ await expect.poll(() => inFlightThreadKey(threadId)).toBeUndefined();await expect.poll(async () => page.locator('#root').innerText()).toContain('one two');await expect.poll(async () => {diff --git a/app/test/playwright/specs/chat-harness-send-stream.spec.ts b/app/test/playwright/specs/chat-harness-send-stream.spec.tsindex dd35087913..6eebf8df81 100644--- a/app/test/playwright/specs/chat-harness-send-stream.spec.ts+++ b/app/test/playwright/specs/chat-harness-send-stream.spec.ts@@ -6,7 +6,7 @@ import {waitForAppReady,} from '../helpers/core-rpc';import {- inFlightThreadKeys,+ inFlightThreadKey,persistedThreadMessages,selectedThreadTranscript,} from '../helpers/chat-transcript';@@ -133,7 +133,7 @@ test.describe('Chat Harness - Send Stream', () => {// shape and the terminal `{ finish }` entry had nowhere to go.type StreamScriptEntry = { text: string; delayMs: number } | { finish: 'stop' | 'tool_calls' };const streamScript: StreamScriptEntry[] = [- ...REPLY_PIECES.map(text => ({ text, delayMs: 60 })),+ ...REPLY_PIECES.map(text => ({ text, delayMs: 250 })),{ finish: 'stop' },];@@ -142,6 +142,7 @@ test.describe('Chat Harness - Send Stream', () => {const threadId = await createNewThread(page);await sendMessage(page, PROMPT);+ await expect.poll(() => inFlightThreadKey(threadId)).toBeTruthy();await expect(page.getByText(/here is the marker\s+canary-9f3c1a/i)).toBeVisible({timeout: 30_000,@@ -169,10 +170,11 @@ test.describe('Chat Harness - Send Stream', () => {}, { timeout: 10_000 }).toContain(CANARY);const durable = await selectedThreadTranscript(page);+ expect(durable.threadId).toBe(threadId);expect(durable.content).toContain(PROMPT);expect(durable.content).toContain(REPLY_PIECES.join(''));expect(durable.total).toBeGreaterThan(0);- await expect.poll(inFlightThreadKeys).not.toContain(`::${durable.threadId}`);+ await expect.poll(() => inFlightThreadKey(durable.threadId)).toBeUndefined();await expect.poll(async () => {const messages = await persistedThreadMessages(threadId);