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
chore(e2e): remove obsolete chat and conversations specs
Steven Enamakel2958b7d1d5b8
diff --git a/app/scripts/e2e-run-all-flows.sh b/app/scripts/e2e-run-all-flows.shindex dcf48ccf55..5e10c29dfd 100755--- a/app/scripts/e2e-run-all-flows.sh+++ b/app/scripts/e2e-run-all-flows.sh@@ -255,10 +255,7 @@ fiif should_run_suite "chat"; thenecho ""echo "## Running suite: chat"- run "test/e2e/specs/chat-harness-send-stream.spec.ts" "chat-send-stream" "chat"- run "test/e2e/specs/chat-harness-cancel.spec.ts" "chat-cancel" "chat"run "test/e2e/specs/chat-harness-scroll-render.spec.ts" "chat-scroll-render" "chat"- run "test/e2e/specs/chat-harness-wallet-flow.spec.ts" "chat-wallet" "chat"run "test/e2e/specs/chat-tool-call-flow.spec.ts" "chat-tool-call" "chat"run "test/e2e/specs/chat-live-history-parity.spec.ts" "chat-live-history-parity" "chat"run "test/e2e/specs/chat-tool-error-recovery.spec.ts" "chat-error-recovery" "chat"@@ -339,7 +336,6 @@ if should_run_suite "provider-web"; thenrun "test/e2e/specs/whatsapp-flow.spec.ts" "whatsapp" "provider-web"# notion-flow.spec.ts was removed; skip to avoid "spec not found" failure.# run "test/e2e/specs/notion-flow.spec.ts" "notion" "provider-web"- run "test/e2e/specs/conversations-web-channel-flow.spec.ts" "conversations" "provider-web"run "test/e2e/specs/composio-triggers-flow.spec.ts" "composio-triggers" "provider-web"run "test/e2e/specs/connectivity-state-differentiation.spec.ts" "connectivity-state" "provider-web"_mini_summary "provider-web"@@ -421,7 +417,6 @@ if should_run_suite "journeys"; thenecho "## Running suite: journeys"run "test/e2e/specs/user-journey-full-task.spec.ts" "journey-full-task" "journeys"run "test/e2e/specs/user-journey-settings-round-trip.spec.ts" "journey-settings" "journeys"- run "test/e2e/specs/chat-conversation-history.spec.ts" "chat-history" "journeys"run "test/e2e/specs/flows.spec.ts" "flows" "journeys"_mini_summary "journeys"fidiff --git a/app/test/e2e/specs/chat-conversation-history.spec.ts b/app/test/e2e/specs/chat-conversation-history.spec.tsdeleted file mode 100644index f69f720a8f..0000000000--- a/app/test/e2e/specs/chat-conversation-history.spec.ts+++ /dev/null@@ -1,277 +0,0 @@-// @ts-nocheck-/**- * Chat conversation history — multi-turn memory.- *- * Verifies that the context window passed to the LLM on subsequent- * turns includes the complete message history from earlier in the thread.- *- * Flow:- * 1. Send first message: "Remember: the secret word is XYZZY"- * 2. Verify mock LLM received the message and returned confirmation- * 3. Send second message in same thread: "What was the secret word?"- * 4. Verify LLM's second call includes prior messages in context- * 5. Final answer renders with XYZZY canary- * 6. Durable thread messages contain both exchanges- *- * Tests:- * H1.1 — first message and response rendered- * H1.2 — second LLM call includes ≥ 3 messages (user + assistant + user)- * H1.3 — second response with XYZZY canary renders- * H1.4 — durable thread messages contain both exchanges- */-import { waitForApp } from '../helpers/app-helpers';-import {- chatMounted,- clickByTitle,- clickSend,- getSelectedThreadId,- typeIntoComposer,- waitForSocketConnected,-} from '../helpers/chat-harness';-import { callOpenhumanRpc } from '../helpers/core-rpc';-import { textExists } from '../helpers/element-helpers';-import { resetApp } from '../helpers/reset-app';-import { navigateViaHash } from '../helpers/shared-flows';-import {- clearRequestLog,- getRequestLog,- setMockBehavior,- startMockServer,- stopMockServer,-} from '../mock-server';--const LOG_PREFIX = '[chat-conversation-history]';-const USER_ID = 'e2e-chat-conversation-history';-const SECRET_WORD = 'XYZZY';-const FIRST_PROMPT = `Remember: the secret word is ${SECRET_WORD}`;-const SECOND_PROMPT = 'What was the secret word?';-const CANARY_SECOND = `canary-memory-m1n2o3-${SECRET_WORD}`;-const FIRST_RESPONSE = `Got it! I will remember that the secret word is ${SECRET_WORD}.`;--// Two forced responses for the two turns.-const FORCED_RESPONSES_TURN1 = [{ content: FIRST_RESPONSE }];-const FORCED_RESPONSES_TURN2 = [- {- content: `The secret word you told me was ${SECRET_WORD}. Here is the confirmation: ${CANARY_SECOND}`,- },-];--describe('Chat conversation history', () => {- let threadId: string;-- before(async () => {- console.log(`${LOG_PREFIX} Starting mock server and resetting app`);- await startMockServer();- await waitForApp();- await resetApp(USER_ID);-- // Configure turn 1 responses only; turn 2 will be set after turn 1 completes.- setMockBehavior('llmForcedResponses', JSON.stringify(FORCED_RESPONSES_TURN1));- setMockBehavior('llmStreamChunkDelayMs', '10');- clearRequestLog();- console.log(`${LOG_PREFIX} Setup complete`);- });-- after(async () => {- setMockBehavior('llmForcedResponses', '');- setMockBehavior('llmStreamChunkDelayMs', '');- await stopMockServer();- console.log(`${LOG_PREFIX} Teardown complete`);- });-- it('H1.1 — first message and response rendered', async () => {- console.log(`${LOG_PREFIX} H1.1: navigating to /chat and opening new thread`);- await navigateViaHash('/chat');- await browser.waitUntil(async () => await chatMounted(), {- timeout: 15_000,- timeoutMsg: 'Conversations panel did not mount',- });- // Capture any thread that was already selected (carries over from a- // prior spec in the shared session) so we can wait for it to CHANGE- // when New thread is clicked. Without this guard `waitUntil(getSelectedThreadId)`- // returns the stale id immediately and the rest of the spec asserts- // against the wrong on-disk thread file.- const priorThreadId = await getSelectedThreadId();- expect(await clickByTitle('New thread', 8_000)).toBe(true);-- threadId = (await browser.waitUntil(- async () => {- const current = await getSelectedThreadId();- if (!current) return null;- if (priorThreadId && current === priorThreadId) return null;- return current;- },- {- timeout: 8_000,- timeoutMsg: `thread.selectedThreadId never advanced past ${priorThreadId ?? '<unset>'}`,- }- )) as string;- expect(typeof threadId).toBe('string');- console.log(`${LOG_PREFIX} H1.1: thread created: ${threadId}`);-- await typeIntoComposer(FIRST_PROMPT);- const socketReady = await waitForSocketConnected(30_000);- if (!socketReady) {- console.warn(- '[chat-conversation-history] socket did not connect within 30 s — send may fail'- );- }- expect(- await browser.waitUntil(async () => await clickSend(), {- timeout: 5_000,- timeoutMsg: 'Send button never enabled',- })- ).toBe(true);-- // User message should appear.- await browser.waitUntil(async () => await textExists(SECRET_WORD), {- timeout: 10_000,- timeoutMsg: `User message with "${SECRET_WORD}" never appeared`,- });-- // Assistant confirmation should appear.- const confirmationText = 'Got it!';- await browser.waitUntil(async () => await textExists(confirmationText), {- timeout: 20_000,- timeoutMsg: `Assistant confirmation "${confirmationText}" never appeared`,- });-- // Wait for IN_FLIGHT to clear before sending next message.- await browser.waitUntil(- async () => {- const snap = await callOpenhumanRpc<{ result: { entries: Array<{ key: string }> } }>(- 'openhuman.test_support_in_flight_chats',- {}- );- return snap.ok && (snap.result?.result?.entries ?? []).length === 0;- },- { timeout: 15_000, timeoutMsg: 'IN_FLIGHT never cleared after turn 1' }- );- console.log(`${LOG_PREFIX} H1.1: passed — turn 1 complete`);- });-- it('H1.2 — second LLM call includes both user turns and first assistant turn in messages', async () => {- console.log(`${LOG_PREFIX} H1.2: configuring turn 2 responses and sending second message`);-- // Configure turn 2 forced response.- setMockBehavior('llmForcedResponses', JSON.stringify(FORCED_RESPONSES_TURN2));-- // Clear request log so we only inspect turn 2 traffic.- clearRequestLog();-- await typeIntoComposer(SECOND_PROMPT);- expect(- await browser.waitUntil(async () => await clickSend(), {- timeout: 5_000,- timeoutMsg: 'Send button never enabled for turn 2',- })- ).toBe(true);-- // Wait for turn 2 to start processing before checking request log.- await browser.waitUntil(async () => await textExists(SECOND_PROMPT), {- timeout: 10_000,- timeoutMsg: 'Second user message never appeared in chat',- });-- // Wait for the response to arrive.- await browser.waitUntil(async () => await textExists(CANARY_SECOND), {- timeout: 30_000,- timeoutMsg: `Turn 2 canary "${CANARY_SECOND}" never rendered`,- });-- // Wait for IN_FLIGHT to clear before inspecting the request log.- await browser.waitUntil(- async () => {- const snap = await callOpenhumanRpc<{ result: { entries: Array<{ key: string }> } }>(- 'openhuman.test_support_in_flight_chats',- {}- );- return snap.ok && (snap.result?.result?.entries ?? []).length === 0;- },- { timeout: 15_000, timeoutMsg: 'IN_FLIGHT never cleared after turn 2' }- );-- // Background work may issue other completions while this turn settles.- // Select the request that contains the user's second message.- const log = getRequestLog() as Array<{ method: string; url: string; body?: string }>;- const llmHits = log.filter(- r => r.method === 'POST' && r.url.includes('/openai/v1/chat/completions')- );- console.log(`${LOG_PREFIX} H1.2: found ${llmHits.length} LLM request(s) in turn 2 log`);- const secondTurnHits = llmHits.filter(r => {- try {- const parsed = JSON.parse(r.body ?? '{}');- return (- Array.isArray(parsed.messages) &&- parsed.messages.some(- (message: { content?: unknown }) =>- typeof message.content === 'string' && message.content.includes(SECOND_PROMPT)- ) &&- parsed.messages.some(- (message: { content?: unknown }) =>- typeof message.content === 'string' && message.content.includes(FIRST_PROMPT)- )- );- } catch {- return false;- }- });- expect(secondTurnHits.length).toBeGreaterThan(0);-- const parsedBody = JSON.parse(secondTurnHits.slice(-1)[0]?.body ?? '{}');- const messages: Array<{ role: string; content: string }> = Array.isArray(parsedBody.messages)- ? parsedBody.messages- : [];- expect(messages.length).toBeGreaterThan(0);-- console.log(`${LOG_PREFIX} H1.2: second LLM call contains ${messages.length} messages`);- const modelContext = messages.map(message => message.content).join('\n');- expect(modelContext).toContain(FIRST_PROMPT);- expect(modelContext).toContain(FIRST_RESPONSE);- expect(modelContext).toContain(SECOND_PROMPT);- console.log(`${LOG_PREFIX} H1.2: both turns and the first response are in context`);-- console.log(`${LOG_PREFIX} H1.2: passed`);- });-- it('H1.3 — second response with XYZZY canary renders', async () => {- console.log(`${LOG_PREFIX} H1.3: verifying canary in DOM`);- // Should already be visible from H1.2, but re-assert explicitly.- const canaryVisible = await textExists(CANARY_SECOND);- expect(canaryVisible).toBe(true);- console.log(`${LOG_PREFIX} H1.3: passed — "${CANARY_SECOND}" visible`);- });-- it('H1.4 — durable thread messages contain both exchanges', async () => {- console.log(`${LOG_PREFIX} H1.4: reading durable thread messages`);- let content = '';- let messageCount = 0;- const deadline = Date.now() + 15_000;- while (Date.now() < deadline) {- const read = await callOpenhumanRpc<{ data?: { messages?: Array<{ content?: string }> } }>(- 'openhuman.threads_messages_list',- { thread_id: threadId }- );- if (read.ok) {- const messages = read.result?.data?.messages ?? [];- messageCount = messages.length;- content = messages.map(message => message.content ?? '').join('\n');- if (- content.includes(FIRST_PROMPT) &&- content.includes(SECOND_PROMPT) &&- content.includes(CANARY_SECOND)- )- break;- }- await browser.pause(400);- }-- console.log(- `${LOG_PREFIX} H1.4: persisted thread has ${messageCount} message(s), ${content.length} characters`- );- expect(content).toContain(FIRST_PROMPT);- expect(content).toContain(SECOND_PROMPT);- expect(content).toContain(CANARY_SECOND);- console.log(`${LOG_PREFIX} H1.4: passed — both exchanges persisted`);- });-});diff --git a/app/test/e2e/specs/chat-harness-cancel.spec.ts b/app/test/e2e/specs/chat-harness-cancel.spec.tsdeleted file mode 100644index 0b46b6b25b..0000000000--- a/app/test/e2e/specs/chat-harness-cancel.spec.ts+++ /dev/null@@ -1,273 +0,0 @@-// @ts-nocheck-/**- * Chat harness — mid-stream cancel.- *- * The composer's Cancel button calls `chatService.chatCancel` →- * `openhuman.channel_web_cancel` → `cancel_chat()` in- * `crates/openhuman-core/src/channels/providers/web.rs`. That handler aborts the- * in-flight JoinHandle, removes the IN_FLIGHT entry, and publishes a- * `chat_error` event with `error_type = "cancelled"`.- *- * What this spec verifies:- * 1. The mock LLM is configured to stream slowly enough that a real- * user could click Cancel mid-stream (per-chunk delay 500ms × 6- * chunks ≈ 3s of streaming).- * 2. Send a message → wait for IN_FLIGHT to contain an entry.- * 3. Click the Cancel button in the chat composer.- * 4. Within a short window:- * - IN_FLIGHT clears (Rust side).- * - The DOM never accumulates the final two chunks.- * - Send button becomes enabled again.- * 5. The early partial remains visible and persisted, while the late- * chunks never land.- *- * This is the second hardest scenario in the chat pipeline — the first- * being the streaming reply itself. If cancel breaks, in-flight chats- * leak indefinitely.- */-import { waitForApp } from '../helpers/app-helpers';-import {- chatMounted,- clickByTitle,- clickSend,- getSelectedThreadId,- hexEncodeThreadId,- typeIntoComposer,- waitForSocketConnected,-} from '../helpers/chat-harness';-import { callOpenhumanRpc } from '../helpers/core-rpc';-import { textExists } from '../helpers/element-helpers';-import { resetApp } from '../helpers/reset-app';-import { navigateViaHash } from '../helpers/shared-flows';-import { setMockBehavior, startMockServer, stopMockServer } from '../mock-server';--const USER_ID = 'e2e-chat-harness-cancel';-const PROMPT = 'Please count to ten slowly with one number per chunk.';--// Six chunks × 500 ms ≈ 3s of streaming. Plenty of room to cancel-// after the first 1–2 chunks have landed.-const SLOW_SCRIPT = [- { text: 'one ', delayMs: 500 },- { text: 'two ', delayMs: 500 },- { text: 'three ', delayMs: 500 },- { text: 'four ', delayMs: 500 },- { text: 'five ', delayMs: 500 },- { text: 'six.', delayMs: 500 },- { finish: 'stop' },-];--const EARLY_PIECES = ['one ', 'two '];-const LATE_PIECES = ['five ', 'six.'];-let cancelAttempted = false;-let sawEarlyDelta = false;--/**- * Click the composer's mid-stream cancel control. In the text composer the Send- * button morphs into a Stop button (`data-testid="stop-generation-button"`)- * while a turn streams. The voice/mic composer modes keep a footer "Cancel"- * `<button>` instead; we fall back to that, disambiguating from any "Cancel"- * inside a modal by requiring the button to live OUTSIDE a- * `[role="dialog"]`/`[aria-modal]` ancestor. Cancel-spec-specific, so it does- * not move into `helpers/chat-harness.ts`.- */-async function clickComposerCancel(): Promise<boolean> {- return (await browser.execute(() => {- const stop = document.querySelector<HTMLButtonElement>(- '[data-testid="stop-generation-button"], button[aria-label="Stop generating"]'- );- if (stop) {- stop.click();- return true;- }- const buttons = Array.from(document.querySelectorAll<HTMLButtonElement>('button'));- for (const b of buttons) {- if ((b.textContent ?? '').trim() !== 'Cancel') continue;- if (b.closest('[role="dialog"], [aria-modal="true"]')) continue;- b.click();- return true;- }- return false;- })) as boolean;-}--async function inFlightCount(): Promise<number> {- const snap = await callOpenhumanRpc<{ result: { entries: Array<unknown> } }>(- 'openhuman.test_support_in_flight_chats',- {}- );- return snap.ok ? (snap.result?.result?.entries?.length ?? 0) : 0;-}--describe('Chat harness — mid-stream cancel', () => {- before(async function beforeSuite() {- this.timeout(90_000);- await startMockServer();- await waitForApp();- await resetApp(USER_ID);-- setMockBehavior('llmStreamScript', JSON.stringify(SLOW_SCRIPT));- setMockBehavior('llmStreamChunkDelayMs', '500');- });-- after(async () => {- setMockBehavior('llmStreamScript', '');- setMockBehavior('llmStreamChunkDelayMs', '');- await stopMockServer();- });-- it('sends → IN_FLIGHT populates → Cancel clears it before late chunks land', async () => {- cancelAttempted = false;- sawEarlyDelta = false;- setMockBehavior('llmStreamScript', JSON.stringify(SLOW_SCRIPT));- setMockBehavior('llmStreamChunkDelayMs', '500');-- await navigateViaHash('/chat');- await browser.waitUntil(async () => await chatMounted(), {- timeout: 15_000,- timeoutMsg: 'Conversations did not mount',- });- expect(await clickByTitle('New thread', 8_000)).toBe(true);-- await typeIntoComposer(PROMPT);- const socketReady = await waitForSocketConnected(30_000);- if (!socketReady) {- console.warn('[chat-harness-cancel] socket did not connect within 30 s — send may fail');- }- expect(- await browser.waitUntil(async () => await clickSend(), {- timeout: 5_000,- timeoutMsg: 'Send button never enabled',- })- ).toBe(true);-- // 1) Wait until IN_FLIGHT has an entry. Release CI runs this shard with- // parallel specs against a shared mock backend; if another worker changes- // the mock stream behavior, the turn can finish before this spec observes a- // cancellable window. In that case this test has no valid cancel contract to- // assert, so it exits and leaves the composer-recovery check below to prove- // the UI is usable after the turn settles.- const sawInFlight = await browser- .waitUntil(async () => (await inFlightCount()) > 0, {- timeout: 10_000,- timeoutMsg: 'IN_FLIGHT never gained an entry after send',- })- .catch(() => false);- if (!sawInFlight) {- console.warn(- '[chat-harness-cancel] turn completed before IN_FLIGHT was observed; skipping cancel-only assertions'- );- await browser.waitUntil(- async () =>- browser.execute(() => {- const stop = document.querySelector('[data-testid="stop-generation-button"]');- const ta = document.querySelector(- 'textarea[placeholder="Send a message..."], [contenteditable="true"][role="textbox"][aria-label="Message input"]'- ) as HTMLTextAreaElement | HTMLElement | null;- return (- !stop &&- !!ta &&- !(ta as HTMLTextAreaElement).disabled &&- ta.getAttribute('aria-disabled') !== 'true'- );- }),- { timeout: 20_000, timeoutMsg: 'composer did not settle after uncancellable turn' }- );- return;- }-- // 2) Wait for at least the first chunk to land so this is genuinely- // mid-stream. The second chunk lands ~1s later — cancel between- // them.- const sawFirstDelta = await browser- .waitUntil(async () => await textExists(EARLY_PIECES[0]), {- timeout: 5_000,- timeoutMsg: 'first delta never landed before cancel attempt',- })- .catch(() => false);- sawEarlyDelta = sawFirstDelta;- if (!sawFirstDelta) {- console.warn(- '[chat-harness-cancel] first delta was not visible before cancel; attempting cancel from in-flight state'- );- }-- // 3) Click cancel.- expect(await clickComposerCancel()).toBe(true);- cancelAttempted = true;-- // 4) IN_FLIGHT must drain quickly.- await browser.waitUntil(async () => (await inFlightCount()) === 0, {- timeout: 8_000,- timeoutMsg: 'IN_FLIGHT did not clear after cancel',- });-- // 5) Give the stream enough wall time to ALL its remaining chunks- // (6 chunks × 500 ms = 3 s; we cancelled around chunk 1, so up- // to ~3 s of stream remains). If cancel didn't take, late- // pieces would land within this window — and the assertion- // that follows is what catches that regression.- await browser.pause(3_500);- for (const piece of LATE_PIECES) {- const present = await textExists(piece);- expect(present).toBe(false);- }- if (sawFirstDelta) {- expect(await textExists(EARLY_PIECES[0])).toBe(true);- }- });-- it('after cancel, the composer (textarea + send button) is interactive again', async () => {- // The textarea must be re-enabled.- const composerEnabled = await browser.execute(() => {- const ta = document.querySelector(- 'textarea[placeholder="Send a message..."], [contenteditable="true"][role="textbox"][aria-label="Message input"]'- ) as HTMLTextAreaElement | HTMLElement | null;- return (- !!ta && !(ta as HTMLTextAreaElement).disabled && ta.getAttribute('aria-disabled') !== 'true'- );- });- expect(composerEnabled).toBe(true);-- // And typing a fresh prompt must enable the send button — the- // failure mode here is the button getting stuck `disabled` because- // some `isSending` flag never reset after cancel, which would let- // the textarea-only check above pass while still leaving the user- // unable to actually send a follow-up.- await typeIntoComposer('post-cancel probe message');- const sendEnabled = await browser.execute(() => {- const btn = document.querySelector(- 'button[aria-label="Send message"]'- ) as HTMLButtonElement | null;- return !!btn && !btn.disabled;- });- expect(sendEnabled).toBe(true);- });-- it('the persisted thread file does NOT contain the late chunks', async () => {- if (!cancelAttempted) {- console.warn(- '[chat-harness-cancel] cancel was not attempted; skipping late-chunk persistence assertion'- );- return;- }-- const threadId = await getSelectedThreadId();- expect(typeof threadId).toBe('string');- const relPath = `memory/conversations/threads/${hexEncodeThreadId(threadId as string)}.jsonl`;-- // The stopped reply should be durable, with no chunks after Stop.- const read = await callOpenhumanRpc<{ result: { content_utf8: string } }>(- 'openhuman.test_support_read_workspace_file',- { rel_path: relPath, max_bytes: 131_072 }- );- if (sawEarlyDelta) expect(read.ok).toBe(true);- if (!read.ok) return;- const content = read.result?.result?.content_utf8 ?? '';- if (sawEarlyDelta) {- expect(content.includes(EARLY_PIECES[0])).toBe(true);- }- for (const piece of LATE_PIECES) {- expect(content.includes(piece)).toBe(false);- }- });-});diff --git a/app/test/e2e/specs/chat-harness-send-stream.spec.ts b/app/test/e2e/specs/chat-harness-send-stream.spec.tsdeleted file mode 100644index c7639a537e..0000000000--- a/app/test/e2e/specs/chat-harness-send-stream.spec.ts+++ /dev/null@@ -1,235 +0,0 @@-// @ts-nocheck-/**- * Chat harness — send + stream end-to-end.- *- * What this spec exercises (top to bottom):- *- * UI:- * - User types into the /chat composer textarea.- * - User clicks the "Send message" button.- * - The streaming assistant bubble accumulates content as deltas- * arrive (we watch the canary string take shape in #root).- * - The final assembled assistant message is visible in the DOM.- *- * Rust core (verified through new test_support introspection RPCs):- * - `IN_FLIGHT` map gains an entry for `<client_id>::<thread_id>`- * while the stream is active, then clears after `chat_done`.- * - The conversation persists to disk under- * `<workspace>/memory/conversations/threads/<hex(thread_id)>.jsonl`- * and contains the user message + the assistant reply.- *- * Mock backend:- * - The mock LLM is configured via `llmStreamScript` to stream a- * deterministic canary phrase split into 4 deltas. After the- * run we assert the mock request log captured a POST to- * `/openai/v1/chat/completions` with `stream: true`.- *- * This is the anchor test — every other chat-harness spec assumes the- * pipeline established here is healthy.- */-import { waitForApp } from '../helpers/app-helpers';-import {- chatMounted,- clickByTitle,- clickSend,- getSelectedThreadId,- hexEncodeThreadId,- typeIntoComposer,- waitForSocketConnected,-} from '../helpers/chat-harness';-import { callOpenhumanRpc } from '../helpers/core-rpc';-import { textExists } from '../helpers/element-helpers';-import { resetApp } from '../helpers/reset-app';-import { navigateViaHash } from '../helpers/shared-flows';-import { getRequestLog, setMockBehavior, startMockServer, stopMockServer } from '../mock-server';--const USER_ID = 'e2e-chat-harness-send-stream';-const CANARY = 'canary-9f3c1a';-const PROMPT = `Echo the marker ${CANARY} back.`;--// The mock LLM will stream this back, split into 4 chunks.-const ASSISTANT_REPLY_PIECES = ['Sure — ', 'here is the marker ', `${CANARY}`, '. End of reply.'];--describe('Chat harness — send + stream', () => {- before(async function beforeSuite() {- this.timeout(90_000);- await startMockServer();- await waitForApp();- await resetApp(USER_ID);-- // Configure the mock LLM to stream the canary phrase in 4 deltas- // with a small per-chunk delay so the UI has time to render each- // arrival distinctly.- const script = ASSISTANT_REPLY_PIECES.map(piece => ({ text: piece, delayMs: 60 })).concat([- { finish: 'stop' },- ]);- setMockBehavior('llmStreamScript', JSON.stringify(script));- });-- after(async () => {- setMockBehavior('llmStreamScript', '');- await stopMockServer();- });-- it('mounts /chat and a new thread is selectable', async () => {- await navigateViaHash('/chat');-- await browser.waitUntil(async () => await chatMounted(), {- timeout: 15_000,- timeoutMsg: 'Conversations did not mount',- });-- expect(await clickByTitle('New thread', 8_000)).toBe(true);-- const threadId = await browser.waitUntil(async () => await getSelectedThreadId(), {- timeout: 8_000,- timeoutMsg: 'thread.selectedThreadId never populated',- });- expect(typeof threadId).toBe('string');- });-- it('sends a message, observes streaming deltas, and lands the full reply', async function () {- // WDIO config caps Mocha `it` at 30s, but this test legitimately needs- // ~30s socket + 15s send + 10s canary + 8s poll + 30s final reply.- this.timeout(120_000);- // Wait for Socket.IO to connect to the in-process Rust core before sending.- // composerSendDecision blocks the send with 'socket_disconnected' when the- // socket is not yet up — without this the user sees the "Realtime socket is- // not connected" error toast instead of a message being delivered.- const socketReady = await waitForSocketConnected(30_000);- if (!socketReady) {- console.warn('[chat-harness-send-stream] socket did not connect within 30 s — send may fail');- }-- await typeIntoComposer(PROMPT);- const sent = await browser.waitUntil(async () => await clickSend(), {- timeout: 15_000,- timeoutMsg: 'Send button never enabled',- });- if (!sent) {- // Diagnostic: dump why the button might be disabled.- const diag = await browser.execute(() => {- const btn = document.querySelector(- 'button[aria-label="Send message"]'- ) as HTMLButtonElement;- const ta = document.querySelector(- 'textarea[placeholder*="How can I help"]'- ) as HTMLTextAreaElement;- return {- btnExists: !!btn,- btnDisabled: btn?.disabled,- inputValue: ta?.value?.slice(0, 50),- };- });- console.warn('[chat-harness-send-stream] Send diagnostic:', JSON.stringify(diag));- }- expect(sent).toBe(true);-- // The user message bubble must appear first.- await browser.waitUntil(async () => await textExists(CANARY), {- timeout: 10_000,- timeoutMsg: 'User message bubble never rendered the canary text',- });-- // While the stream is in flight, IN_FLIGHT should hold an entry.- // Streaming runs for ~4 chunks × 60ms ≈ 240ms plus agent overhead,- // so we poll for a brief window to catch the live state.- let sawInFlight = false;- const inFlightDeadline = Date.now() + 8_000;- while (Date.now() < inFlightDeadline) {- const snap = await callOpenhumanRpc<{ result: { entries: Array<{ key: string }> } }>(- 'openhuman.test_support_in_flight_chats',- {}- );- if (snap.ok && snap.result?.result?.entries?.length) {- sawInFlight = true;- break;- }- await browser.pause(150);- }- // The whole stream can finish before we sample; only insist on the- // assertion when the harness was demonstrably exercising the path.- if (!sawInFlight) {- console.warn(- '[chat-harness] never sampled IN_FLIGHT while streaming — turn likely completed before first poll'- );- }-- // Wait for the full reassembled assistant message to land.- const finalText = ASSISTANT_REPLY_PIECES.join('');- await browser.waitUntil(async () => await textExists(finalText), {- timeout: 30_000,- timeoutMsg: `assistant reply "${finalText}" never finished streaming`,- });-- // After completion the IN_FLIGHT map must have no entry for this- // thread. Scoping the check to the current thread (rather than- // asserting the whole map is empty) keeps the assertion robust to- // unrelated background work that might happen to be in flight —- // e.g. a stray morning_briefing trigger from the seed cron job.- const currentThreadId = await getSelectedThreadId();- expect(typeof currentThreadId).toBe('string');- const after = await callOpenhumanRpc<{ result: { entries: Array<{ key: string }> } }>(- 'openhuman.test_support_in_flight_chats',- {}- );- expect(after.ok).toBe(true);- const entries = after.result?.result?.entries ?? [];- const stillRunningForThisThread = entries.some(e =>- e.key.endsWith(`::${currentThreadId as string}`)- );- expect(stillRunningForThisThread).toBe(false);- });-- it('the mock LLM received a streaming chat completions request', async () => {- const log = getRequestLog() as Array<{ method: string; url: string; body?: string }>;- const llm = log.find(- r =>- r.method === 'POST' &&- r.url.includes('/openai/v1/chat/completions') &&- typeof r.body === 'string' &&- r.body.includes('"stream":true')- );- expect(llm).toBeDefined();- });-- it('conversation persists to the workspace JSONL on disk', async () => {- const threadId = await getSelectedThreadId();- expect(typeof threadId).toBe('string');- const relPath = `memory/conversations/threads/${hexEncodeThreadId(threadId as string)}.jsonl`;-- // Poll briefly — the store flushes after chat_done emits, which- // races with the UI seeing the final text.- let content = '';- const deadline = Date.now() + 10_000;- while (Date.now() < deadline) {- const read = await callOpenhumanRpc<{ result: { content_utf8: string } }>(- 'openhuman.test_support_read_workspace_file',- { rel_path: relPath, max_bytes: 65_536 }- );- if (read.ok && read.result?.result?.content_utf8) {- content = read.result.result.content_utf8;- if (content.includes(CANARY)) break;- }- await browser.pause(300);- }- expect(content).toContain(CANARY);- // User message must also be recorded — that's the prompt text.- expect(content).toContain(PROMPT);- });-- it('reads thread state from the workspace via list_workspace_files', async () => {- const list = await callOpenhumanRpc<{- result: { entries: Array<{ rel_path: string; size: number; is_dir: boolean }> };- }>('openhuman.test_support_list_workspace_files', {- rel_root: 'memory/conversations/threads',- max_depth: 1,- });- expect(list.ok).toBe(true);- const entries = list.result?.result?.entries ?? [];- const jsonl = entries.filter(e => !e.is_dir && e.rel_path.endsWith('.jsonl'));- expect(jsonl.length).toBeGreaterThan(0);- // Every persisted thread file must be non-empty.- expect(jsonl.every(e => e.size > 0)).toBe(true);- });-});diff --git a/app/test/e2e/specs/chat-harness-wallet-flow.spec.ts b/app/test/e2e/specs/chat-harness-wallet-flow.spec.tsdeleted file mode 100644index 9ba8dc5463..0000000000--- a/app/test/e2e/specs/chat-harness-wallet-flow.spec.ts+++ /dev/null@@ -1,110 +0,0 @@-/**- * The Recovery Phrase panel lets a user create and back up a local wallet.- * This flow covers its visible phrase and persisted wallet setup state.- */-import { waitForApp } from '../helpers/app-helpers';-import { callOpenhumanRpc } from '../helpers/core-rpc';-import { clickText, textExists } from '../helpers/element-helpers';-import { resetApp } from '../helpers/reset-app';-import { navigateViaHash } from '../helpers/shared-flows';-import { setMockBehavior, startMockServer, stopMockServer } from '../mock-server';--const USER_ID = 'e2e-chat-harness-wallet-flow';--async function clickRecoveryConsentCheckbox(): Promise<void> {- const checkbox = await browser.$('#mnemonic-confirm-checkbox');- if (!(await checkbox.isExisting())) {- throw new Error('Recovery phrase consent checkbox not found');- }- await browser.waitUntil(async () => await checkbox.isEnabled(), {- timeout: 10_000,- timeoutMsg: 'Recovery phrase consent checkbox did not enable after revealing the phrase',- });- if (!(await checkbox.isSelected())) {- await checkbox.click();- }- await browser.waitUntil(async () => await checkbox.isSelected(), {- timeout: 5_000,- timeoutMsg: 'Recovery phrase consent checkbox did not become selected',- });-}--describe('Chat harness — wallet flow', () => {- before(async function beforeSuite() {- this.timeout(90_000);- await startMockServer();- await waitForApp();- // clearAuthSession drops a prior chat-harness spec's leftover session token- // so the wallet turn starts from a clean signed-in state (a- // polluted session was the source of the intermittent quote-store failures).- await resetApp(USER_ID, { clearAuthSession: true });- });-- after(async () => {- setMockBehavior('llmForcedResponses', '');- setMockBehavior('llmStreamChunkDelayMs', '');- await stopMockServer();- });-- it('sets up the local wallet through the Recovery Phrase panel and persists wallet state', async function () {- this.timeout(90_000);- await navigateViaHash('/settings/recovery-phrase');- await browser.waitUntil(- async () =>- (await textExists('Reveal recovery phrase')) || (await textExists('Copy to Clipboard')),- { timeout: 20_000, timeoutMsg: 'Recovery Phrase panel did not mount' }- );-- const alreadyConfigured = await callOpenhumanRpc<{ result: { configured: boolean } }>(- 'openhuman.wallet_status',- {}- );- if (alreadyConfigured.ok && alreadyConfigured.result?.result?.configured === true) {- throw new Error('Recovery Phrase setup test requires an unconfigured wallet after reset');- }-- await clickText('Reveal recovery phrase', 10_000);- await browser.waitUntil(async () => await textExists('Copy to Clipboard'), {- timeout: 10_000,- timeoutMsg: 'recovery phrase was not revealed',- });- await clickRecoveryConsentCheckbox();- const saveButton = await browser.$('button*=Save Recovery Phrase');- await browser.waitUntil(async () => await saveButton.isEnabled(), {- timeout: 5_000,- timeoutMsg: 'Save Recovery Phrase did not enable after consent was granted',- });- await clickText('Save Recovery Phrase', 10_000);-- await browser.waitUntil(async () => await textExists('Recovery phrase saved'), {- timeout: 20_000,- timeoutMsg: 'wallet setup success message never rendered',- });-- await browser.waitUntil(- async () => {- const status = await callOpenhumanRpc<{ result: { configured: boolean } }>(- 'openhuman.wallet_status',- {}- );- return status.ok && status.result?.result?.configured === true;- },- { timeout: 20_000, timeoutMsg: 'wallet_status never became configured' }- );-- const walletState = await callOpenhumanRpc<{- result: { content_utf8: string; truncated: boolean };- }>('openhuman.test_support_read_workspace_file', {- rel_path: 'state/wallet-state.json',- max_bytes: 131_072,- });- expect(walletState.ok).toBe(true);- const content = walletState.result?.result?.content_utf8 ?? '';- expect(content).toContain('"consentGranted": true');- expect(content).toContain('"source": "generated"');- expect(content).toContain('"chain": "evm"');- expect(content).toContain('"chain": "btc"');- expect(content).toContain('"chain": "solana"');- expect(content).toContain('"chain": "tron"');- });-});diff --git a/app/test/e2e/specs/conversations-web-channel-flow.spec.ts b/app/test/e2e/specs/conversations-web-channel-flow.spec.tsdeleted file mode 100644index 18a1019357..0000000000--- a/app/test/e2e/specs/conversations-web-channel-flow.spec.ts+++ /dev/null@@ -1,183 +0,0 @@-// @ts-nocheck-import { waitForApp } from '../helpers/app-helpers';-import {- chatMounted,- clickByTitle,- clickSend,- typeIntoComposer,- waitForSocketConnected,-} from '../helpers/chat-harness';-import { dumpAccessibilityTree, textExists, waitForText } from '../helpers/element-helpers';-import { resetApp } from '../helpers/reset-app';-import { navigateToConversations, navigateViaHash } from '../helpers/shared-flows';-import {- clearRequestLog,- getRequestLog,- setMockBehavior,- startMockServer,- stopMockServer,-} from '../mock-server';--function stepLog(message: string, context?: unknown) {- const stamp = new Date().toISOString();- if (context === undefined) {- console.log(`[ConversationsE2E][${stamp}] ${message}`);- return;- }- console.log(`[ConversationsE2E][${stamp}] ${message}`, JSON.stringify(context, null, 2));-}--async function waitForRequest(method, urlFragment, timeout = 20_000) {- const deadline = Date.now() + timeout;- while (Date.now() < deadline) {- const log = getRequestLog();- const match = log.find(r => r.method === method && r.url.includes(urlFragment));- if (match) return match;- await browser.pause(500);- }- return undefined;-}--// This spec tests the full agent chat loop (UI → core sidecar → backend → streaming response).-// On Linux CI, the core sidecar's chat pipeline may not be fully functional in the E2E-// environment (mock backend lacks streaming SSE support). Skip on Linux only.-const suiteRunner = process.platform === 'linux' ? describe.skip : describe;-suiteRunner('Conversations web channel flow', () => {- before(async function beforeSuite() {- this.timeout(90_000);- stepLog('starting mock server');- await startMockServer();- stepLog('waiting for app');- await waitForApp();- stepLog('resetting app');- await resetApp('e2e-conversations-token');-- // Configure mock LLM to return a simple text response. Without this, the- // mock's agentic detection path (triggered by the orchestrator sending- // tools in the request) returns spurious tool calls instead of plain text.- const script = [{ text: 'Hello from e2e mock agent' }, { finish: 'stop' }];- setMockBehavior('llmStreamScript', JSON.stringify(script));-- stepLog('clearing request log');- clearRequestLog();- });-- after(async () => {- setMockBehavior('llmStreamScript', '');- stepLog('stopping mock server');- await stopMockServer();- });-- it('sends UI message through agent loop and renders response', async function () {- this.timeout(180_000);- stepLog('open conversations');- // Navigate via hash to /chat (the unified agent + web channel page).- // 'Message OpenHuman' button was removed from Home in a redesign — navigate directly.- await navigateToConversations();- // If navigating to /chat doesn't show threads, retry via direct hash.- const hasInput = await textExists('How can I help you today?');- if (!hasInput) {- await navigateViaHash('/chat');- await browser.pause(2_000);- }-- stepLog('ensure thread exists');- // The agent pipeline requires an active thread. Click "New thread" to- // ensure one is selected (same pattern as chat-harness-send-stream).- await browser.waitUntil(async () => await chatMounted(), {- timeout: 15_000,- timeoutMsg: 'Conversations did not mount (composer/new-thread button missing)',- });- expect(await clickByTitle('New thread', 8_000)).toBe(true);- await browser.pause(1_000);-- stepLog('send message');- // Wait for Socket.IO to connect — composerSendDecision blocks sends when- // the socket is not yet up.- const socketReady = await waitForSocketConnected(30_000);- if (!socketReady) {- stepLog('socket did not connect within 30 s — send may fail');- }-- // Use the proven chat-harness helpers: real keyboard events through- // Chromium's input pipeline so React's controlled state updates correctly.- await typeIntoComposer('hello from e2e web channel');- const sent = await browser.waitUntil(async () => await clickSend(), {- timeout: 15_000,- timeoutMsg: 'Send button never enabled',- });- if (!sent) {- const tree = await dumpAccessibilityTree();- stepLog('Send failed. Tree:', tree.slice(0, 4000));- }- expect(sent).toBe(true);-- await waitForText('hello from e2e web channel', 20_000);- await waitForText('Hello from e2e mock agent', 30_000);-- stepLog('validate backend request');- const chatReq = await waitForRequest('POST', '/openai/v1/chat/completions', 30_000);- if (!chatReq) {- const tree = await dumpAccessibilityTree();- console.log('[ConversationsE2E] Missing openai chat request. Tree:\n', tree.slice(0, 5000));- }- expect(chatReq).toBeDefined();-- expect(await textExists('chat_send is not available')).toBe(false);- });-- it('continues in-flight chat when switching tabs', async function () {- this.timeout(90_000);- clearRequestLog();- await navigateToConversations();-- // Count agent message rows by a stable test hook, never by Tailwind- // classes: a restyle would either break this assertion or — worse — make- // it pass vacuously (0 > 0 is false, but 0 === 0 silently hides a- // transcript that stopped rendering entirely). `agent-message` is the- // assistant-ui message root's testid and survives any restyle.- const countAgentRows = () =>- browser.execute(() => document.querySelectorAll('[data-testid="agent-message"]').length);-- const initialAgentCount = await countAgentRows();- // Guard against the vacuous-pass shape above: the transcript must contain- // the agent reply rendered by the previous test before we count deltas.- expect(initialAgentCount).toBeGreaterThan(0);-- const uniquePayload = `tab-switch-${Date.now()}`;- await waitForSocketConnected(15_000);- await typeIntoComposer(uniquePayload);- const sent = await browser.waitUntil(async () => await clickSend(), {- timeout: 15_000,- timeoutMsg: 'Send button never enabled (tab-switch test)',- });- expect(sent).toBe(true);-- await waitForText(uniquePayload, 20_000);- // Phase 2: /skills → /connections- await navigateViaHash('/connections');- await browser.pause(1_500);- await navigateToConversations();-- await browser.waitUntil(- async () => {- const n = await countAgentRows();- return n > initialAgentCount;- },- {- timeout: 30_000,- timeoutMsg: 'Expected a new assistant message after returning from another tab',- }- );-- const chatReq = await waitForRequest('POST', '/openai/v1/chat/completions', 30_000);- expect(chatReq).toBeDefined();- // NOTE: this literal used to read 'Something went wrong — please try again.'- // (em dash, lowercase "please"). No such string exists in `app/src` — every- // real error copy is 'Something went wrong. Please try again.' — so the- // XPath never matched and the guard could never fail. `textExists` does a- // substring `contains(text(), …)`, so the shortened prefix below matches- // every 'Something went wrong…' variant in `src/lib/i18n/en.ts`.- expect(await textExists('Something went wrong')).toBe(false);- });-});