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: align e2e flows with current app behavior
Steven Enamakel54bacd9a8e09
diff --git a/app/test/e2e/specs/chip-tabs-keyboard.spec.ts b/app/test/e2e/specs/chip-tabs-keyboard.spec.tsindex 6726399be3..f4204c0fb4 100644--- a/app/test/e2e/specs/chip-tabs-keyboard.spec.ts+++ b/app/test/e2e/specs/chip-tabs-keyboard.spec.ts@@ -37,10 +37,12 @@ describe('ChipTabs keyboard traversal', () => {await middle.click();await expectSelectedAndFocused('routing');- // Leave the row, then enter with a real Tab event. This exercises entry- // focus in Radix's roving group before the arrow-key assertions.- await browser.keys(['Shift', 'Tab']);- await expect(middle).not.toBeFocused();+ // Start from the preceding control and enter with a real Tab event. This+ // exercises entry focus in Radix's roving group before arrow-key checks.+ await browser.execute(() => {+ (document.querySelector('[data-testid="search-enabled-toggle"]') as HTMLElement).focus();+ });+ await expect(await waitForTestId('search-enabled-toggle')).toBeFocused();await browser.keys('Tab');await expectSelectedAndFocused('routing');diff --git a/app/test/e2e/specs/logout-relogin-onboarding.spec.ts b/app/test/e2e/specs/logout-relogin-onboarding.spec.tsindex b96124b087..865790f5e2 100644--- a/app/test/e2e/specs/logout-relogin-onboarding.spec.ts+++ b/app/test/e2e/specs/logout-relogin-onboarding.spec.ts@@ -5,9 +5,8 @@* Verifies:* 1. Initial login can complete onboarding and reach Home.* 2. Logout returns to the Welcome screen (session is cleared).- * 3. Re-login via the auth deep-link bypass brings up the onboarding- * overlay at its first step, confirming the fresh session does not- * carry stale mid-flow onboarding state from the previous session.+ * 3. Re-login via the auth deep-link bypass returns to chat without+ * restarting onboarding for the same completed account.** Architecture note: auth tokens live in the Rust core (not Redux-persist).* `applySessionToken` stores the JWT and fires `core-state:session-token-updated`@@ -24,7 +23,6 @@ import {dismissBootCheckGateIfVisible,logoutViaSettings,performFullLogin,- waitForOnboardingOverlayVisible,} from '../helpers/shared-flows';import {clearRequestLog,@@ -33,7 +31,7 @@ import {stopMockServer,} from '../mock-server';-describe('Logout -> re-login onboarding overlay', function () {+describe('Logout -> re-login onboarding state', function () {// Suite-level timeout — covers all hooks and tests. The full flow// (resetApp + first login + logout + test_reset + reload + re-login)// can take 60-90s, well over the default 30s.@@ -53,7 +51,7 @@ describe('Logout -> re-login onboarding overlay', function () {await stopMockServer();});- it('shows onboarding overlay with clean state after logout and re-login', async function () {+ it('keeps completed onboarding after logout and re-login', async function () {const hasChrome = await hasAppChrome();expect(hasChrome).toBe(true);@@ -69,90 +67,36 @@ describe('Logout -> re-login onboarding overlay', function () {await logoutViaSettings('[LogoutReLogin]');// logoutViaSettings confirms "Welcome" is visible — the session is cleared.- // Reset core state (onboarding_completed, chat_onboarding_completed, api_key)- // so the re-login is treated as a fresh user session. Without this,- // the Rust core retains onboarding_completed=true from the first session- // and the overlay would not reappear for the same mock user.- const resetResult = await Promise.race([- callOpenhumanRpc('openhuman.test_reset', {}),- new Promise(resolve => setTimeout(() => resolve({ ok: false, error: 'timeout' }), 8_000)),- ]);- if (!resetResult.ok) {- console.log('[LogoutReLogin] test_reset result:', JSON.stringify(resetResult));- }-- // Reload the renderer so the CoreStateProvider picks up the fresh- // onboarding_completed=false from the Rust core. Without this the- // stale snapshot keeps onboarding_completed=true and the routing- // guard never redirects to /onboarding.- // NOTE: Do NOT clear localStorage here — that destroys the persisted- // core mode and causes the BootCheckGate to block the entire app.+ // Onboarding completion belongs to the user. Re-authenticate the same+ // account and verify logout did not send it through setup again.await browser.execute(() => {window.location.replace('#/');window.location.reload();});await browser.pause(2_000);-- // The reload may surface the BootCheckGate if the core mode was lost- // during logout. Dismiss it so the auth flow can proceed.await waitForWindowVisible(15_000);await waitForWebView(10_000);await dismissBootCheckGateIfVisible(12_000);- await browser.pause(1_000);- // ── Second login (re-login) ───────────────────────────────────────────────- // Use the bypass deep-link path (key=auth) which skips the- // consumeLoginToken→/auth/login-token/consume exchange. After the complex- // logout→test_reset→reload cycle, the full consume flow can race against- // waitForOAuthAuthReadiness timing — the bypass avoids that instability- // while still exercising the core auth path (storeSession, session-token- // event, CoreStateProvider refresh, routing guards).clearRequestLog();-- await triggerAuthDeepLinkBypass('e2e-logout-relogin-second');+ await triggerAuthDeepLinkBypass('e2e-logout-relogin-first-token');await waitForWindowVisible(25_000);await waitForWebView(15_000);await waitForAppReady(15_000);await waitForAuthBootstrap(15_000);- // ── Onboarding must appear for the fresh session ─────────────────────────- // The new user has not completed onboarding, so the routed onboarding shell- // should mount once the profile-backed core snapshot is available.- // Allow extra time for CoreStateProvider to refresh and routing to settle.- const overlayVisible = await waitForOnboardingOverlayVisible(40_000);- if (!overlayVisible) {- // Diagnostic: dump current hash, DOM text, and request log.- const hash = await browser.execute(() => window.location.hash);- const rootText = await browser.execute(() =>- (document.getElementById('root')?.innerText ?? '').slice(0, 500)- );- console.log('[LogoutReLogin] Overlay not visible. hash=' + hash + ' rootText=' + rootText);- }- expect(overlayVisible).toBe(true);-- const route = await browser.execute(() => window.location.hash);- expect(route).toMatch(/^#\/onboarding/);-- // ── Onboarding must be in clean first-step state ─────────────────────────- // If stale mid-flow state from session 1 leaked, a later step would render- // instead of the initial welcome step.await browser.waitUntil(async () =>- (await browser.execute(- () => document.querySelector('[data-testid="onboarding-welcome-step"]') !== null- )) as boolean,- { timeout: 10_000, interval: 250, timeoutMsg: 'Onboarding welcome step did not mount' }+ (await browser.execute(() => window.location.hash.startsWith('#/chat'))) as boolean,+ { timeout: 30_000, interval: 250, timeoutMsg: 'Re-login did not return to chat' });- const firstStep = await browser.execute(() => {- const welcome = document.querySelector('[data-testid="onboarding-welcome-step"]');- return {- mounted: welcome !== null,- heading: welcome?.querySelector('h1')?.textContent?.trim() ?? '',- hasCta: welcome?.querySelector('button[aria-label="Get Started"]') !== null,- };- });- expect(firstStep.mounted).toBe(true);- expect(firstStep.heading).toBe("Hi. I'm OpenHuman.");- expect(firstStep.hasCta).toBe(true);+ const onboarding = await callOpenhumanRpc('openhuman.config_get_onboarding_completed', {});+ expect(onboarding.ok).toBe(true);+ expect(onboarding.result.result).toBe(true);+ expect(+ await browser.execute(+ () => document.querySelector('[data-testid="onboarding-layout"]') !== null+ )+ ).toBe(false);});});diff --git a/app/test/e2e/specs/onboarding-modes.spec.ts b/app/test/e2e/specs/onboarding-modes.spec.tsindex edf75d4657..5254e5b6b8 100644--- a/app/test/e2e/specs/onboarding-modes.spec.ts+++ b/app/test/e2e/specs/onboarding-modes.spec.ts@@ -1,31 +1,10 @@// @ts-nocheck/**- * E2E: Onboarding — Simple (Cloud) vs Advanced (Custom) modes.- *- * Verifies:- * - Phase A — Simple/Cloud path: fresh login → Welcome → Runtime choice- * (Cloud) → /home. `onboarding_completed = true` lands in- * `${OPENHUMAN_WORKSPACE}/config.toml` immediately.- *- * - Phase B — Advanced/Custom path:- * reset onboarding flag → Welcome → Runtime choice (Custom) →- * Inference → Search → Vault (Finish).- * The custom wizard is exactly three steps; Voice, OAuth and Embeddings- * are no longer part of it (they stay configurable from Settings).- * Asserts each of the three step containers renders with the expected- * `data-testid`, that the stepper shows Inference / Search / Vault and- * that the retired steps are never mounted.- *- * - Phase C — Advanced/Custom path using "Skip for now" on the optional- * Search step: Inference → Search (skip, no key configured) →- * Vault (Finish), and `onboarding_completed = true` lands in config.toml.- *- * Auth is the bypass deep-link path. The mock API server runs on the same- * port the dist bundle was built against (see `app/scripts/e2e-run-session.sh`).- * No real network is touched.+ * E2E coverage for the current onboarding split: self-hosted users configure+ * inference/search/vault, while TinyHumans users complete managed setup and go+ * straight to chat.*/-import { waitForAppReady, waitForAuthBootstrap } from '../helpers/app-helpers';-import { readBool, readConfigToml, topLevelValue } from '../helpers/config-toml';+import { waitForApp, waitForAppReady, waitForAuthBootstrap } from '../helpers/app-helpers';import { callOpenhumanRpc } from '../helpers/core-rpc';import { triggerAuthDeepLinkBypass } from '../helpers/deep-link-helpers';import { waitForWebView, waitForWindowVisible } from '../helpers/element-helpers';@@ -40,253 +19,67 @@ import {const STEP_LOG_PREFIX = '[onboarding-modes]';-function stepLog(message: string): void {- console.log(`${STEP_LOG_PREFIX} ${message}`);-}--async function pause(ms: number): Promise<void> {- await browser.pause(ms);-}--/**- * Click a button by `data-testid`. Returns true if the click landed.- */async function clickTestId(testId: string, timeout = 10_000): Promise<boolean> {const deadline = Date.now() + timeout;while (Date.now() < deadline) {- const status = await browser.execute(id => {- const el = document.querySelector<HTMLElement>(`[data-testid="${id}"]`);- if (!el) return 'missing';- if ((el as HTMLButtonElement).disabled) return 'disabled';- // Ensure the element is visible and has layout before clicking.- const rect = el.getBoundingClientRect();- if (rect.width === 0 || rect.height === 0) return 'no-layout';- ['mousedown', 'mouseup', 'click'].forEach(type => {- el.dispatchEvent(- new MouseEvent(type, { bubbles: true, cancelable: true, view: window, button: 0 })- );- });- return 'clicked';+ const clicked = await browser.execute(id => {+ const element = document.querySelector<HTMLElement>(`[data-testid="${id}"]`);+ if (!element || (element as HTMLButtonElement).disabled) return false;+ element.click();+ return true;}, testId);- if (status === 'clicked') return true;- await pause(400);+ if (clicked) return true;+ await browser.pause(250);}return false;}-async function testIdExists(testId: string, timeout = 10_000): Promise<boolean> {+async function hasTestId(testId: string, timeout = 15_000): Promise<boolean> {const deadline = Date.now() + timeout;while (Date.now() < deadline) {- const found = await browser.execute(- id => document.querySelector(`[data-testid="${id}"]`) !== null,- testId- );- if (found) return true;- await pause(400);+ if (+ await browser.execute(id => document.querySelector(`[data-testid="${id}"]`) !== null, testId)+ ) {+ return true;+ }+ await browser.pause(250);}return false;}-async function currentHash(): Promise<string> {- return browser.execute(() => window.location.hash || '');-}--async function waitForHash(prefix: string, timeout = 15_000): Promise<boolean> {+async function waitForHash(prefix: string, timeout = 30_000): Promise<boolean> {const deadline = Date.now() + timeout;while (Date.now() < deadline) {- const hash = await currentHash();- if (hash.startsWith(prefix)) return true;- await pause(400);+ if (await browser.execute(value => window.location.hash.startsWith(value), prefix)) return true;+ await browser.pause(250);}return false;}-async function resetOnboardingFlagAndReload(): Promise<void> {- stepLog('Resetting onboarding_completed=false via RPC');- const res = await callOpenhumanRpc<{ completed: boolean }>(- 'openhuman.config_set_onboarding_completed',- { value: false }+async function onboardingCompleted(): Promise<boolean> {+ const response = await callOpenhumanRpc<boolean | { result: boolean }>(+ 'openhuman.config_get_onboarding_completed',+ {});- if (!res.ok) {- throw new Error(`config.set_onboarding_completed failed: ${JSON.stringify(res)}`);- }- await browser.execute(() => {- try {- window.localStorage.clear();- window.sessionStorage.clear();- } catch {- /* ignore */- }- window.location.replace('#/');- window.location.reload();- });- await waitForWindowVisible(25_000);- await waitForWebView(15_000);- await waitForAppReady(15_000);- await dismissBootCheckGateIfVisible(8_000);- await triggerAuthDeepLinkBypass('e2e-onboarding-modes');- await waitForAuthBootstrap(15_000);- await dismissBootCheckGateIfVisible(8_000);- // Auth bootstrap restores the server-side onboarding snapshot, which can- // overwrite the pre-auth test flag. Apply the requested state once auth is- // settled, then reload so the onboarding gate consumes the new snapshot.- const postAuthRes = await callOpenhumanRpc<{ completed: boolean }>(- 'openhuman.config_set_onboarding_completed',- { value: false }- );- if (!postAuthRes.ok) {- throw new Error(- `post-auth config.set_onboarding_completed failed: ${JSON.stringify(postAuthRes)}`- );- }- await browser.execute(() => window.location.reload());- await waitForAppReady(15_000);- await dismissBootCheckGateIfVisible(8_000);- // Wait for the welcome step to mount before returning.- const onWelcome = await waitForHash('#/onboarding', 15_000);- if (!onWelcome) {- stepLog(`hash after reset = ${await currentHash()}`);- throw new Error('onboarding overlay did not re-mount after flag reset');- }+ if (!response.ok) throw new Error(`Could not read onboarding state: ${response.error}`);+ return typeof response.result === 'boolean' ? response.result : response.result.result;}-async function clickOnboardingNext(): Promise<void> {- // The Welcome step button is the same shared `onboarding-next-button`.- const ok = await clickTestId('onboarding-next-button', 10_000);- if (!ok) {- throw new Error('onboarding-next-button missing or stayed disabled');- }-}--async function waitForCustomSelection(timeout = 5_000): Promise<boolean> {- const deadline = Date.now() + timeout;- while (Date.now() < deadline) {- const selected = await browser.execute(() => {- const el = document.querySelector('[data-testid="onboarding-runtime-choice-custom"]');- return el?.getAttribute('aria-pressed') === 'true';- });- if (selected) return true;- await pause(250);- }- return false;-}--/** Rendered stepper labels of the custom wizard, in DOM order. */-async function stepperLabels(): Promise<string[]> {- return browser.execute(() => {- const items = document.querySelectorAll('[data-testid="onboarding-wizard-stepper"] > li');- return Array.from(items).map(li =>- (li.querySelector('span:last-child')?.textContent ?? '').trim()- );- });-}--async function advanceFromWelcomeToCustomInference(phase: string): Promise<void> {- const reachedChoiceOrInference = await browser- .waitUntil(- async () => {- if (await testIdExists('onboarding-runtime-choice-step', 250)) return true;- if (await testIdExists('onboarding-custom-inference-step', 250)) return true;- if (await testIdExists('onboarding-welcome-step', 250)) {- await clickOnboardingNext();- }- return false;- },- {- timeout: 15_000,- interval: 300,- timeoutMsg: `${phase}: neither runtime choice nor custom inference mounted`,- }- )- .catch(() => false);- if (!reachedChoiceOrInference) {- stepLog(`${phase}: hash while waiting for runtime/custom inference = ${await currentHash()}`);- }- expect(reachedChoiceOrInference).toBe(true);-- if (await testIdExists('onboarding-runtime-choice-step', 500)) {- const inferenceReached = await browser- .waitUntil(- async () => {- if (await testIdExists('onboarding-custom-inference-step', 250)) return true;- if (!(await testIdExists('onboarding-runtime-choice-step', 250))) return false;-- if (!(await clickTestId('onboarding-runtime-choice-custom', 2_000))) {- return false;- }- const customSelected = await waitForCustomSelection(2_000);- if (!customSelected) {- stepLog(`${phase}: Custom card click did not register — retrying`);- return false;- }-- await clickOnboardingNext();- return await testIdExists('onboarding-custom-inference-step', 1_000);- },- {- timeout: 15_000,- interval: 500,- timeoutMsg: `${phase}: custom inference did not mount after runtime choice`,- }- )- .catch(() => false);- expect(inferenceReached).toBe(true);- }-- const inferenceVisible = await testIdExists('onboarding-custom-inference-step', 15_000);- if (!inferenceVisible) {- stepLog(`${phase}: hash before custom inference assertion = ${await currentHash()}`);- }- expect(inferenceVisible).toBe(true);-}--async function waitForHome(timeout = 20_000): Promise<boolean> {- const deadline = Date.now() + timeout;- while (Date.now() < deadline) {- const hash = await currentHash();- // Home was merged into the unified chat surface: /home redirects to /chat- // (AppRoutes.tsx). Accept either so the wizard's post-finish landing check- // survives the IA change.- if (hash.startsWith('#/home') || hash.startsWith('#/chat')) return true;- await pause(400);- }- return false;+async function setOnboardingCompleted(value: boolean): Promise<void> {+ const response = await callOpenhumanRpc('openhuman.config_set_onboarding_completed', { value });+ if (!response.ok) throw new Error(`Could not set onboarding state: ${response.error}`);}-describe('Onboarding modes — Simple (Cloud) vs Advanced (Custom)', function () {- this.timeout(90_000);+describe('Onboarding — self-hosted and managed paths', function () {+ this.timeout(120_000);- before(async function beforeSuite() {- // Reset + auth + onboarding bootstrap can exceed the default 30s hook budget.+ before(async function () {this.timeout(90_000);await startMockServer();resetMockBehavior();setMockBehavior('composioConnections', '[]');- // Reset state but skip the built-in onboarding walker — we walk it- // ourselves to assert the per-step UI.- // This spec needs a non-local authenticated session to exercise the- // Cloud choice. test_reset alone leaves a prior app-session profile in- // place; that profile can be local and intentionally redirects straight- // to the Custom wizard, bypassing the runtime-choice page altogether.+ await waitForApp();await resetApp('e2e-onboarding-modes', { skipAuth: true, clearAuthSession: true });- // resetApp restores onboarding_completed=true for normal specs. Auth- // bootstrap refreshes the renderer snapshot, so change the flag *after*- // login; doing it before auth lets the stale "complete" snapshot bounce- // the runtime-choice route to chat.- await triggerAuthDeepLinkBypass('e2e-onboarding-modes');- await waitForAuthBootstrap(15_000);- await dismissBootCheckGateIfVisible(8_000);- stepLog('Setting onboarding_completed=false after auth bootstrap');- await callOpenhumanRpc('openhuman.config_set_onboarding_completed', { value: false });- await browser.execute(() => {- window.location.replace('#/onboarding/welcome');- window.location.reload();- });- await waitForWindowVisible(25_000);- await waitForWebView(15_000);- await waitForAppReady(15_000);- await waitForAuthBootstrap(15_000);- await waitForHash('#/onboarding', 15_000);});after(async () => {@@ -294,135 +87,80 @@ describe('Onboarding modes — Simple (Cloud) vs Advanced (Custom)', function ()await stopMockServer();});- // ───────────────────────────────────────────────────────────────────────- // Phase A — Simple (Cloud)- // ───────────────────────────────────────────────────────────────────────-- it('simple/cloud path: welcome → runtime-choice → cloud → home', async () => {- // Step 0 — Welcome screen.- const welcomeVisible = await testIdExists('onboarding-next-button', 15_000);- expect(welcomeVisible).toBe(true);- await clickOnboardingNext();-- // Step 1 — Runtime choice. The card is preselected to Cloud, so simply- // clicking the next button continues the cloud path.- // The Windows CEF runner can take more than 10 seconds to commit the- // route transition after a cold auth/onboarding bootstrap.- const choiceVisible = await testIdExists('onboarding-runtime-choice-step', 20_000);- expect(choiceVisible).toBe(true);- const cloudCardVisible = await testIdExists('onboarding-runtime-choice-cloud', 5_000);- expect(cloudCardVisible).toBe(true);- // Explicitly click the Cloud card so the test is robust against the- // default selection changing in the future.- await clickTestId('onboarding-runtime-choice-cloud');- await pause(500);- await clickOnboardingNext();-- const landed = await waitForHome(20_000);- if (!landed) stepLog(`current hash after cloud finish: ${await currentHash()}`);- expect(landed).toBe(true);- });-- it('simple/cloud path: config.toml reflects onboarding_completed=true', async () => {- // The setOnboardingCompletedFlag RPC writes config.save() before the- // navigate() in OnboardingLayout, but I/O can lag a tick. Poll briefly.- let value: boolean | null = null;- const deadline = Date.now() + 8_000;- while (Date.now() < deadline) {- value = readBool(topLevelValue(readConfigToml(), 'onboarding_completed'));- if (value === true) break;- await pause(400);- }- if (value !== true) {- stepLog(`config.toml head:\n${readConfigToml().split('\n').slice(0, 30).join('\n')}`);- }- expect(value).toBe(true);- });-- // ───────────────────────────────────────────────────────────────────────- // Phase B — Advanced (Custom), Default on every step- // ───────────────────────────────────────────────────────────────────────-- it('advanced/custom path: walks the three wizard steps with Default choice', async function () {- // resetOnboardingFlagAndReload includes waitForWindowVisible(25_000), needs extra budget.+ it('self-hosted setup runs the three custom steps and supports skipping Search', async function () {this.timeout(90_000);- await resetOnboardingFlagAndReload();-- await advanceFromWelcomeToCustomInference('Phase B');-- // Step 1 of 3 — Custom Inference. The stepper must list exactly- // the three live steps, in order.- expect(await testIdExists('onboarding-custom-inference-step', 10_000)).toBe(true);- expect(await stepperLabels()).toEqual(['Inference', 'Search', 'Vault']);- await pause(400);- await clickOnboardingNext();-- // Step 2 of 3 — Custom Search.- expect(await testIdExists('onboarding-custom-search-step', 10_000)).toBe(true);- expect(await stepperLabels()).toEqual(['Inference', 'Search', 'Vault']);- await pause(400);- await clickOnboardingNext();-- // Step 3 of 3 — Custom Vault. Final step → Finish. There is no- // Default/Configure fork any more, so Continue is enabled straight away.- expect(await testIdExists('onboarding-custom-vault-step', 10_000)).toBe(true);- await pause(400);- await clickOnboardingNext();-- // The retired steps must never have been part of the flow.- expect(await testIdExists('onboarding-custom-voice-step', 500)).toBe(false);- expect(await testIdExists('onboarding-custom-oauth-step', 500)).toBe(false);- expect(await testIdExists('onboarding-custom-embeddings-step', 500)).toBe(false);+ await setOnboardingCompleted(false);+ expect(await clickTestId('welcome-cta-self')).toBe(true);+ await waitForAppReady(20_000);+ await waitForAuthBootstrap(20_000);++ // The self-hosted CTA creates a local session and routes into the custom+ // wizard. Reapply the flag after identity activation so the gate sees the+ // local user's incomplete state as well.+ await setOnboardingCompleted(false);+ await browser.execute(() => {+ window.location.replace('#/onboarding/custom/inference');+ window.location.reload();+ });+ await waitForAppReady(20_000);- const landed = await waitForHome(20_000);- if (!landed) stepLog(`current hash after custom finish: ${await currentHash()}`);- expect(landed).toBe(true);+ expect(await hasTestId('onboarding-custom-inference-step')).toBe(true);+ const labels = await browser.execute(() =>+ Array.from(document.querySelectorAll('[data-testid="onboarding-wizard-stepper"] > li')).map(+ item => (item.querySelector('span:last-child')?.textContent ?? '').trim()+ )+ );+ expect(labels).toEqual(['Inference', 'Search', 'Vault']);+ expect(await clickTestId('onboarding-next-button')).toBe(true);- // Re-confirm the persisted flag is true after the second completion.- let value: boolean | null = null;- const deadline = Date.now() + 8_000;- while (Date.now() < deadline) {- value = readBool(topLevelValue(readConfigToml(), 'onboarding_completed'));- if (value === true) break;- await pause(400);- }- expect(value).toBe(true);+ expect(await hasTestId('onboarding-custom-search-step')).toBe(true);+ expect(await clickTestId('onboarding-search-skip')).toBe(true);+ expect(await hasTestId('onboarding-custom-vault-step')).toBe(true);+ expect(await clickTestId('onboarding-next-button')).toBe(true);++ expect(await waitForHash('#/chat')).toBe(true);+ expect(await onboardingCompleted()).toBe(true);+ expect(await hasTestId('onboarding-custom-voice-step', 500)).toBe(false);+ expect(await hasTestId('onboarding-custom-oauth-step', 500)).toBe(false);+ expect(await hasTestId('onboarding-custom-embeddings-step', 500)).toBe(false);});- // ───────────────────────────────────────────────────────────────────────- // Phase C — Advanced (Custom), skip the optional Search step- // ───────────────────────────────────────────────────────────────────────-- it('advanced/custom path: Skip for now on Search advances to Vault and completes onboarding', async function () {- // resetOnboardingFlagAndReload includes waitForWindowVisible(25_000), needs extra budget.+ it('managed setup completes automatically and lands in chat', async function () {this.timeout(90_000);- await resetOnboardingFlagAndReload();-- // Welcome → Runtime choice (Custom) → Inference.- await advanceFromWelcomeToCustomInference('Phase C');-- await pause(400);- await clickOnboardingNext();-- // Search is the one genuinely optional step: the skip control moves on- // without a key configured, straight to the Vault step.- expect(await testIdExists('onboarding-custom-search-step', 10_000)).toBe(true);- expect(await testIdExists('onboarding-search-skip', 5_000)).toBe(true);- expect(await clickTestId('onboarding-search-skip')).toBe(true);+ const cleared = await callOpenhumanRpc('openhuman.auth_clear_session', {});+ expect(cleared.ok).toBe(true);+ await browser.execute(() => {+ window.location.replace('#/');+ window.location.reload();+ });+ await waitForWindowVisible(20_000);+ await waitForWebView(15_000);+ await waitForAppReady(20_000);+ await dismissBootCheckGateIfVisible(8_000);- expect(await testIdExists('onboarding-custom-vault-step', 10_000)).toBe(true);- await pause(400);- await clickOnboardingNext();+ await triggerAuthDeepLinkBypass('e2e-onboarding-managed');+ await waitForAppReady(20_000);+ await waitForAuthBootstrap(20_000);- expect(await waitForHome(20_000)).toBe(true);+ // A managed account has no local setup to configure. Exercise its welcome+ // route with an incomplete flag and verify that it marks setup complete.+ await setOnboardingCompleted(false);+ await browser.execute(() => {+ window.location.replace('#/onboarding/welcome');+ window.location.reload();+ });+ await waitForAppReady(20_000);+ await waitForAuthBootstrap(20_000);- let value: boolean | null = null;- const deadline = Date.now() + 8_000;+ const deadline = Date.now() + 20_000;+ let completed = false;while (Date.now() < deadline) {- value = readBool(topLevelValue(readConfigToml(), 'onboarding_completed'));- if (value === true) break;- await pause(400);+ completed = await onboardingCompleted();+ if (completed) break;+ await browser.pause(250);}- expect(value).toBe(true);+ expect(completed).toBe(true);+ expect(await waitForHash('#/chat')).toBe(true);+ expect(await hasTestId('onboarding-layout', 500)).toBe(false);});});diff --git a/app/test/e2e/specs/runtime-picker-login.spec.ts b/app/test/e2e/specs/runtime-picker-login.spec.tsindex ea2d85f3d8..9148a043be 100644--- a/app/test/e2e/specs/runtime-picker-login.spec.ts+++ b/app/test/e2e/specs/runtime-picker-login.spec.ts@@ -1,63 +1,17 @@// @ts-nocheck/**- * E2E test: Runtime picker → provider login → onboarding/home → logout.- *- * Exercises the *first-launch login funnel* end-to-end against the shared- * mock backend, running on the unified Appium chromium-driver session (CEF- * over CDP) — the same harness CI uses for Linux in `e2e/docker-compose.yml`.- *- * Phase 1 — Runtime picker (BootCheckGate ModePicker):- * 1. Reset to Welcome (no auth), then click "Select a Runtime" so- * Welcome dispatches `resetCoreMode()` and the BootCheckGate- * re-renders the picker.- * 2. Verify both runtime options ("Run Locally", "Run on the Cloud")- * plus the picker heading are present.- * 3. Cloud branch:- * - URL/token inputs appear when cloud is selected.- * - Empty URL on Continue → inline URL error.- * - Empty token → inline token error.- * - Unreachable host on "Test Connection" → unreachable status pill- * (no auth backend at 127.0.0.1:1 / picks a closed port).- * 4. Switch back to Local, click Continue. BootCheckGate runs `runBootCheck`- * against the embedded local core (which is already up — the e2e build- * seeds `VITE_OPENHUMAN_E2E_DEFAULT_CORE_MODE=local`) and we land back- * on Welcome with the OAuth provider row visible.- *- * Phase 2 — Provider login (deep-link bypass simulates the OAuth round-trip):- * 5. Welcome shows OAuth provider buttons. We don't click them (that opens- * the system browser), instead we simulate the post-OAuth deep link- * callback — exactly the same code path the real providers exercise- * when the backend redirects back to `openhuman://auth?token=...&key=auth`.- * 6. Walk onboarding (if shown) until we reach Home.- * 7. Verify mock backend recorded the auth/me profile fetch.- *- * Phase 3 — Logout:- * 8. Logout from Settings.- * 9. Confirm we're back on Welcome (logged-out state visible).- *- * The mock server (scripts/mock-api-*) handles auth + profile + onboarding.- * Deep links go through `window.__simulateDeepLink` so the spec is safe on- * the headless Linux container — no system browser, no real OAuth round-trip,- * and no PID-bound URL handler is touched.+ * E2E coverage for the current first-launch choices, local setup, managed+ * sign-in, and logout flow.*/import { waitForApp, waitForAppReady, waitForAuthBootstrap } from '../helpers/app-helpers';+import { callOpenhumanRpc } from '../helpers/core-rpc';import { triggerAuthDeepLinkBypass } from '../helpers/deep-link-helpers';-import {- dumpAccessibilityTree,- hasAppChrome,- textExists,- waitForText,- waitForWebView,- waitForWindowVisible,-} from '../helpers/element-helpers';-import { supportsExecuteScript } from '../helpers/platform';+import { waitForText, waitForWebView, waitForWindowVisible } from '../helpers/element-helpers';import { resetApp } from '../helpers/reset-app';import {+ dismissBootCheckGateIfVisible,logoutViaSettings,- waitForHomePage,- waitForLoggedOutState,waitForRequest,- walkOnboarding,} from '../helpers/shared-flows';import {clearRequestLog,@@ -68,82 +22,69 @@ import {stopMockServer,} from '../mock-server';-const LOG = '[RuntimePicker]';+const LOG = '[WelcomeFlow]';-/**- * Click the smallest clickable element whose textContent contains `text`.- *- * Picker option tiles have a title + description nested in a single button so- * the button's textContent is `<title><description>` — strict equality misses.- * We score by descendant count to prefer the most-specific match (e.g. the- * Continue button text "Continue" matches several ancestors; we want the- * <button> itself, not <body>).- */-async function clickByTextDom(text: string): Promise<boolean> {- if (!supportsExecuteScript()) return false;- return browser.execute(t => {- const all = Array.from(document.querySelectorAll<HTMLElement>('button, [role="button"], a'));- const matches = all.filter(el => (el.textContent ?? '').includes(t));- if (matches.length === 0) return false;- matches.sort((a, b) => a.querySelectorAll('*').length - b.querySelectorAll('*').length);- const clickable = matches[0];- ['mousedown', 'mouseup', 'click'].forEach(type => {- clickable.dispatchEvent(- new MouseEvent(type, { bubbles: true, cancelable: true, view: window, button: 0 })- );- });- return true;- }, text);+async function clickTestId(testId: string, timeout = 15_000): Promise<boolean> {+ const deadline = Date.now() + timeout;+ while (Date.now() < deadline) {+ const clicked = await browser.execute(id => {+ const element = document.querySelector<HTMLElement>(`[data-testid="${id}"]`);+ if (!element || (element as HTMLButtonElement).disabled) return false;+ element.click();+ return true;+ }, testId);+ if (clicked) return true;+ await browser.pause(250);+ }+ return false;}-/** Set value of a controlled input by selector + dispatch React change. */-async function fillInput(selector: string, value: string): Promise<boolean> {- if (!supportsExecuteScript()) return false;- return browser.execute(- ({ sel, val }) => {- const input = document.querySelector(sel) as HTMLInputElement | null;- if (!input) return false;- const setter = Object.getOwnPropertyDescriptor(- window.HTMLInputElement.prototype,- 'value'- )?.set;- setter?.call(input, val);- input.dispatchEvent(new Event('input', { bubbles: true }));- input.dispatchEvent(new Event('change', { bubbles: true }));+async function hasTestId(testId: string, timeout = 15_000): Promise<boolean> {+ const deadline = Date.now() + timeout;+ while (Date.now() < deadline) {+ if (+ await browser.execute(id => document.querySelector(`[data-testid="${id}"]`) !== null, testId)+ ) {return true;- },- { sel: selector, val: value }- );+ }+ await browser.pause(250);+ }+ return false;}-/** Open the BootCheckGate ModePicker by clicking Welcome's "Select a Runtime". */-async function openRuntimePicker(): Promise<boolean> {- // The button text comes from `welcome.selectRuntime` = "Select a Runtime".- // We can't disambiguate from the picker heading by text alone, so we trigger- // through Welcome's button and then assert *picker-only* markers (the option- // tiles) to confirm we landed on the picker phase.- const clicked = await clickByTextDom('Select a Runtime');- if (!clicked) return false;- await browser.pause(1_000);- return Boolean(- (await waitForText('Run Locally (Recommended)', 8_000).catch(() => false)) ||- (await textExists('Run on the Cloud (Complex)'))+async function waitForHash(prefix: string, timeout = 30_000): Promise<boolean> {+ const deadline = Date.now() + timeout;+ while (Date.now() < deadline) {+ if (await browser.execute(value => window.location.hash.startsWith(value), prefix)) return true;+ await browser.pause(250);+ }+ return false;+}++async function setOnboardingCompleted(value: boolean): Promise<void> {+ const result = await callOpenhumanRpc('openhuman.config_set_onboarding_completed', { value });+ if (!result.ok) throw new Error(`Could not set onboarding state: ${result.error}`);+}++async function getOnboardingCompleted(): Promise<boolean> {+ const result = await callOpenhumanRpc<boolean | { result: boolean }>(+ 'openhuman.config_get_onboarding_completed',+ {});+ if (!result.ok) throw new Error(`Could not read onboarding state: ${result.error}`);+ return typeof result.result === 'boolean' ? result.result : result.result.result;}-describe('Runtime picker → login → onboarding → home → logout', () => {- before(async function beforeSuite() {- // resetApp + app-ready can take longer than the default 30s per-hook budget.+describe('Welcome → local setup → managed login → logout', function () {+ this.timeout(180_000);++ before(async function () {this.timeout(90_000);await startMockServer();- await waitForApp();resetMockBehavior();setMockBehavior('composioConnections', '[]');- // skipAuth so we land on Welcome (logged out) — the spec drives login- // itself. clearAuthSession wipes the on-disk session token too, so a prior- // login spec in this shard can't leave us authenticated (which would make- // PublicRoute redirect past Welcome to /home).- await resetApp('e2e-runtime-picker-login', { skipAuth: true, clearAuthSession: true });+ await waitForApp();+ await resetApp('e2e-welcome-login', { skipAuth: true, clearAuthSession: true });clearRequestLog();});@@ -152,220 +93,79 @@ describe('Runtime picker → login → onboarding → home → logout', () => {await stopMockServer();});- // -------------------------------------------------------------------------- // Phase 1: Runtime picker- // --------------------------------------------------------------------------- it('app is running and shows Welcome with OAuth providers', async function () {- this.timeout(90_000);- expect(await hasAppChrome()).toBe(true);+ it('shows both current welcome choices and provider sign-in buttons', async function () {+ this.timeout(60_000);await waitForWindowVisible(20_000);await waitForWebView(15_000);await waitForAppReady(15_000);-- // Welcome.tsx: "Welcome to OpenHuman" title + at least one provider button.expect(await waitForText('Welcome to OpenHuman', 15_000)).toBeTruthy();- expect(await textExists('Select a Runtime')).toBe(true);- });-- it('clicking "Select a Runtime" opens the runtime picker with both options', async () => {- const opened = await openRuntimePicker();- if (!opened) {- const tree = await dumpAccessibilityTree();- console.log(`${LOG} Picker did not open. Tree:\n`, tree.slice(0, 4000));- }- expect(opened).toBe(true);-- expect(await textExists('Run Locally (Recommended)')).toBe(true);- expect(await textExists('Run on the Cloud (Complex)')).toBe(true);- });-- it('cloud option reveals URL + token inputs and validates them', async () => {- // Click the cloud tile.- const clickedCloud = await clickByTextDom('Run on the Cloud (Complex)');- expect(clickedCloud).toBe(true);- await browser.pause(500);-- // URL field shows up.- expect(await textExists('Runtime URL')).toBe(true);- expect(await textExists('Auth Token')).toBe(true);-- // Continue with empty URL → URL error inline.- const continueClicked = await clickByTextDom('Continue');- expect(continueClicked).toBe(true);- await browser.pause(500);- expect(await textExists('Please enter a runtime URL.')).toBe(true);-- // Fill URL but leave token empty → token error.- const urlOk = await fillInput('input[type="url"]', 'http://127.0.0.1:1/rpc');- expect(urlOk).toBe(true);- await clickByTextDom('Continue');- await browser.pause(500);- expect(await textExists("We'll need an auth token to connect.")).toBe(true);- });-- it('"Test Connection" against an unreachable host shows the unreachable pill', async function () {- this.timeout(60_000);- // The ModePicker can re-render back to the runtime *choice cards* between- // the sequential `it`s in this suite, dropping the cloud URL/token form the- // previous test revealed. Make this test self-contained: if the Auth Token- // field isn't showing, re-select Cloud and re-enter the (deliberately- // closed-port) URL before filling the token.- if (!(await textExists('Auth Token'))) {- await clickByTextDom('Run on the Cloud (Complex)');- await browser.pause(500);- }- await fillInput('input[type="url"]', 'http://127.0.0.1:1/rpc');- // Token already required; supply something + a deliberately closed port.- // The bearer-token field is a `type="text"` input (password-manager-ignored),- // not `type="password"`, so match it by its placeholder.- const tokenOk = await fillInput(- 'input[placeholder="The bearer token from your remote runtime"]',- 'bad-token-e2e'- );- expect(tokenOk).toBe(true);-- const clicked = await clickByTextDom('Test Connection');- expect(clicked).toBe(true);-- // Either "auth failed" (if something happens to respond) or unreachable.- // Both prove the test path actually fired. Poll up to 45s — under CI load- // chromium-driver/the core's reqwest client can sit on the TCP connect- // timeout to the deliberately-closed port well past 20s before the- // unreachable pill renders (stays within this.timeout(60_000)).- const deadline = Date.now() + 45_000;- let saw = false;- while (Date.now() < deadline) {- if (- (await textExists("Couldn't reach it:")) ||- (await textExists("That token didn't work. Double-check it and try again."))- ) {- saw = true;- break;- }- await browser.pause(500);- }- if (!saw) {- const tree = await dumpAccessibilityTree();- console.log(`${LOG} No test-connection result. Tree:\n`, tree.slice(0, 4000));- }- expect(saw).toBe(true);- });-- it('switching back to Local and clicking Continue closes the picker', async function () {- // Polling up to 25s for picker to close + 15s for logged-out state.- this.timeout(60_000);- expect(await clickByTextDom('Run Locally (Recommended)')).toBe(true);- await browser.pause(500);- expect(await clickByTextDom('Continue')).toBe(true);-- // BootCheckGate flips to 'checking' then 'match' against the in-process- // local core. Eventually we either land on Welcome (still logged out) or- // — if onboarding state leaked — on the onboarding overlay. Either is a- // valid post-picker state; we only care that the picker is gone.- const deadline = Date.now() + 25_000;- let pickerGone = false;- while (Date.now() < deadline) {- const stillThere =- (await textExists('Run Locally (Recommended)')) ||- (await textExists('Run on the Cloud (Complex)'));- if (!stillThere) {- pickerGone = true;- break;- }- await browser.pause(500);- }- if (!pickerGone) {- const tree = await dumpAccessibilityTree();- console.log(`${LOG} Picker did not dismiss. Tree:\n`, tree.slice(0, 4000));- }- expect(pickerGone).toBe(true);-- // We should be back on Welcome (logged-out marker).- const back = await waitForLoggedOutState(15_000);- expect(back).not.toBeNull();+ expect(await hasTestId('welcome-card-self')).toBe(true);+ expect(await hasTestId('welcome-cta-self')).toBe(true);+ expect(await hasTestId('welcome-cta-tinyhumans')).toBe(true);+ const providersVisible = await browser.execute(() => {+ const buttons = Array.from(document.querySelectorAll('button'));+ return buttons.some(button =>+ /Google|GitHub|Twitter|Discord/i.test(+ button.getAttribute('aria-label') || button.textContent || ''+ )+ );+ });+ expect(providersVisible).toBe(true);});- // -------------------------------------------------------------------------- // Phase 2: Provider login (bypass deep link simulates the OAuth callback)- // --------------------------------------------------------------------------- it('OAuth provider buttons render on Welcome', async function () {+ it('self-hosted choice opens and completes the custom wizard', async function () {this.timeout(90_000);- // Real OAuth opens a system browser — out of scope for headless CI. We- // just assert the buttons mount; the deep-link callback below covers the- // post-OAuth path.- const providerButtonPresent = await browser.execute(() => {- const buttons = Array.from(document.querySelectorAll('button'));- return buttons.some(b => {- const label = b.getAttribute('aria-label') || b.textContent || '';- return /Google|GitHub|Twitter|Discord/i.test(label);- });+ await setOnboardingCompleted(false);+ expect(await clickTestId('welcome-cta-self')).toBe(true);+ await waitForAppReady(20_000);+ await waitForAuthBootstrap(20_000);+ await setOnboardingCompleted(false);+ await browser.execute(() => {+ window.location.replace('#/onboarding/custom/inference');+ window.location.reload();});- expect(providerButtonPresent).toBe(true);+ await waitForAppReady(20_000);++ expect(await hasTestId('onboarding-custom-inference-step')).toBe(true);+ expect(await clickTestId('onboarding-next-button')).toBe(true);+ expect(await hasTestId('onboarding-custom-search-step')).toBe(true);+ expect(await clickTestId('onboarding-search-skip')).toBe(true);+ expect(await hasTestId('onboarding-custom-vault-step')).toBe(true);+ expect(await clickTestId('onboarding-next-button')).toBe(true);+ expect(await waitForHash('#/chat')).toBe(true);+ expect(await getOnboardingCompleted()).toBe(true);});- it('deep-link auth callback signs the user in and reaches Home', async function () {- // Auth + onboarding + home confirmation needs more than 30s.+ it('managed sign-in completes its setup and lands in chat', async function () {this.timeout(90_000);+ const cleared = await callOpenhumanRpc('openhuman.auth_clear_session', {});+ expect(cleared.ok).toBe(true);+ await browser.execute(() => {+ window.location.replace('#/');+ window.location.reload();+ });+ await waitForWindowVisible(20_000);+ await waitForWebView(15_000);+ await waitForAppReady(20_000);+ await dismissBootCheckGateIfVisible(8_000);+clearRequestLog();- await triggerAuthDeepLinkBypass('e2e-runtime-picker-user');+ await triggerAuthDeepLinkBypass('e2e-welcome-managed-user');await waitForWindowVisible(20_000);await waitForWebView(15_000);- await waitForAppReady(15_000);+ await waitForAppReady(20_000);await waitForAuthBootstrap(20_000);- // The bypass path does not call the token-consume endpoint (it sets the- // JWT directly) — that's by design. The /auth/me lookup MUST still fire.- const meCall = await waitForRequest(getRequestLog, 'GET', '/auth/me', 20_000);- if (!meCall) {- console.log(`${LOG} /auth/me not seen. Log:`, JSON.stringify(getRequestLog(), null, 2));- }- expect(meCall).toBeTruthy();-- // Walk through onboarding if it's shown (new user path); a returning user- // would skip directly to Home. walkOnboarding is a no-op when there's no- // onboarding-next-button mounted.- await walkOnboarding(LOG);-- // Confirm we're authenticated + post-onboarding. waitForHomePage's- // hardcoded greeting strings (Good morning / Test / etc.) can miss- // valid Home renders, so fall back to a route + welcome-gone check.- const home = await waitForHomePage(15_000);- if (home) {- console.log(`${LOG} Home reached: "${home}"`);- } else {- const deadline = Date.now() + 15_000;- let onHome = false;- while (Date.now() < deadline) {- const hash = (await browser.execute(() => window.location.hash)) as string;- const stillOnWelcome = await textExists('Welcome to OpenHuman');- if (!stillOnWelcome && (hash.startsWith('#/home') || hash.startsWith('#/chat'))) {- onHome = true;- break;- }- await browser.pause(500);- }- if (!onHome) {- const tree = await dumpAccessibilityTree();- console.log(`${LOG} Home not reached. Tree:\n`, tree.slice(0, 4000));- }- expect(onHome).toBe(true);- }+ expect(await waitForRequest(getRequestLog, 'GET', '/auth/me', 20_000)).toBeTruthy();+ expect(await waitForHash('#/chat')).toBe(true);+ expect(await getOnboardingCompleted()).toBe(true);});- // -------------------------------------------------------------------------- // Phase 3: Logout returns to Welcome- // --------------------------------------------------------------------------- it('logout from Settings returns the user to Welcome', async function () {- // Logout navigation + confirmation + wait for Welcome can take > 30s.+ it('logout returns the user to the current Welcome choices', async function () {this.timeout(60_000);await logoutViaSettings(LOG);-- // logoutViaSettings already asserts the logged-out marker; double-check- // the Welcome OAuth row reappeared so we know the route reset cleanly.expect(await waitForText('Welcome to OpenHuman', 15_000)).toBeTruthy();- expect(await textExists('Select a Runtime')).toBe(true);+ expect(await hasTestId('welcome-cta-self')).toBe(true);+ expect(await hasTestId('welcome-cta-tinyhumans')).toBe(true);});});diff --git a/app/test/playwright/specs/onboarding-required-step-gate.spec.ts b/app/test/playwright/specs/onboarding-required-step-gate.spec.tsindex 30908ec8c1..e08fa83218 100644--- a/app/test/playwright/specs/onboarding-required-step-gate.spec.ts+++ b/app/test/playwright/specs/onboarding-required-step-gate.spec.ts@@ -64,6 +64,9 @@ async function bootWithSession(await bootRuntimeReadyGuestPage(page);await callCoreRpc('openhuman.auth_store_session', {token: sessionToken(userId, kind === 'local' ? 'local' : 'sig'),+ ...(kind === 'local'+ ? { user: { _id: 'local', id: 'local', name: 'Local User', email: '[email protected]' } }+ : {}),});await callCoreRpc('openhuman.config_set_onboarding_completed', { value: false });await page.goto(`/#${startHash}`);diff --git a/crates/openhuman-core/src/config/schema/load_managed_provider_tests.rs b/crates/openhuman-core/src/config/schema/load_managed_provider_tests.rsnew file mode 100644index 0000000000..cca1600722--- /dev/null+++ b/crates/openhuman-core/src/config/schema/load_managed_provider_tests.rs@@ -0,0 +1,86 @@+use super::*;++// ── fresh-install provider seeding (#6205) ──────────────────────────────+//+// The case neither the original fix nor its tests covered, and the one that+// regressed: a workspace created *today*, not one migrated from an older+// schema.++/// A brand-new workspace must be born with the managed `openhuman` cloud+/// provider.+///+/// `load_or_init` stamps a fresh config with `CURRENT_SCHEMA_VERSION`, so the+/// `run_pending` call that follows crosses no gate at all — including the+/// `== 1` step that is the only place this entry has ever been seeded. Without+/// creation-site seeding the list is empty, and no later migration can repair+/// it, because the workspace is already past every gate that would have.+///+/// This is what made `inference_list_models("openhuman")` fail its lookup in+/// `inference::provider::ops::models` before any HTTP request was made, which+/// is what #6201's model picker surfaced as "Could not load models from this+/// provider."+#[tokio::test]+async fn a_brand_new_workspace_is_born_with_the_managed_provider() {+ use crate::config::schema::cloud_providers::AuthStyle;++ let tmp = tempfile::tempdir().unwrap();+ let config = load_or_init_for_workspace(tmp.path()).await;++ let managed = config+ .cloud_providers+ .iter()+ .find(|p| p.slug == "openhuman")+ .unwrap_or_else(|| {+ panic!(+ "a fresh workspace must carry the managed provider, got {:?}",+ config+ .cloud_providers+ .iter()+ .map(|p| p.slug.as_str())+ .collect::<Vec<_>>()+ )+ });+ assert_eq!(managed.auth_style, AuthStyle::OpenhumanJwt);+ assert!(+ !managed.endpoint.trim().is_empty(),+ "the seeded entry needs a resolvable endpoint"+ );++ // Seeded before the first `save`, so it is on disk from the very first+ // write — not merely in memory awaiting some later persist.+ let on_disk = tokio::fs::read_to_string(&config.config_path)+ .await+ .unwrap();+ assert!(+ on_disk.contains("slug = \"openhuman\""),+ "the seeded entry must be persisted by the initial save, got:\n{on_disk}"+ );+}++/// Re-opening that workspace must not seed a second copy.+///+/// `seed_cloud_providers` early-returns on a non-empty list, and the version+/// gate is already past, so the second load has to be a no-op. A duplicate here+/// would mean the entry is being created on a path that does not check first.+#[tokio::test]+async fn reopening_a_seeded_workspace_does_not_duplicate_the_provider() {+ let tmp = tempfile::tempdir().unwrap();+ let first = load_or_init_for_workspace(tmp.path()).await;+ let seeded = first+ .cloud_providers+ .iter()+ .filter(|p| p.slug == "openhuman")+ .count();+ assert_eq!(seeded, 1, "first load seeds exactly one managed entry");++ let second = load_or_init_for_workspace(tmp.path()).await;+ assert_eq!(+ second+ .cloud_providers+ .iter()+ .filter(|p| p.slug == "openhuman")+ .count(),+ 1,+ "re-opening the workspace must not seed a second managed entry"+ );+}diff --git a/crates/openhuman-core/src/config/schema/load_migration_tests.rs b/crates/openhuman-core/src/config/schema/load_migration_tests.rsindex 0ec62cde6c..02273ce2f0 100644--- a/crates/openhuman-core/src/config/schema/load_migration_tests.rs+++ b/crates/openhuman-core/src/config/schema/load_migration_tests.rs@@ -664,88 +664,3 @@ fn resolve_action_dir_rejects_empty_override() {"empty override must be ignored, falling back to default");}--// ── fresh-install provider seeding (#6205) ──────────────────────────────-//-// The case neither the original fix nor its tests covered, and the one that-// regressed: a workspace created *today*, not one migrated from an older-// schema.--/// A brand-new workspace must be born with the managed `openhuman` cloud-/// provider.-///-/// `load_or_init` stamps a fresh config with `CURRENT_SCHEMA_VERSION`, so the-/// `run_pending` call that follows crosses no gate at all — including the-/// `== 1` step that is the only place this entry has ever been seeded. Without-/// creation-site seeding the list is empty, and no later migration can repair-/// it, because the workspace is already past every gate that would have.-///-/// This is what made `inference_list_models("openhuman")` fail its lookup in-/// `inference::provider::ops::models` before any HTTP request was made, which-/// is what #6201's model picker surfaced as "Could not load models from this-/// provider."-#[tokio::test]-async fn a_brand_new_workspace_is_born_with_the_managed_provider() {- use crate::config::schema::cloud_providers::AuthStyle;-- let tmp = tempfile::tempdir().unwrap();- let config = load_or_init_for_workspace(tmp.path()).await;-- let managed = config- .cloud_providers- .iter()- .find(|p| p.slug == "openhuman")- .unwrap_or_else(|| {- panic!(- "a fresh workspace must carry the managed provider, got {:?}",- config- .cloud_providers- .iter()- .map(|p| p.slug.as_str())- .collect::<Vec<_>>()- )- });- assert_eq!(managed.auth_style, AuthStyle::OpenhumanJwt);- assert!(- !managed.endpoint.trim().is_empty(),- "the seeded entry needs a resolvable endpoint"- );-- // Seeded before the first `save`, so it is on disk from the very first- // write — not merely in memory awaiting some later persist.- let on_disk = tokio::fs::read_to_string(&config.config_path)- .await- .unwrap();- assert!(- on_disk.contains("slug = \"openhuman\""),- "the seeded entry must be persisted by the initial save, got:\n{on_disk}"- );-}--/// Re-opening that workspace must not seed a second copy.-///-/// `seed_cloud_providers` early-returns on a non-empty list, and the version-/// gate is already past, so the second load has to be a no-op. A duplicate here-/// would mean the entry is being created on a path that does not check first.-#[tokio::test]-async fn reopening_a_seeded_workspace_does_not_duplicate_the_provider() {- let tmp = tempfile::tempdir().unwrap();- let first = load_or_init_for_workspace(tmp.path()).await;- let seeded = first- .cloud_providers- .iter()- .filter(|p| p.slug == "openhuman")- .count();- assert_eq!(seeded, 1, "first load seeds exactly one managed entry");-- let second = load_or_init_for_workspace(tmp.path()).await;- assert_eq!(- second- .cloud_providers- .iter()- .filter(|p| p.slug == "openhuman")- .count(),- 1,- "re-opening the workspace must not seed a second managed entry"- );-}diff --git a/crates/openhuman-core/src/config/schema/load_tests.rs b/crates/openhuman-core/src/config/schema/load_tests.rsindex 5457972453..845e199fcd 100644--- a/crates/openhuman-core/src/config/schema/load_tests.rs+++ b/crates/openhuman-core/src/config/schema/load_tests.rs@@ -112,3 +112,6 @@ mod env_overlay_context_tests;mod env_overlay_tests;#[path = "load_migration_tests.rs"]mod migration_tests;++#[path = "load_managed_provider_tests.rs"]+mod managed_provider_tests;diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rsindex 2e0c5ad58a..a8d8981fe2 100644--- a/crates/openhuman-core/src/core/runtime/context.rs+++ b/crates/openhuman-core/src/core/runtime/context.rs@@ -228,7 +228,7 @@ impl CoreContext {// 2. Load the master encryption key before any config/credential op that// needs to decrypt secrets. No-op if already called (e.g. from// run_core_from_args for the CLI).- crate::security::keyring::init_master_key();+ crate::security::keyring::init_master_key().map_err(anyhow::Error::msg)?;// 4. Seed the per-process RPC bearer. `Fixed` seeds the in-memory value// directly (never touches the env); `EnvOrFile` readsdiff --git a/scripts/ci/check-openhuman-rust-layout.mjs b/scripts/ci/check-openhuman-rust-layout.mjsindex dc7939fe31..f773da35dc 100644--- a/scripts/ci/check-openhuman-rust-layout.mjs+++ b/scripts/ci/check-openhuman-rust-layout.mjs@@ -43,7 +43,7 @@ const LEGACY_LIMIT_ENTRIES = [// provider, security, memory, tool and prompt policy. Generic session// state moved to tinyagents-runtime; this remaining composition is split in// a follow-up without reintroducing an old harness/session exception.- ["crates/openhuman-core/src/agent/session_host/builder/factory.rs", 1001],+ ["crates/openhuman-core/src/agent/session_host/builder/factory.rs", 999],["crates/openhuman-core/src/agent/subagent_host/lifecycle.rs", 1309],["crates/openhuman-core/src/agent/subagent_host/ops/runner.rs", 1152],["crates/openhuman-core/src/tools/ops.rs", 1209],diff --git a/tests/in_process/domain_modules_e2e.rs b/tests/in_process/domain_modules_e2e.rsindex fed037025e..04cb83fce8 100644--- a/tests/in_process/domain_modules_e2e.rs+++ b/tests/in_process/domain_modules_e2e.rs@@ -156,22 +156,15 @@ async fn target_domain_schemas_are_exposed_over_http_schema_catalog() {#[tokio::test]async fn legacy_memory_backend_is_off_and_persisted_through_json_rpc() {let _lock = env_lock_async().await;- let harness = setup().await;- // A signed-out core reads the local user's config, not the top-level one.- let config_path = harness- ._tmp- .path()- .join(".openhuman/users/local/config.toml");- std::fs::create_dir_all(config_path.parent().expect("config dir")).expect("create config dir");- std::fs::write(- &config_path,+ let harness = setup_with_config(Some(r#"[memory]backend = "sqlite"embedding_model = "local-embedding""#,- )- .expect("write config");+ ))+ .await;+ let config_path = harness._tmp.path().join(".openhuman/config.toml");let engine = rpc(&harness.rpc_base,