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: stabilize frontend and browser harness coverage
Steven Enamakel1e1c94fa5c9d
diff --git a/app/scripts/e2e-web-session.sh b/app/scripts/e2e-web-session.shindex 189678e4d3..3b61084577 100755--- a/app/scripts/e2e-web-session.sh+++ b/app/scripts/e2e-web-session.sh@@ -205,6 +205,11 @@ if [ ! -x "$OPENHUMAN_CORE_BIN" ]; thenfiexport OPENHUMAN_CORE_TOKEN="$PW_CORE_RPC_TOKEN"+# The deterministic browser lane scripts direct tool calls (cron, edits,+# parallel agents, and similar) rather than exercising the model's `use_skill`+# disclosure choreography. Advertise the compiled tool packs for this harness+# core only; production hosts retain the fail-closed packed default.+export OPENHUMAN_E2E=1# The skills registry defaults to a public HermesHub fetch. The browser E2E# lane must remain deterministic and offline, so serve its compact catalog# fixture from the local mock backend instead.diff --git a/app/src/components/assistant-ui/thread.tsx b/app/src/components/assistant-ui/thread.tsxindex d84bcb3ce3..8fc0722240 100644--- a/app/src/components/assistant-ui/thread.tsx+++ b/app/src/components/assistant-ui/thread.tsx@@ -967,10 +967,15 @@ const Composer: FC<{debug('[assistant-composer] paste: refused, ingest not accepting');return;}- const files = Array.from(event.clipboardData?.items ?? [])+ const itemFiles = Array.from(event.clipboardData?.items ?? []).filter(item => item.kind === 'file' && /^(image|video)\//.test(item.type)).map(item => item.getAsFile()).filter((file): file is File => file !== null);+ // Real clipboard events expose media through `items`; synthetic browser+ // events (including the Playwright path) may populate only `files`.+ // Accept both representations so paste follows the same ingest path as+ // the picker and dropzone.+ const files = itemFiles.length > 0 ? itemFiles : Array.from(event.clipboardData?.files ?? []);if (files.length === 0) {// The overwhelmingly common case: an ordinary text paste. Left for Lexical.return;diff --git a/app/src/components/ui/Sidebar.tsx b/app/src/components/ui/Sidebar.tsxindex ee4dd9d9b1..213983b78c 100644--- a/app/src/components/ui/Sidebar.tsx+++ b/app/src/components/ui/Sidebar.tsx@@ -296,7 +296,15 @@ export const Sidebar = forwardRef<HTMLDivElement, SidebarProps>('flex h-full min-h-0 min-w-0 flex-none flex-col overflow-hidden text-content',className)}- style={{ width: collapsed ? SIDEBAR_ICON_WIDTH : width, ...(style ?? {}) }}+ // Keep the rendered column inside half of a narrow viewport even when+ // a persisted width arrives before the provider has observed resize.+ // The provider still clamps its value for drag/ARIA consistency; this+ // CSS guard closes the first-paint gap during a viewport transition.+ style={{+ width: collapsed ? SIDEBAR_ICON_WIDTH : width,+ maxWidth: '50vw',+ ...(style ?? {}),+ }}{...rest}>{children}</div>diff --git a/app/src/pages/__tests__/Conversations.render.test.tsx b/app/src/pages/__tests__/Conversations.render.test.tsxindex f798bb79fc..870088d36f 100644--- a/app/src/pages/__tests__/Conversations.render.test.tsx+++ b/app/src/pages/__tests__/Conversations.render.test.tsx@@ -1180,7 +1180,7 @@ describe('Conversations — smoke render (#1123 welcome-lock removal)', () => {return { store: store!, thread };}- it('requests the cancel on Stop and leaves saving the partial to the confirmed cancel (#4862)', async () => {+ it('requests cancellation without persisting the partial before core confirmation (#4862)', async () => {const { thread } = await renderStreamingConversation({ streamingContent: 'half a thought' });const stopButton = await screen.findByRole('button', { name: 'Stop generating' });@@ -1189,11 +1189,9 @@ describe('Conversations — smoke render (#1123 welcome-lock removal)', () => {});expect(chatCancel).toHaveBeenCalledWith(thread.id);- // The stopped partial is saved when the core confirms the cancel- // (`chat_cancelled` → ChatRuntimeProvider's `onCancelled`, covered in- // ChatRuntimeProvider.test.tsx: "persists the live partial as a stopped- // reply"), not optimistically here. Saving on click raced the core's own- // save and left a stopped bubble behind when the cancel did not land.+ // Persistence belongs to ChatRuntimeProvider.onCancelled after the core+ // confirms the turn that actually stopped. The click path must not write+ // early because a rejected cancellation can still produce a final reply.await act(async () => {await Promise.resolve();});@@ -1259,7 +1257,7 @@ describe('Conversations — smoke render (#1123 welcome-lock removal)', () => {expect(threadApi.appendMessage).not.toHaveBeenCalled();});- it('never saves a partial locally across repeated Stop clicks (#4862)', async () => {+ it('does not locally persist a partial across repeated Stop clicks (#4862)', async () => {const { thread } = await renderStreamingConversation({ streamingContent: 'half a thought' });const stopButton = await screen.findByRole('button', { name: 'Stop generating' });@@ -1269,10 +1267,9 @@ describe('Conversations — smoke render (#1123 welcome-lock removal)', () => {fireEvent.click(stopButton);});- expect(chatCancel).toHaveBeenCalledWith(thread.id);- // One save happens later, from the confirmed cancel, deduped per request- // (ChatRuntimeProvider.test.tsx: "does not double-persist a partial").- // Repeated clicks must not add a local save of their own.+ expect(chatCancel).toHaveBeenCalledTimes(2);+ expect(chatCancel).toHaveBeenNthCalledWith(1, thread.id);+ expect(chatCancel).toHaveBeenNthCalledWith(2, thread.id);await act(async () => {await Promise.resolve();});diff --git a/app/src/providers/__tests__/ChatRuntimeProvider.test.tsx b/app/src/providers/__tests__/ChatRuntimeProvider.test.tsxindex 590b870f7d..76394fd1ed 100644--- a/app/src/providers/__tests__/ChatRuntimeProvider.test.tsx+++ b/app/src/providers/__tests__/ChatRuntimeProvider.test.tsx@@ -20,7 +20,6 @@ import {import { pendingFollowupAdded } from '../../store/queueSlice';import { setStatusForUser } from '../../store/socketSlice';import {- addMessageLocal,clearAllThreads,loadThreads,setActiveThread,@@ -2655,48 +2654,37 @@ describe('ChatRuntimeProvider — chat_cancelled (wire-contract.md)', () => {);});- it('does not double-persist a partial the local Stop path already saved for the same request', async () => {+ it('persists a repeated chat_cancelled event only once for the same request', async () => {const listeners = renderProvider();const threadId = 't-chat-cancelled-dedupe';- const alreadyPersisted = {- id: 'a-already-stopped',- sender: 'agent' as const,- type: 'text' as const,- content: 'already saved locally',- extraMetadata: { stopped: true, cancelReason: 'user_stop', requestId: 'r-dup' },- createdAt: '2026-01-01T00:00:00.000Z',- };- vi.mocked(threadApi.appendMessage).mockResolvedValueOnce(alreadyPersisted);-- // Seed the local cache exactly as `Conversations.tsx`'s- // `handleStopGeneration` already does for a user-initiated Stop, keyed by- // the same `requestId` this turn's `chat_cancelled` will carry.- await act(async () => {- await store.dispatch(addMessageLocal({ threadId, message: alreadyPersisted })).unwrap();- });- expect(threadApi.appendMessage).toHaveBeenCalledTimes(1);act(() => {store.dispatch(setStreamingAssistantForThread({threadId,- streaming: { content: 'already saved locally', thinking: '', requestId: 'r-dup' },+ streaming: { content: 'save this once', thinking: '', requestId: 'r-dup' },}));});act(() => {- listeners.onCancelled?.({+ const event = {thread_id: threadId,request_id: 'r-dup',cancel_reason: 'user_stop',- });+ } as const;+ listeners.onCancelled?.(event);+ listeners.onCancelled?.(event);});- await new Promise(resolve => setTimeout(resolve, 50));- // Still just the one call from the seed above — `onCancelled` must not- // have persisted a second copy of the same partial.- expect(threadApi.appendMessage).toHaveBeenCalledTimes(1);+ await waitFor(() => expect(threadApi.appendMessage).toHaveBeenCalledTimes(1));+ expect(threadApi.appendMessage).toHaveBeenCalledWith(+ threadId,+ expect.objectContaining({+ content: 'save this once',+ extraMetadata: expect.objectContaining({ stopped: true, requestId: 'r-dup' }),+ })+ );});it('produces no message when nothing streamed (no partial to save)', async () => {diff --git a/app/test/playwright/specs/card-payment-flow.spec.ts b/app/test/playwright/specs/card-payment-flow.spec.tsindex ce747f0aac..1131d862cb 100644--- a/app/test/playwright/specs/card-payment-flow.spec.ts+++ b/app/test/playwright/specs/card-payment-flow.spec.ts@@ -9,18 +9,18 @@ import {test.describe('Card Payment Flow', () => {test.beforeEach(async ({ page }, testInfo) => {const slug = testInfo.title.toLowerCase().replace(/[^a-z0-9]+/g, '-');- await bootAuthenticatedPage(page, `pw-card-payment-${slug}`, '/settings/billing');+ await bootAuthenticatedPage(page, `pw-card-payment-${slug}`, '/settings/account');});- test('billing panel shows the moved-to-web redirect page', async ({ page }) => {+ test('account settings exposes the billing redirect', async ({ page }) => {await waitForAppReady(page);- await expect(page.getByRole('heading', { name: 'Billing', exact: true })).toBeVisible();- await expect(page.getByText(/Billing moved to the web/i)).toBeVisible();+ await expect(page.getByTestId('account-panel')).toBeVisible();+ await expect(page.getByRole('button', { name: 'Billing' })).toBeVisible();});- test('open billing dashboard button is present', async ({ page }) => {+ test('billing button is present', async ({ page }) => {await waitForAppReady(page);- await expect(page.getByRole('button', { name: 'Open billing dashboard' })).toBeVisible();+ await expect(page.getByRole('button', { name: 'Billing' })).toBeVisible();});test('back-to-settings navigation works', async ({ page }) => {diff --git a/app/test/playwright/specs/chat-composer-attachment-gate.spec.ts b/app/test/playwright/specs/chat-composer-attachment-gate.spec.tsindex 08e8890938..5058d45ae5 100644--- a/app/test/playwright/specs/chat-composer-attachment-gate.spec.ts+++ b/app/test/playwright/specs/chat-composer-attachment-gate.spec.ts@@ -215,10 +215,9 @@ test.describe('Chat composer attachment gate', () => {await stopButton(page).click();await expect(stopButton(page)).toHaveCount(0, { timeout: 20_000 });- // Removing Cancel means the cancellation request has been accepted, but- // the host-owned composer controls remount on the following idle render.- // Wait for that settled state before locating its attachment control.- await expect(page.getByTestId('composer-human-mode')).toBeVisible({ timeout: 20_000 });+ // Stop preserves the prompt for editing, so the primary slot is Send;+ // attachment controls nevertheless become available immediately.+ await expect(page.getByTestId('send-message-button')).toBeVisible({ timeout: 20_000 });await expect(attachButton(page)).toBeEnabled({ timeout: 20_000 });});diff --git a/app/test/playwright/specs/chat-composer-primary-slot.spec.ts b/app/test/playwright/specs/chat-composer-primary-slot.spec.tsindex 8f093c3453..6b882f5228 100644--- a/app/test/playwright/specs/chat-composer-primary-slot.spec.ts+++ b/app/test/playwright/specs/chat-composer-primary-slot.spec.ts@@ -196,14 +196,16 @@ test.describe('Chat composer primary slot', () => {await expect(sendButton(page)).toHaveCount(0);});- test('Stop ends the turn and the slot returns to the idle action', async ({ page }) => {+ test('Stop ends the turn and restores the send action for the retained draft', async ({ page }) => {await openChat(page);await beginStreamingTurn(page, 'Count slowly for me');await stopButton(page).click();await expect(stopButton(page)).toHaveCount(0, { timeout: 20_000 });- await expect(idleAction(page)).toBeVisible({ timeout: 20_000 });+ // Stop preserves the prompt so the user can edit and resend it. The+ // primary slot therefore returns to Send rather than the idle mascot.+ await expect(sendButton(page)).toBeVisible({ timeout: 20_000 });await expect(composer(page)).toBeVisible();});});diff --git a/app/test/playwright/specs/chat-composer-slash-commands.spec.ts b/app/test/playwright/specs/chat-composer-slash-commands.spec.tsindex ce927bd8c4..4822f94aca 100644--- a/app/test/playwright/specs/chat-composer-slash-commands.spec.ts+++ b/app/test/playwright/specs/chat-composer-slash-commands.spec.ts@@ -143,12 +143,11 @@ test.describe('Composer slash commands', () => {});/**- * CHARACTERISES: `/new` does nothing observable at all.+ * `/new` is consumed locally without creating a thread from the+ * assistant-ui composer. The draft is cleared after the command is handled.** Measured after Enter on `/new`: the selected thread is unchanged, no chat- * completion is requested, no assistant message appears, and the text "/new"- * is still sitting in the composer. From the user's side the key press did- * nothing.+ * completion is requested and no assistant message appears.** All three observations are asserted together on purpose. Any one of them* alone is satisfiable by an unrelated failure — "no completion" is also true@@ -156,7 +155,7 @@ test.describe('Composer slash commands', () => {* my first draft of this file vacuous. Together they describe one specific* broken state, and any real fix breaks at least one of them.*/- test('CHARACTERISES: /new + Enter is a complete no-op', async ({ page }) => {+ test('/new + Enter is consumed locally without sending', async ({ page }) => {const input = await openChat(page);await waitForSocketConnected(page);@@ -171,11 +170,11 @@ test.describe('Composer slash commands', () => {threadBefore);expect(await completionCount(), '"/new" reached the model').toBe(completionsBefore);- expect(await composerText(input), 'the composer was cleared — /new now works').toBe('/new');+ expect(await composerText(input)).toBe('');await expect(page.getByTestId('agent-message')).toHaveCount(0);});- test('CHARACTERISES: /clear + Enter is a complete no-op', async ({ page }) => {+ test('/clear + Enter is consumed locally without sending', async ({ page }) => {const input = await openChat(page);await waitForSocketConnected(page);@@ -188,11 +187,7 @@ test.describe('Composer slash commands', () => {expect(await selectedThreadId(page)).toBe(threadBefore);expect(await completionCount()).toBe(completionsBefore);- // Trimmed: Lexical leaves a trailing space after `/clear` (measured- // "/clear "), which `/new` does not get. Harmless here, but it is a real- // asymmetry between the two commands' text handling and worth knowing if- // anyone ever compares composer text exactly.- expect((await composerText(input)).trim()).toBe('/clear');+ expect(await composerText(input)).toBe('');});/**diff --git a/app/test/playwright/specs/chat-model-override.spec.ts b/app/test/playwright/specs/chat-model-override.spec.tsindex 95cab95ef2..9f8f7da912 100644--- a/app/test/playwright/specs/chat-model-override.spec.ts+++ b/app/test/playwright/specs/chat-model-override.spec.ts@@ -57,14 +57,13 @@ async function openChat(page: Page): Promise<void> {}/**- * The model chip, by its analytics id rather than its accessible name.+ * The model chip, by its stable test id rather than its accessible name.* `getByRole('button', { name: 'Model' })` is ambiguous once a thread exists:* sidebar thread rows are also `role="button"`, and a thread titled from a* prompt about models matches the same name — a strict-mode violation that only* appears after the first turn is sent.*/-const modelChip = (page: Page): Locator =>- page.locator('[data-analytics-id="chat-model-selector"]');+const modelChip = (page: Page): Locator => page.getByTestId('composer-chat-settings');const pickerTitle = (page: Page): Locator => page.getByText('Choose provider and model');/**diff --git a/crates/openhuman-core/src/core/jsonrpc.rs b/crates/openhuman-core/src/core/jsonrpc.rsindex 05d1b0684d..0b86eb1ffb 100644--- a/crates/openhuman-core/src/core/jsonrpc.rs+++ b/crates/openhuman-core/src/core/jsonrpc.rs@@ -1510,6 +1510,12 @@ async fn run_server_with_services(let mut builder = crate::core::runtime::CoreBuilder::new(host_kind).token(token).services(services);+ // The browser E2E harness scripts direct tool calls through its mock model.+ // Keep production's fail-closed packed default, while making those calls+ // visible in the deterministic test core without changing library hosts.+ if std::env::var_os("OPENHUMAN_E2E").is_some() {+ builder = builder.tool_groups(crate::tools::toolpacks::ToolGroups::advertised());+ }if let Some(host) = host {builder = builder.host(host);}