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(e2e): unskip quarantined specs and give them real assertions
M3gA-Mind1dca509f1f71
diff --git a/app/test/e2e/helpers/composio-helpers.ts b/app/test/e2e/helpers/composio-helpers.tsindex a7ea918aee..dba4b45846 100644--- a/app/test/e2e/helpers/composio-helpers.ts+++ b/app/test/e2e/helpers/composio-helpers.ts@@ -113,7 +113,6 @@ export async function openConnectorModal(const statusDeadline = Date.now() + timeout;while (Date.now() < statusDeadline) {if (await textExists(waitForTileStatus)) break;- // @ts-expect-error -- browser global is injected by WDIO at runtime, not typed in this envawait browser.pause(300);}} catch {@@ -138,7 +137,6 @@ export async function openConnectorModal(await ensureModalOpen();lastReopenAt = Date.now();}- // @ts-expect-error -- browser global is injected by WDIO at runtime, not typed in this envawait browser.pause(250);}@@ -179,7 +177,6 @@ export async function assertModalPhase(return;}}- // @ts-expect-error -- browser global is injected by WDIO at runtime, not typed in this envawait browser.pause(400);}diff --git a/app/test/e2e/helpers/connector-contract.ts b/app/test/e2e/helpers/connector-contract.tsindex 7fc2097d97..0a87809bfb 100644--- a/app/test/e2e/helpers/connector-contract.ts+++ b/app/test/e2e/helpers/connector-contract.ts@@ -27,9 +27,29 @@ import {} from './composio-helpers';import { callOpenhumanRpc } from './core-rpc';import { triggerAuthDeepLinkBypass } from './deep-link-helpers';-import { textExists, waitForText, waitForWebView, waitForWindowVisible } from './element-helpers';+import {+ clickButton,+ textExists,+ waitForText,+ waitForWebView,+ waitForWindowVisible,+} from './element-helpers';import { completeOnboardingIfVisible, navigateToSkills } from './shared-flows';+/**+ * One entry from the mock server's request log.+ *+ * `mock-server.ts` carries `@ts-nocheck` and re-exports `getRequestLog` from a+ * plain `.mjs` module, so the log arrives untyped and every predicate+ * parameter would otherwise be an implicit `any` (TS7006). Narrowing it here+ * keeps the three `.find(...)` / `.some(...)` call sites below typed without+ * touching the shared mock wrapper.+ */+interface MockRequestLogEntry {+ method: string;+ url: string;+}+export interface ConnectorContractConfig {/** Human-facing connector name as rendered in the UI (e.g. "Google Calendar"). */name: string;@@ -91,7 +111,7 @@ export function runConnectorContract(config: ConnectorContractConfig): void {clearRequestLog();const out = await callOpenhumanRpc('openhuman.composio_authorize', { toolkit: slug });expect(out.ok).toBe(true);- const authReq = getRequestLog().find(+ const authReq = (getRequestLog() as MockRequestLogEntry[]).find(r => r.method === 'POST' && r.url.includes('/composio/authorize'));expect(authReq).toBeDefined();@@ -157,6 +177,61 @@ export function runConnectorContract(config: ConnectorContractConfig): void {console.log(`${LOG} PASS: expired auth does not log user out`);});+ // The case above stops at the affordance: it proves the Reconnect button+ // RENDERS. Nothing pressed it, so a regression that renders the button and+ // wires it to nothing — or to a route that 400s — left every connector+ // permanently un-reconnectable with the lane green. Matrix row 10.7.3+ // records that hole as "re-auth post-revoke not asserted".+ //+ // The button carries no `data-testid`, so this clicks its user-visible+ // label (`composio.reconnect` + the toolkit name, ComposioConnectModal.tsx+ // :245-253). A testid on that button would be the better hook; see the W5+ // phase-2 report.+ it('pressing Reconnect after expiry re-authorizes and restores the connection', async function () {+ this.timeout(60_000);+ seedComposioConnection(slug, 'EXPIRED', expiredId);+ await navigateToSkills();+ await waitForText(name, 10_000);+ const modal = await openConnectorModal(name, 15_000, 'Auth expired');+ expect(modal).toBeTruthy();+ await assertModalPhase('expired', name);++ // Cleared AFTER the modal is open so the assertion below can only be+ // satisfied by a request the button itself caused.+ clearRequestLog();+ await clickButton(`Reconnect ${name}`, 15_000);++ // The same evidence the happy-path connect case uses, so the two agree+ // on what "authorization was requested" means.+ await browser.waitUntil(+ async () =>+ (getRequestLog() as MockRequestLogEntry[]).some(+ r => r.method === 'POST' && r.url.includes('/composio/authorize')+ ),+ {+ timeout: 15_000,+ timeoutMsg:+ `Reconnect was pressed for ${name} but no POST to /composio/authorize followed — ` ++ 'the expired-state button is not wired to the authorize route',+ }+ );++ // Stand in for the OAuth callback the real flow completes in a browser,+ // then assert the connector reports itself usable again. Without this the+ // test would prove a request was sent and nothing about recovery.+ seedComposioConnection(slug, 'ACTIVE', activeId);+ const out = await callOpenhumanRpc('openhuman.composio_list_connections', {});+ const result = (out.result as { result?: unknown })?.result ?? out.result;+ const connections = (result as { connections?: unknown[] })?.connections ?? [];+ const hit = (connections as { toolkit?: string; status?: string }[]).find(+ c => c.toolkit?.toLowerCase() === slug+ );+ expect(hit?.status).toBe('ACTIVE');++ await assertSessionNotNuked();+ console.log(`${LOG} PASS: reconnect after expiry re-authorizes`);+ });+it('unrelated 400 on composio route does not nuke session', async function () {this.timeout(60_000);injectComposioFault(400);@@ -174,7 +249,7 @@ export function runConnectorContract(config: ConnectorContractConfig): void {seedComposioConnection(slug, 'ACTIVE', activeId);clearRequestLog();await callOpenhumanRpc('openhuman.composio_delete_connection', { connection_id: activeId });- const deleteReq = getRequestLog().find(+ const deleteReq = (getRequestLog() as MockRequestLogEntry[]).find(r => r.method === 'DELETE' && r.url.includes('/composio/connections/'));expect(deleteReq).toBeDefined();diff --git a/app/test/e2e/helpers/telegram.ts b/app/test/e2e/helpers/telegram.tsindex 17ef9c97d6..06589640fc 100644--- a/app/test/e2e/helpers/telegram.ts+++ b/app/test/e2e/helpers/telegram.ts@@ -217,10 +217,17 @@ export async function getTelegramChannelStatus(): Promise<TelegramStatusEntry |? ((result as Record<string, unknown>).result as TelegramStatusEntry[]): [];+ // The core serialises these in snake_case, so each entry carries keys the+ // camelCase interface does not declare. `as unknown as` rather than a direct+ // assertion: the two types genuinely do not overlap, and TS is right to say+ // so — going through `unknown` states that we know we are reading past the+ // declared shape instead of pretending the shapes match.+ const asLoose = (entry: TelegramStatusEntry): Record<string, unknown> =>+ entry as unknown as Record<string, unknown>;const raw = entries.find((e: TelegramStatusEntry) =>- (e.channelId === 'telegram' || (e as Record<string, unknown>).channel_id === 'telegram') &&- (e.authMode === 'bot_token' || (e as Record<string, unknown>).auth_mode === 'bot_token')+ (e.channelId === 'telegram' || asLoose(e).channel_id === 'telegram') &&+ (e.authMode === 'bot_token' || asLoose(e).auth_mode === 'bot_token')) as (TelegramStatusEntry & Record<string, unknown>) | undefined;// Normalise snake_case fields that the Rust core serialises.diff --git a/app/test/e2e/specs/auth-access-control.spec.ts b/app/test/e2e/specs/auth-access-control.spec.tsindex beec368ae0..4877e3f0db 100644--- a/app/test/e2e/specs/auth-access-control.spec.ts+++ b/app/test/e2e/specs/auth-access-control.spec.ts@@ -22,6 +22,7 @@* have been built with VITE_BACKEND_URL pointing there.*/import { waitForApp, waitForAppReady, waitForAuthBootstrap } from '../helpers/app-helpers';+import { callOpenhumanRpc, expectRpcOk } from '../helpers/core-rpc';import { triggerAuthDeepLink } from '../helpers/deep-link-helpers';import {clickButton,@@ -139,6 +140,18 @@ async function performFullLogin(token = 'e2e-test-token') {console.log(`[AuthAccess] Home page confirmed: found "${homeText}"`);}+/**+ * `AuthStateResponse` — `crates/openhuman-core/src/security/credentials/responses.rs`.+ *+ * `credential` is `skip_serializing_if = "Option::is_none"` on the Rust side,+ * so it is absent (not null) when signed out.+ */+interface AuthStateResponse {+ isAuthenticated: boolean;+ userId?: string | null;+ credential?: 'session' | 'api-key' | 'local';+}+// ===========================================================================// Test suite// ===========================================================================@@ -383,8 +396,37 @@ describe('Auth & Access Control', () => {await browser.pause(2_000);}- // Verify we landed on the logged-out state — assert a specific marker+ // ── Assertion, rewritten ────────────────────────────────────────────+ //+ // This used to be `expect(onWelcome || !hasToken).toBe(true)`, where+ // `hasToken` read `localStorage['persist:auth']`. That key does not+ // exist and has not for some time: `app/src/store/index.ts` registers no+ // `auth` reducer and no `auth` persist config, and this suite's sibling+ // says so in a comment (`login-flow.spec.ts`, bypass case). So `hasToken`+ // was always `false`, `!hasToken` was always `true`, and the disjunction+ // was a tautology — the test passed whether or not logout did anything.+ // Matrix row 1.4.1 was marked green on that.+ //+ // Two independent mechanisms now, both required:+ // 1. the core no longer holds a credential (the half that matters for+ // security: a UI that routes to Welcome while the core keeps+ // authenticating is exactly the regression worth catching), and+ // 2. the shell actually renders the logged-out surface.await browser.pause(3_000);++ const state = await callOpenhumanRpc<AuthStateResponse>('openhuman.auth_get_state', {});+ expectRpcOk('auth_get_state', state);+ expect(state.result!.isAuthenticated).toBe(false);+ // `credential` is `skip_serializing_if = "Option::is_none"` on the Rust+ // side, so a signed-out state omits it entirely. A stale "session" or+ // "local" value here means the credential outlived the logout.+ expect(state.result!.credential).toBeUndefined();+ console.log('[AuthAccess] Logout: core reports no credential');++ // `'OpenHuman'` is deliberately NOT in this list. It appears 148 times in+ // `app/src/lib/i18n/en.ts` and `textExists` is an unanchored+ // `//*[contains(text(), …)]`, so including it would match on most screens+ // and re-create the same always-true assertion in a new disguise.const welcomeCandidates = ['Welcome', 'Sign in', 'Login', 'Get Started'];let onWelcome = false;for (const text of welcomeCandidates) {@@ -394,23 +436,7 @@ describe('Auth & Access Control', () => {break;}}-- // Also verify auth token was cleared from localStorage- const hasToken = await browser.execute(() => {- const persisted = localStorage.getItem('persist:auth');- if (!persisted) return false;- try {- const parsed = JSON.parse(persisted);- const token = typeof parsed.token === 'string' ? parsed.token.replace(/^"|"$/g, '') : null;- return !!token && token !== 'null';- } catch {- return false;- }- });-- // Must see logged-out UI or token must be cleared (or both)- expect(onWelcome || !hasToken).toBe(true);- console.log(`[AuthAccess] Logout verified: welcomeUI=${onWelcome}, tokenCleared=${!hasToken}`);+ expect(onWelcome).toBe(true);});it('revoked session auto-logs out the user', async function () {@@ -449,23 +475,50 @@ describe('Auth & Access Control', () => {});- // The app should auto-log out when it gets a 401- const stillOnHome = await waitForHomePage(5_000);- if (!stillOnHome) {- console.log('[AuthAccess] Revoked session: user was logged out (no home page markers)');- }-- // Verify the app is either on Welcome or not on Home- const welcomeCandidates = ['Welcome', 'Sign in', 'Login', 'Get Started', 'OpenHuman'];- let onWelcome = false;- for (const text of welcomeCandidates) {- if (await textExists(text)) {- onWelcome = true;- break;+ // ── Assertion, rewritten ────────────────────────────────────────────+ //+ // Was `expect(onWelcome || !stillOnHome).toBe(true)` with `'OpenHuman'`+ // in the `onWelcome` candidate list. `'OpenHuman'` occurs 148 times in+ // `app/src/lib/i18n/en.ts` and `textExists` matches any text node+ // containing it, so the first disjunct was satisfiable on essentially+ // any screen — including the Home the test was supposed to prove we had+ // left. The test could not distinguish "revocation propagated" from+ // "revocation did nothing".+ //+ // Three assertions now, and none of them is a disjunction:+ // 1. the mock actually served the 401 (proves the fault was injected —+ // without this the whole test can pass because nothing was revoked),+ // 2. the core dropped the credential,+ // 3. the shell left the authenticated surface.++ // 1. The injection landed. A revoked-session test that never provoked a+ // 401 is the "couldn't-run wearing the clothes of proved" failure:+ // everything downstream would look like a clean auto-logout.+ const meCalls = getRequestLog().filter(r => r.method === 'GET' && r.url.includes('/auth/me'));+ expect(+ meCalls.length,+ 'no GET /auth/me reached the mock, so the revoked-session 401 was never served'+ ).toBeGreaterThan(0);++ // 2. The core dropped the credential.+ await browser.waitUntil(+ async () => {+ const state = await callOpenhumanRpc<AuthStateResponse>('openhuman.auth_get_state', {});+ return state.ok && state.result?.isAuthenticated === false;+ },+ {+ timeout: 20_000,+ interval: 1_000,+ timeoutMsg: 'core still reports isAuthenticated=true after the backend revoked the session',}- }+ );+ const revokedState = await callOpenhumanRpc<AuthStateResponse>('openhuman.auth_get_state', {});+ expectRpcOk('auth_get_state', revokedState);+ expect(revokedState.result!.credential).toBeUndefined();- expect(onWelcome || !stillOnHome).toBe(true);+ // 3. The shell left the authenticated surface.+ const stillOnHome = await waitForHomePage(5_000);+ expect(stillOnHome, 'app stayed on Home after the session was revoked').toBeNull();console.log('[AuthAccess] Revoked session auto-logout verified');});});diff --git a/app/test/e2e/specs/channels-smoke.spec.ts b/app/test/e2e/specs/channels-smoke.spec.tsindex 3955e60fbf..3a8b244752 100644--- a/app/test/e2e/specs/channels-smoke.spec.ts+++ b/app/test/e2e/specs/channels-smoke.spec.ts@@ -17,6 +17,7 @@ import { waitForApp } from '../helpers/app-helpers';import { textExists, waitForText } from '../helpers/element-helpers';import { resetApp } from '../helpers/reset-app';import { navigateViaHash } from '../helpers/shared-flows';+import { connectTelegramBot, disconnectTelegramBot } from '../helpers/telegram';import { startMockServer, stopMockServer } from '../mock-server';const USER_ID = 'e2e-channels-smoke';@@ -57,4 +58,52 @@ describe('Channels page smoke (Telegram + Discord)', () => {await browser.pause(500);expect(await textExists('Connect')).toBe(true);});++ /**+ * 10.5.2 — the unified surface must distinguish a connected channel from a+ * disconnected one.+ *+ * The case above only ever sees the not-connected state, and the page falls+ * back to `FALLBACK_DEFINITIONS` when core RPC serves no live definitions+ * (`useChannelDefinitions.ts:83`, `:122`) — so it passes whether or not the+ * channel surface is wired to the core at all. That is what matrix row 10.5.2+ * means by "UI assertion shallow".+ *+ * This drives a real connect over RPC and asserts `ChannelStatusBadge`+ * (`channels.status.connected`) flips, then flips back on disconnect. The+ * connected/disconnected pair is the assertion: a badge stuck on one value+ * would satisfy either half alone.+ */+ it('reflects a connected channel and returns to disconnected after disconnect (10.5.2)', async function () {+ this.timeout(120_000);++ // Known-disconnected baseline, so the "Connected" assertion below cannot+ // be satisfied by state left over from an earlier spec.+ await disconnectTelegramBot();+ await navigateViaHash('/channels');+ await waitForText('Telegram', 15_000);+ if (await textExists('Connected')) {+ throw new Error('precondition: Telegram should not already read Connected');+ }++ const connected = await connectTelegramBot({ botToken: '111111:e2e-channels-smoke-token' });+ expect(connected.ok).toBe(true);++ // Re-navigate rather than pause: the page reads definitions on mount.+ await navigateViaHash('/chat');+ await navigateViaHash('/channels');+ await waitForText('Telegram', 15_000);+ await waitForText('Connected', 20_000);++ await disconnectTelegramBot();+ await navigateViaHash('/chat');+ await navigateViaHash('/channels');+ await waitForText('Telegram', 15_000);+ await browser.waitUntil(async () => !(await textExists('Connected')), {+ timeout: 20_000,+ timeoutMsg:+ 'the channel surface still reads Connected after channels_disconnect — the status ' ++ 'badge is not reflecting the live channel state',+ });+ });});diff --git a/app/test/e2e/specs/command-palette.spec.ts b/app/test/e2e/specs/command-palette.spec.tsindex 80c9cc2c6e..8749ea9b6e 100644--- a/app/test/e2e/specs/command-palette.spec.ts+++ b/app/test/e2e/specs/command-palette.spec.ts@@ -1,3 +1,5 @@+import type { ChainablePromiseElement } from 'webdriverio';+import { waitForApp, waitForAppReady } from '../helpers/app-helpers';import { waitForWebView } from '../helpers/element-helpers';import { resetApp } from '../helpers/reset-app';@@ -64,10 +66,36 @@ async function dispatchKey(}}+// Open the command palette, retrying mod+K up to 3 times — the WebDriver+// Actions API can silently drop the first dispatch while the focus context is+// still settling.+//+// Returns the combobox or throws. The previous shape declared `let input` and+// assigned it inside the loop, so every use after it was an unchecked read of a+// possibly-undefined element: the `attempt === 2` throw happens to make that+// safe, which is a property of the loop body rather than something the types+// could see. Returning from a helper states it instead.+async function openPaletteWithRetry(): Promise<ChainablePromiseElement> {+ for (let attempt = 0; attempt < 3; attempt++) {+ await dispatchKey('k', MOD_KEY);+ const input = await browser.$('input[role="combobox"]');+ try {+ await input.waitForExist({ timeout: 3000 });+ return input;+ } catch {+ if (attempt === 2) break;+ }+ }+ throw new Error('Command palette did not open after 3 mod+K attempts');+}+// Close an overlay via Escape, escalating to a document-targeted synthetic// event as a last resort. ModalShell's `useEscapeKey` binds to `document`, so a// `window`-dispatched fallback would miss it — dispatch on `document` directly.-async function closeOverlayWithEscape(el: WebdriverIO.Element, timeoutMsg: string): Promise<void> {+async function closeOverlayWithEscape(+ el: ChainablePromiseElement,+ timeoutMsg: string+): Promise<void> {try {await browser.keys('Escape');} catch {@@ -99,19 +127,7 @@ describe('Command palette', () => {});it('opens via mod+K, runs an action, closes and navigates', async () => {- // Retry mod+K up to 3 times — WebDriver Actions API can silently drop the- // first dispatch when the focus context hasn't settled yet.- let input: WebdriverIO.Element | undefined;- for (let attempt = 0; attempt < 3; attempt++) {- await dispatchKey('k', MOD_KEY);- input = await browser.$('input[role="combobox"]');- try {- await input.waitForExist({ timeout: 3000 });- break;- } catch {- if (attempt === 2) throw new Error('Command palette did not open after 3 mod+K attempts');- }- }+ const input = await openPaletteWithRetry();await input.setValue('settings');await browser.keys('Enter');diff --git a/app/test/e2e/specs/composio-cancel-pending.spec.ts b/app/test/e2e/specs/composio-cancel-pending.spec.tsindex 0f3d8142cf..4a22d1b76f 100644--- a/app/test/e2e/specs/composio-cancel-pending.spec.ts+++ b/app/test/e2e/specs/composio-cancel-pending.spec.ts@@ -87,7 +87,6 @@ describe('Composio pending-connection cancel flow', () => {entry.url.includes(PENDING_CONNECTION_ID));if (deleteSeen) break;- // @ts-expect-error -- browser global is injected by WDIO at runtime, not typed in this envawait browser.pause(500);}if (!deleteSeen) {diff --git a/app/test/e2e/specs/connector-gmail-composio.spec.ts b/app/test/e2e/specs/connector-gmail-composio.spec.tsindex 3403d38e4d..bcbf6abc1b 100644--- a/app/test/e2e/specs/connector-gmail-composio.spec.ts+++ b/app/test/e2e/specs/connector-gmail-composio.spec.ts@@ -130,8 +130,13 @@ describe('Gmail (Composio) connector flow', () => {});const execReq = getRequestLog().find(r => r.url.includes('/composio/execute'));if (execReq) {- // The mock returns 400 — the RPC layer should surface a safe error, not crash- console.log(`${LOG} execute returned status: ${execReq.statusCode}`);+ // The mock returns 400 — the RPC layer should surface a safe error, not+ // crash, which the `assertSessionNotNuked` below is what actually checks.+ // This used to log `execReq.statusCode`, which the request log has never+ // recorded (`scripts/mock-api/server.mjs:72-78` stores method/url/body/+ // headers/timestamp), so every run printed `undefined`. Found by typing+ // `getRequestLog()`; log what the log actually holds.+ console.log(`${LOG} execute request reached the mock: ${execReq.method} ${execReq.url}`);}// Critical: app must remain responsive — session not nukeddiff --git a/app/test/e2e/specs/connector-jira.spec.ts b/app/test/e2e/specs/connector-jira.spec.tsindex e0ed6373ac..85c22cc52d 100644--- a/app/test/e2e/specs/connector-jira.spec.ts+++ b/app/test/e2e/specs/connector-jira.spec.ts@@ -99,7 +99,6 @@ describe('Jira Composio connector flow', () => {// Clear the durable cache so the tile mounts disconnected and the modal// opens in `idle`.setMockBehavior('composioConnections', JSON.stringify([]));- // @ts-expect-error -- browser global is injected by WDIO at runtime, not typed in this envawait browser.execute(() => {Object.keys(window.localStorage).filter(k => k.includes('composio:connections'))@@ -117,7 +116,6 @@ describe('Jira Composio connector flow', () => {expect(modal).toBeTruthy();// The Jira connect modal should render a subdomain input per toolkitRequiredFields.ts// It uses data-testid="composio-required-subdomain"- // @ts-expect-error -- browser global is injected by WDIO at runtime, not typed in this envconst hasSubdomainInput = await browser.execute(() => {return (@@ -141,7 +139,6 @@ describe('Jira Composio connector flow', () => {expect(hasSubdomainInput).toBe(true);console.log(`${LOG} PASS: subdomain input field visible in Jira modal`);// Close modal by pressing Escape- // @ts-expect-error -- browser global is injected by WDIO at runtime, not typed in this envawait browser.keys(['Escape']).catch(() => {});await assertSessionNotNuked();});diff --git a/app/test/e2e/specs/local-model-runtime.spec.ts b/app/test/e2e/specs/local-model-runtime.spec.tsindex 1d81bc1fd6..dca076bbae 100644--- a/app/test/e2e/specs/local-model-runtime.spec.ts+++ b/app/test/e2e/specs/local-model-runtime.spec.ts@@ -1,105 +1,102 @@// @ts-nocheckimport { waitForApp, waitForAppReady } from '../helpers/app-helpers';import { triggerAuthDeepLink } from '../helpers/deep-link-helpers';-import {- clickText,- dumpAccessibilityTree,- textExists,- waitForText,- waitForWebView,- waitForWindowVisible,-} from '../helpers/element-helpers';+import { textExists, waitForWebView, waitForWindowVisible } from '../helpers/element-helpers';import { walkOnboarding } from '../helpers/shared-flows';-import { clearRequestLog, getRequestLog, startMockServer, stopMockServer } from '../mock-server';+import { startMockServer, stopMockServer } from '../mock-server';-async function waitForRequest(method, urlFragment, timeout = 15_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;-}--async function waitForHome(timeout = 20_000) {- // Home.tsx renders t('home.askAssistant') = 'Ask your assistant anything...' as stable CTA.- const deadline = Date.now() + timeout;- while (Date.now() < deadline) {- if (await textExists('Ask your assistant anything')) return true;- if (await textExists('Your device is connected')) return true;- await browser.pause(700);- }- return false;-}--async function waitForAnyText(candidates, timeout = 20_000) {- const deadline = Date.now() + timeout;- while (Date.now() < deadline) {- for (const t of candidates) {- if (await textExists(t)) return t;- }- await browser.pause(600);- }- return null;-}--// Local model runtime now talks to an external Ollama endpoint through core.-// CI does not provision a live Ollama server, so keep this spec skipped until-// a deterministic mockable local-runtime harness exists for WDIO.-describe.skip('Local model runtime flow', () => {+/**+ * Local model runtime — the app-managed surface is gone; the route redirects.+ *+ * # What this file used to be, and why it was replaced+ *+ * Until 2026-09-24 this spec was a single `describe.skip`ped case driving a+ * "Local model runtime" card, a "Manage" button and a "Runtime Status" panel,+ * with the reason given as *"CI does not provision a live Ollama server, so+ * keep this spec skipped until a deterministic mockable local-runtime harness+ * exists for WDIO."*+ *+ * That reason had stopped being the real one. Commit `0ec68613af` removed the+ * local-model debug panel outright, so every control the old case reached no+ * longer exists — unskipping it would not have needed an Ollama server, it+ * would have failed on the first `waitForText('Local model runtime')`. The+ * spec was not waiting for a harness; it was testing deleted UI.+ *+ * That mattered beyond tidiness: `docs/TEST-COVERAGE-MATRIX.md` cited this file+ * as the evidence for **3.1.1, 3.1.2, 3.2.1, 3.2.3** (all ✅) and **3.3.3.2**+ * (🟡). Five rows rested on a spec that had never executed an assertion, and+ * because the file *is* wired into the `system` suite it was collected,+ * launched and reported as a pass every run. A skipped spec that four ✅ rows+ * point at is worse than no spec: it reads as coverage from the matrix and+ * costs a lane slot to produce nothing.+ *+ * # What this file asserts now+ *+ * The one claim about the local-model surface that is true, checkable on the+ * desktop shell, and worth defending: **the legacy deep route is a redirect,+ * not a dead end.** `settingsRouteElements.tsx` maps `local-model-debug` to+ * `<Navigate to="/connections?tab=llm" replace />`, so a user following an old+ * link, bookmark or doc lands on the page that replaced it. If that `Navigate`+ * is dropped in a future settings-route refactor the route renders nothing and+ * the failure is silent — a blank settings pane, no console error.+ *+ * The web lane asserts the same redirect+ * (`app/test/playwright/specs/local-model-runtime.spec.ts`); this is the+ * desktop-shell half, where the hash router runs inside the real Wry webview+ * rather than a browser tab.+ *+ * `navigateViaHash` is deliberately not used: its `HASH_REDIRECTS` table does+ * not carry this route, so it would wait for the wrong target hash and time+ * out. Driving `window.location.hash` and polling for the settled value tests+ * the app's own router rather than the helper's copy of the route map — which+ * is the point, since a stale copy is exactly what this guards against.+ */+describe('Local model runtime route', () => {before(async function beforeSuite() {this.timeout(90_000);await startMockServer();await waitForApp();- clearRequestLog();});after(async () => {await stopMockServer();});- it('shows direct-runtime guidance instead of app-managed bootstrap controls', async function () {+ it('redirects the retired local-model-debug route to the Connections LLM tab', async function () {this.timeout(90_000);+await triggerAuthDeepLink('e2e-local-model-token');await waitForWindowVisible(25_000);await waitForWebView(15_000);await waitForAppReady(15_000);-- const consume = await waitForRequest('POST', '/auth/login-token/consume');- expect(consume).toBeDefined();-await walkOnboarding('[LocalModel]');- const onHome = await waitForHome(20_000);- if (!onHome) {- const tree = await dumpAccessibilityTree();- console.log('[LocalModelE2E] Home not reached. Tree:\n', tree.slice(0, 4000));- }- expect(onHome).toBe(true);-- await waitForText('Local model runtime', 15_000);- await clickText('Manage', 10_000);+ await browser.execute(() => {+ window.location.hash = '#/settings/local-model-debug';+ });- await waitForText('Runtime Status', 15_000);+ let settled = '';+ await browser.waitUntil(+ async () => {+ settled = await browser.execute(() => window.location.hash);+ // Wait for the redirect to land, not merely for the hash to change:+ // the requested route is itself a valid intermediate value.+ return typeof settled === 'string' && settled.includes('/connections');+ },+ {+ timeout: 20_000,+ interval: 300,+ timeoutMsg:+ 'requesting #/settings/local-model-debug should have redirected to /connections; ' ++ 'if the Navigate in settingsRouteElements.tsx was dropped the route renders nothing',+ }+ );- const incompatibleError =- 'Local model runtime is unavailable in this core build. Restart app after updating to the latest build.';- expect(await textExists(incompatibleError)).toBe(false);+ expect(settled).toContain('/connections');+ expect(settled).not.toContain('local-model-debug');- const guidance = await waitForAnyText(- [- 'Ollama runtime unavailable',- 'Manage the Ollama process and model pulls outside OpenHuman.',- 'Ollama docs',- ],- 25_000- );- if (!guidance) {- const tree = await dumpAccessibilityTree();- console.log('[LocalModelE2E] No direct-runtime guidance seen. Tree:\n', tree.slice(0, 5000));- }- expect(guidance).not.toBeNull();+ // The removed panel must not come back through a different route: its+ // distinctive controls are the ones the pre-0ec68613af spec drove.+ expect(await textExists('Runtime Status')).toBe(false);});});diff --git a/app/test/e2e/specs/login-flow.spec.ts b/app/test/e2e/specs/login-flow.spec.tsindex 1f54d2ebb7..29686f3ce8 100644--- a/app/test/e2e/specs/login-flow.spec.ts+++ b/app/test/e2e/specs/login-flow.spec.ts@@ -29,6 +29,7 @@* have been built with VITE_BACKEND_URL pointing there.*/import { waitForApp, waitForAppReady, waitForAuthBootstrap } from '../helpers/app-helpers';+import { callOpenhumanRpc, expectRpcOk } from '../helpers/core-rpc';import { buildBypassJwt, triggerAuthDeepLink, triggerDeepLink } from '../helpers/deep-link-helpers';import {dumpAccessibilityTree,@@ -78,26 +79,17 @@ async function waitForAnyText(candidates, timeout = 15_000) {}/**- * Verify Redux auth state via browser.execute (tauri-driver only).+ * `AuthStateResponse` — `crates/openhuman-core/src/security/credentials/responses.rs`.+ *+ * Replaces the removed `getReduxAuthState()`, which read+ * `localStorage['persist:auth']`. There is no `auth` reducer in+ * `app/src/store/index.ts`, so that key was never written and every read+ * returned null.*/-async function getReduxAuthState() {- try {- return await browser.execute(() => {- // Redux store is exposed on window.__REDUX_DEVTOOLS_EXTENSION__- // but we can read from localStorage where redux-persist stores auth- const persistedAuth = localStorage.getItem('persist:auth');- if (persistedAuth) {- try {- return JSON.parse(persistedAuth);- } catch {- return null;- }- }- return null;- });- } catch {- return null;- }+interface AuthStateResponse {+ isAuthenticated: boolean;+ userId?: string | null;+ credential?: 'session' | 'api-key' | 'local';}// Track whether onboarding was walked through in the UI so Phase 3 can@@ -170,17 +162,24 @@ describe('Login flow — complete with mock data (Linux)', () => {expect(call).toBeDefined();});- it('Redux auth state has a token after login', async () => {- const authState = await getReduxAuthState();- if (authState) {- const token =- typeof authState.token === 'string' ? authState.token.replace(/^"|"$/g, '') : null;- console.log('[LoginFlow] Redux auth token present:', !!token);- expect(token).toBeTruthy();- } else {- console.log('[LoginFlow] Could not read Redux auth state (persist format may differ)');- // Non-fatal: the token-consume mock call was verified above- }+ // Was `'Redux auth state has a token after login'`, which called+ // `getReduxAuthState()` (reading `localStorage['persist:auth']`) and, when+ // that came back null, logged "persist format may differ" and asserted+ // nothing. It always came back null: `app/src/store/index.ts` registers no+ // `auth` reducer and no `auth` persist config, so that key is never+ // written. The test could not fail, while its name claimed token coverage.+ //+ // The session lives in the core, not in Redux, so ask the core.+ it('the core holds a session credential after login', async () => {+ const state = await callOpenhumanRpc<AuthStateResponse>('openhuman.auth_get_state', {});+ expectRpcOk('auth_get_state', state);+ expect(state.result!.isAuthenticated).toBe(true);+ // Not just "authenticated": a `local` credential would also report true,+ // and this suite logged in through the backend token-consume path, so the+ // credential must be the session JWT that path installs.+ expect(state.result!.credential).toBe('session');+ expect(state.result!.userId).toBeTruthy();+ console.log(`[LoginFlow] core credential=session userId=${state.result!.userId}`);});// -----------------------------------------------------------------------diff --git a/app/test/playwright/specs/auth-access-control.spec.ts b/app/test/playwright/specs/auth-access-control.spec.tsindex 1323f15369..7e81764037 100644--- a/app/test/playwright/specs/auth-access-control.spec.ts+++ b/app/test/playwright/specs/auth-access-control.spec.ts@@ -2,12 +2,41 @@ import { expect, type Page, test } from '@playwright/test';import {bootRuntimeReadyGuestPage,+ callCoreRpc,dismissWalkthroughIfPresent,signInViaBypassUser,+ waitForAppReady,} from '../helpers/core-rpc';const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;+// Declared locally, matching every other spec in this directory+// (`chat-harness-send-stream`, `runtime-picker-login`, …). It was used at+// `mockRequests` below without ever being declared, which is where this file's+// two pre-existing `tsc -p test/tsconfig.e2e.json` errors came from.+interface MockRequest {+ method: string;+ url: string;+ body?: string;+}++/** `AuthStateResponse` (`crates/openhuman-core/src/security/credentials/responses.rs`). */+interface AuthState {+ isAuthenticated: boolean;+ userId?: string | null;+ credential?: string;+}++async function authState(): Promise<AuthState> {+ return callCoreRpc<AuthState>('openhuman.auth_get_state', {});+}++async function gotoSettingsRoute(page: Page, hash: string): Promise<void> {+ await page.goto(`/#${hash}`);+ await waitForAppReady(page);+ await dismissWalkthroughIfPresent(page);+}+async function resetMock(): Promise<void> {await fetch(`${MOCK_ADMIN_BASE}/__admin/reset`, {method: 'POST',@@ -70,31 +99,88 @@ test.describe('Auth & Access Control', () => {.toBeGreaterThanOrEqual(2);});+ // Was `test.skip(true, 'shared web auth bootstrap is unstable … can fall+ // back to onboarding instead of home')`. The instability was in asserting a+ // *route*; the claim in the title is about the *request log*, which the two+ // tests above already read reliably. Asserting the claim directly needs no+ // route settle at all. (matrix 1.3.1)test('second-device bypass token is accepted without hitting token consume', async ({ page }) => {- test.skip(- true,- 'shared web auth bootstrap is unstable for a second-device bypass sign-in and can fall back to onboarding instead of home'- );- });+ await signInViaBypassUser(page, 'pw-auth-second-device');- test('billing dashboard handoff remains available for authenticated users', async ({ page }) => {- test.skip(- true,- 'shared web auth/bootstrap helper is not stable enough yet for settings->billing coverage in this lane'+ await expect(await waitForMockRequest('GET', '/auth/me')).toBeTruthy();++ // The point of a bypass credential: the core installs it directly through+ // `auth.set_credential` and never redeems it at the backend. A regression+ // that routed bypass sign-in back through the consume endpoint would send+ // an unredeemable token to `/auth/login-token/consume`, get a 401, and+ // log the user straight back out.+ const consumeCalls = (await mockRequests()).filter(+ request => request.method === 'POST' && request.url.includes('/auth/login-token/consume'));+ expect(consumeCalls, 'bypass sign-in must not redeem a login token').toHaveLength(0);++ const state = await authState();+ expect(state.isAuthenticated).toBe(true);+ expect(state.userId).toBe('pw-auth-second-device');});+ // Was `test.skip(true, 'shared web auth/bootstrap helper is not stable+ // enough yet for logout coverage without crashing the standalone core+ // lane')`. That reason is stale: `signInViaBypassUser` already calls+ // `auth_clear_session` on this same core in every `beforeEach`, so clearing+ // a session in this lane is demonstrably survivable. (matrix 1.4.1)+ //+ // Asserts through `auth.get_state` rather than a text search for "Welcome":+ // the WD counterpart asserted `onWelcome || !localStorage['persist:auth']`,+ // and since there is no `auth` reducer that key is always null, so its+ // disjunction was a tautology that passed whether or not logout worked.test('logout via settings clears the session and returns to welcome', async ({ page }) => {- test.skip(- true,- 'shared web auth/bootstrap helper is not stable enough yet for logout coverage without crashing the standalone core lane'- );- });+ await signInViaBypassUser(page, 'pw-auth-logout-user');+ expect((await authState()).isAuthenticated).toBe(true);- test('auth-expired event signs the user out and lands on welcome', async ({ page }) => {- test.skip(- true,- 'web Playwright lane uses a local/bypass session that intentionally ignores auth-expired handling'- );+ await gotoSettingsRoute(page, '/settings/account');+ await page.getByTestId('settings-nav-logout').click();++ // Mechanism 1: the core no longer holds a credential. This is the half+ // that matters for security — a UI that routes to Welcome while the core+ // keeps authenticating is the regression worth catching.+ await expect+ .poll(async () => (await authState()).isAuthenticated, { timeout: 15_000 })+ .toBe(false);+ const cleared = await authState();+ expect(cleared.credential, 'no credential should back a signed-out state').toBeUndefined();+ expect(cleared.userId ?? null).toBeNull();++ // Mechanism 2: the shell actually leaves the authenticated surface. Two+ // independent signals, so a partial regression fails rather than passing+ // on whichever half still works.+ await expect+ .poll(async () => page.evaluate(() => window.location.hash), { timeout: 15_000 })+ .not.toMatch(/^#\/(chat|home|settings)/);});++ // DELETED rather than unskipped: `auth-expired event signs the user out and+ // lands on welcome`.+ //+ // Its skip reason was substantive, not flakiness: *"web Playwright lane uses+ // a local/bypass session that intentionally ignores auth-expired handling"*.+ // Every sign-in helper in this lane installs a bypass credential through+ // `auth_store_session`, and that path deliberately does not arm expiry+ // handling, so the behaviour named in the title cannot occur here however+ // the test is written. Leaving it as an unconditional skip made matrix row+ // 1.4.3 read as serviced.+ //+ // Auth expiry / server-side revocation is covered instead at the two layers+ // where it is real:+ // * WD — `app/test/e2e/specs/auth-access-control.spec.ts`,+ // `revoked session auto-logs out the user` (a real session, mock+ // `session: 'revoked'` → 401).+ // * RU — `crates/openhuman-tinyhumans/src/session/manager_tests.rs`,+ // the 401-clears-manager-cache-and-identity-slot cases.+ //+ // DELETED rather than unskipped: `billing dashboard handoff remains+ // available for authenticated users` — duplicates+ // `app/test/playwright/specs/settings-account-preferences.spec.ts`, which+ // already navigates `/settings/billing` and asserts the handoff. Billing is+ // matrix section 3, not this file's section 1.});diff --git a/app/test/playwright/specs/chat-composer-attachment-gate.spec.ts b/app/test/playwright/specs/chat-composer-attachment-gate.spec.tsindex 21159f67da..08e8890938 100644--- a/app/test/playwright/specs/chat-composer-attachment-gate.spec.ts+++ b/app/test/playwright/specs/chat-composer-attachment-gate.spec.ts@@ -18,14 +18,25 @@* `AttachmentDropzone` — attached nothing, while `setInputFiles` in the same* run attached fine.*- * **So there is no drop/paste spec here, on purpose.** "Dropping a file while- * streaming does not attach" would pass because dropping never attaches in any- * state; it cannot distinguish a working gate from a dead gesture, and writing- * it would put a green test over a probable regression. The finding is in- * `~/tinyhuman/bugs/W2-ui-bugs.md` as BUG-W2-UI-1 for a human to confirm with a- * real drag.+ * **That paragraph is now out of date, and the paste cases at the bottom of this+ * file are why.** `thread.tsx` has since grown a real host file path: drop+ * handlers at `:279-316` and an `onPasteCapture` at `:1085`, both gated on+ * `canAcceptComposerFiles`, which `AssistantUiChat.tsx:333-334` defines as+ * `!attachmentInteractionBlocked && attachments.length < maxAttachments` — the+ * same predicate as the `[+]` button. So the bypass question this file was+ * chartered to answer IS answerable now, at least for paste.*- * What IS real and falsifiable is the gate on the control that does ingest:+ * It is answerable *without being vacuous* because the two paste cases come as+ * a pair: the first proves a pasted image DOES attach, which is what makes the+ * second ("...and does not, while a turn streams") a statement about the gate+ * rather than about a dead gesture. Neither alone would be worth writing.+ *+ * Drop is still not covered here. `handlePasteCapture` filters to+ * `image/`- and `video/`-typed clipboard items (`thread.tsx:970`), which a+ * spec can synthesise exactly; a trustworthy drop case needs a real drag, and+ * BUG-W2-UI-1 in `~/tinyhuman/bugs/W2-ui-bugs.md` is still open for a human.+ *+ * What was already real and falsifiable is the gate on the control that ingests:* `disabled={attachmentInteractionBlocked || attachments.length >= maxAttachments}`* (`AssistantUiChat.tsx:178`), where `attachmentInteractionBlocked` is* `composerInteractionBlocked || isSending` (`Conversations.tsx:2522`). This@@ -224,4 +235,82 @@ test.describe('Chat composer attachment gate', () => {await expect(sendButton(page)).toBeVisible();await expect(page.getByTestId('composer-human-mode')).toHaveCount(0);});++ /**+ * Paste ingest — `handlePasteCapture` (`thread.tsx:963-980`).+ *+ * The handler runs in the capture phase so the media is pulled out before+ * Lexical turns it into editor content, keeps only clipboard items whose+ * `kind` is `file` and whose type matches `/^(image|video)\//`, and hands+ * them to the host's `onComposerFiles` sink — the same validator the picker+ * uses. A text paste is left alone, which is why these cases paste a PNG.+ *+ * Synthesising the event rather than using the OS clipboard: Playwright+ * cannot put an image on the real clipboard portably, and the handler reads+ * `event.clipboardData.items`, so a constructed `ClipboardEvent` with a+ * populated `DataTransfer` exercises exactly the code under test. What it+ * does NOT cover is the browser's own clipboard-to-event step; that is the+ * same boundary `setInputFiles` leaves uncovered for the picker.+ */+ async function pasteImage(page: Page, name: string): Promise<void> {+ await composer(page).click();+ await page.evaluate(+ ({ selector, fileName }) => {+ const target = document.querySelector(selector);+ if (!target) throw new Error('composer not found for paste');+ // A 1x1 PNG. Small, but a genuine image/png payload rather than a+ // text blob wearing an image MIME type.+ const bytes = Uint8Array.from(+ atob(+ 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=='+ ),+ c => c.charCodeAt(0)+ );+ const file = new File([bytes], fileName, { type: 'image/png' });+ const data = new DataTransfer();+ data.items.add(file);+ target.dispatchEvent(+ new ClipboardEvent('paste', { clipboardData: data, bubbles: true, cancelable: true })+ );+ },+ { selector: '[data-testid="chat-message-input"]', fileName: name }+ );+ }++ test('pasting an image attaches it', async ({ page }) => {+ // The control for the case below: without this, "paste did not attach+ // while streaming" would be true of an idle composer too, and would be+ // testing nothing.+ await openChat(page);+ await expect(attachButton(page)).toBeEnabled();++ await pasteImage(page, 'pasted-shot.png');++ await expect(+ page.getByText('pasted-shot.png'),+ 'a pasted image must reach the same ingest the picker uses'+ ).toBeVisible({ timeout: 15_000 });+ });++ test('pasting an image while a turn streams does not attach it', async ({ page }) => {+ // The bypass this file was chartered to check. `canAcceptComposerFiles`+ // folds in `attachmentInteractionBlocked`, so the paste path has to refuse+ // for the same reason the `[+]` button is disabled — a gate enforced on one+ // ingest and not the other is not a gate.+ await openChat(page);+ await beginStreamingTurn(page, 'stream while I paste');+ await expect(attachButton(page)).toBeDisabled();++ await pasteImage(page, 'blocked-shot.png');++ // Give the ingest the same grace a successful one gets, so this is a+ // refusal rather than a race we won.+ await page.waitForTimeout(2_000);+ await expect(+ page.getByText('blocked-shot.png'),+ 'paste must honour the gate the [+] button enforces'+ ).toHaveCount(0);+ // And the turn is genuinely still streaming, so the gate was actually shut.+ await expect(stopButton(page)).toBeVisible();+ });});diff --git a/app/test/playwright/specs/chat-harness-send-stream.spec.ts b/app/test/playwright/specs/chat-harness-send-stream.spec.tsindex e0b96f2b88..c3fd94ba49 100644--- a/app/test/playwright/specs/chat-harness-send-stream.spec.ts+++ b/app/test/playwright/specs/chat-harness-send-stream.spec.ts@@ -122,9 +122,15 @@ async function sendMessage(page: Page, prompt: string): Promise<void> {test.describe('Chat Harness - Send Stream', () => {test('streams a reply, logs a streaming request, and persists the thread', async ({ page }) => {await resetMock();- const streamScript = REPLY_PIECES.map(text => ({ text, delayMs: 60 })).concat([+ // The mock's script entries are a union of shapes+ // (`scripts/mock-api/routes/llm.mjs:128-145`), so the array needs the union+ // as its element type. Without it `.map(...)` narrowed to the text-delta+ // 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 })),{ finish: 'stop' },- ]);+ ];await setMockBehavior('llmStreamScript', JSON.stringify(streamScript));await openChat(page);diff --git a/app/test/playwright/specs/runtime-picker-login.spec.ts b/app/test/playwright/specs/runtime-picker-login.spec.tsindex e756e542b3..9b11f1594e 100644--- a/app/test/playwright/specs/runtime-picker-login.spec.ts+++ b/app/test/playwright/specs/runtime-picker-login.spec.ts@@ -1,4 +1,4 @@-import { expect, type Page, test } from '@playwright/test';+import { expect, test } from '@playwright/test';import {bootRuntimeReadyGuestPage,@@ -42,69 +42,34 @@ async function waitForMockRequest(method: string, pathFragment: string, timeoutMreturn null;}-async function openRuntimePicker(page: Page): Promise<void> {- if (- await page- .getByText('Connect to Your Runtime')- .isVisible()- .catch(() => false)- ) {- return;- }- await dismissWalkthroughIfPresent(page);- await page.getByRole('button', { name: 'Select a Runtime' }).click({ force: true });- await expect(page.getByText('Connect to Your Runtime')).toBeVisible();-}-test.describe('Runtime picker -> login -> logout', () => {test.beforeEach(async ({ page }) => {await resetMock();await bootRuntimeReadyGuestPage(page);});- test('runtime picker validates cloud URL/token inputs and unreachable hosts', async ({- page,- }) => {- test.skip(- true,- 'web Playwright lane does not reliably surface the desktop-style runtime picker overlay yet'- );- await openRuntimePicker(page);-- await page.getByText('Run on the Cloud (Complex)').click();- await expect(page.getByText('Runtime URL')).toBeVisible();- await expect(page.getByText('Auth Token')).toBeVisible();-- await page.getByRole('button', { name: 'Continue' }).click();- await expect(page.getByText('Please enter a runtime URL.')).toBeVisible();-- await page.locator('input[type="url"]').fill('http://127.0.0.1:1/rpc');- await page.getByRole('button', { name: 'Continue' }).click();- await expect(page.getByText("We'll need an auth token to connect.")).toBeVisible();-- await page.locator('input[type="password"]').fill('bad-token-e2e');- await page.getByRole('button', { name: 'Test Connection' }).click();- await expect(- page.getByText(/Couldn't reach it:|That token didn't work\. Double-check it and try again\./)- ).toBeVisible({ timeout: 20_000 });- });-- test('returning to cloud-mode guest state keeps provider login available', async ({ page }) => {- test.skip(- true,- 'web Playwright lane does not reliably surface the desktop-style runtime picker overlay yet'- );- await openRuntimePicker(page);-- await page.getByText('Run on the Cloud (Complex)').click();- await page.locator('input[type="url"]').fill('http://127.0.0.1:17788/rpc');- await page.locator('input[type="password"]').fill('openhuman-playwright-token');- await page.getByRole('button', { name: 'Continue' }).click();-- await waitForAppReady(page);- await expect(page.getByText('Welcome to OpenHuman')).toBeVisible();- await expect(page.getByRole('button', { name: 'Select a Runtime' })).toBeVisible();- });+ // DELETED, not unskipped: `runtime picker validates cloud URL/token inputs+ // and unreachable hosts` and `returning to cloud-mode guest state keeps+ // provider login available`.+ //+ // Both carried `test.skip(true, 'web Playwright lane does not reliably+ // surface the desktop-style runtime picker overlay yet')`. That reason is+ // structural, not flaky, and no amount of rewriting fixes it: every test in+ // this file boots through `bootRuntimeReadyGuestPage`, which calls+ // `seedBrowserCoreMode` and writes `openhuman_core_mode`,+ // `openhuman_core_rpc_url` and `openhuman_core_rpc_token` into localStorage+ // before the first paint. The app therefore already knows its runtime and+ // is correct not to show the picker. Removing that seeding leaves the web+ // build with no core to talk to, so the page never boots — the overlay is+ // unreachable in this lane by construction.+ //+ // The desktop lane covers all of it, and more: see+ // `app/test/e2e/specs/runtime-picker-login.spec.ts` —+ // `clicking "Select a Runtime" opens the runtime picker with both options`,+ // `cloud option reveals URL + token inputs and validates them`,+ // `"Test Connection" against an unreachable host shows the unreachable pill`,+ // `switching back to Local and clicking Continue closes the picker`.+ // That is a strict superset of the two deleted cases.test('provider login reaches home and logout returns to welcome', async ({ page }) => {await signInViaBypassUser(page, 'pw-runtime-picker-login');diff --git a/app/test/playwright/specs/settings-ai-skills.spec.ts b/app/test/playwright/specs/settings-ai-skills.spec.tsindex f49adabc84..7cf5f5ebb8 100644--- a/app/test/playwright/specs/settings-ai-skills.spec.ts+++ b/app/test/playwright/specs/settings-ai-skills.spec.ts@@ -1,11 +1,69 @@-import { expect, test } from '@playwright/test';+import { expect, test, type Page } from '@playwright/test';import {bootAuthenticatedPage,+ callCoreRpc,dismissWalkthroughIfPresent,waitForAppReady,} from '../helpers/core-rpc';+/**+ * A managed catalog id from the shared mock fixture+ * (`scripts/mock-api/routes/llm.mjs`), so the value under test is one the+ * routing page would really be asked to display rather than a synthetic string.+ */+const PINNED_MODEL = 'openrouter/nex-agi/nex-n2.5-mini';++/**+ * Read `default_model` back from the core, not from the page's own state.+ *+ * `inference_get_client_config` answers in the `CommandResponse` envelope+ * (`{ result: ClientConfig }`), which is how `aiSettingsApi.loadAISettings`+ * unwraps it; older snapshots answered bare, so accept both rather than fail on+ * an envelope change that is not what this test is about.+ */+async function pinnedDefaultModel(): Promise<string> {+ const response = await callCoreRpc<{+ result?: { default_model?: string };+ default_model?: string;+ }>('openhuman.inference_get_client_config', {});+ const config = response.result ?? response;+ return (config.default_model ?? '').trim();+}++/**+ * Make `isTauri()` true for this page.+ *+ * Without this the routing page never loads its config at all:+ * `openhumanGetClientConfig` (`app/src/utils/tauriCommands/config.ts:266-269`)+ * throws "Not running in Tauri" before issuing any RPC, so `default_model`+ * stays empty and the assertions below would fail for a reason that has nothing+ * to do with model configuration. The stubbed `invoke` is never reached —+ * `callCoreRpc` dispatches `openhuman.*` over HTTP in this lane, not through+ * the Tauri IPC bridge. Same shim as `chat-model-managed-catalog.spec.ts` and+ * `settings-advanced-config.spec.ts`.+ */+async function emulateTauriRuntime(page: Page): Promise<void> {+ await page.addInitScript(() => {+ const win = window as typeof window & {+ isTauri?: boolean;+ __TAURI_INTERNALS__?: { invoke?: (cmd: string, args?: unknown) => Promise<unknown> };+ };+ win.isTauri = true;+ win.__TAURI_INTERNALS__ = win.__TAURI_INTERNALS__ ?? {};+ win.__TAURI_INTERNALS__.invoke = win.__TAURI_INTERNALS__.invoke ?? (async () => null);+ });+}++/** Open Connections and select the Routing tab, where the default-model row lives. */+async function openRoutingTab(page: Page): Promise<void> {+ await page.goto('/#/settings/llm');+ await waitForAppReady(page);+ await dismissWalkthroughIfPresent(page);+ await page.getByTestId('ai-tab-routing').click();+ await expect(page.getByTestId('default-model-row')).toBeVisible({ timeout: 15_000 });+}+test.describe('Settings - AI & Skills', () => {test.beforeEach(async ({ page }) => {await bootAuthenticatedPage(page, 'pw-settings-ai-user');@@ -34,4 +92,44 @@ test.describe('Settings - AI & Skills', () => {await expect(page.getByText('Tools').first()).toBeVisible();await expect(page.getByText(/Filesystem|Shell/).first()).toBeVisible();});++ /**+ * Matrix 13.3.1 — the settings route's model configuration survives a reload.+ *+ * Both e2e layers previously asserted only that the LLM tab mounts. Nothing+ * configured anything, so a regression in the settings page's read of+ * `default_model` would ship green.+ *+ * This deliberately drives the value in over the core RPC rather than through+ * the picker dialog. The picker's internals are being rebuilt under #6395 —+ * `chat-model-managed-catalog.spec.ts` is `test.describe.skip`ped for exactly+ * that reason — so a spec that clicked through it would be rewritten with the+ * picker and would meanwhile cover nothing. The durable claim, and the one no+ * spec makes today, is the contract either implementation must honour: what+ * the core holds is what the routing page shows, before and after a reload.+ *+ * The complementary direction (picker click -> core write) stays covered at+ * VU level by `AIPanel.test.tsx` ("pins a managed default model from the+ * routing page") until #6395 lands.+ */+ test('the routing page shows the core-pinned default model and keeps it across a reload', async ({+ page,+ }) => {+ await emulateTauriRuntime(page);+ await callCoreRpc('openhuman.inference_update_model_settings', {+ default_model: PINNED_MODEL,+ });+ expect(await pinnedDefaultModel()).toBe(PINNED_MODEL);++ await openRoutingTab(page);+ await expect(page.getByTestId('default-model-change')).toContainText(PINNED_MODEL);++ await page.reload();+ await waitForAppReady(page);+ await page.getByTestId('ai-tab-routing').click();+ await expect(page.getByTestId('default-model-change')).toContainText(PINNED_MODEL);++ // The page must not have written anything back while rendering.+ expect(await pinnedDefaultModel()).toBe(PINNED_MODEL);+ });});diff --git a/app/test/playwright/specs/skills-registry.spec.ts b/app/test/playwright/specs/skills-registry.spec.tsindex 9b1f2a5cd0..4f0530732f 100644--- a/app/test/playwright/specs/skills-registry.spec.ts+++ b/app/test/playwright/specs/skills-registry.spec.ts@@ -1,4 +1,4 @@-import { expect, test } from '@playwright/test';+import { expect, type Page, test } from '@playwright/test';import {bootRuntimeReadyGuestPage,@@ -8,7 +8,7 @@ import {waitForAppReady,} from '../helpers/core-rpc';-async function openSkillsPage(page: Parameters<typeof test>[0]['page'], userId: string) {+async function openSkillsPage(page: Page, userId: string) {await bootRuntimeReadyGuestPage(page);await signInViaBypassUser(page, userId);await page.evaluate(() => {diff --git a/app/test/playwright/specs/user-journey-settings-round-trip.spec.ts b/app/test/playwright/specs/user-journey-settings-round-trip.spec.tsindex 0eaa4fa146..1004b77d86 100644--- a/app/test/playwright/specs/user-journey-settings-round-trip.spec.ts+++ b/app/test/playwright/specs/user-journey-settings-round-trip.spec.ts@@ -1,4 +1,4 @@-import { expect, test } from '@playwright/test';+import { expect, type Page, test } from '@playwright/test';import { bootAuthenticatedPage, waitForAppReady } from '../helpers/core-rpc';@@ -23,7 +23,7 @@ const panels: PanelCheck[] = [{ hash: '/chat', markers: [] },];-async function waitForPanelLoad(page: Parameters<typeof test>[0]['page']) {+async function waitForPanelLoad(page: Page) {await waitForAppReady(page);const chars = await page.locator('#root').innerText();expect(chars.trim().length).toBeGreaterThan(50);