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): remove retired cron prompt-flow specs
Steven Enamakelc10c346d5e65
diff --git a/app/scripts/e2e-run-all-flows.sh b/app/scripts/e2e-run-all-flows.shindex f26b6c2f9f..3f2579a56c 100755--- a/app/scripts/e2e-run-all-flows.sh+++ b/app/scripts/e2e-run-all-flows.sh@@ -315,7 +315,6 @@ if should_run_suite "webhooks"; thenrun "test/e2e/specs/webhooks-tunnel-flow.spec.ts" "webhooks-tunnel" "webhooks"run "test/e2e/specs/harness-channel-bridge-flow.spec.ts" "harness-channel-bridge" "webhooks"run "test/e2e/specs/harness-composio-tool-flow.spec.ts" "harness-composio-tool" "webhooks"- run "test/e2e/specs/harness-cron-prompt-flow.spec.ts" "harness-cron-prompt" "webhooks"run "test/e2e/specs/harness-search-tool-flow.spec.ts" "harness-search-tool" "webhooks"_mini_summary "webhooks"fidiff --git a/app/test/e2e/specs/harness-cron-prompt-flow.spec.ts b/app/test/e2e/specs/harness-cron-prompt-flow.spec.tsdeleted file mode 100644index 5dd1858745..0000000000--- a/app/test/e2e/specs/harness-cron-prompt-flow.spec.ts+++ /dev/null@@ -1,244 +0,0 @@-// @ts-nocheck-/**- * Harness — Cron prompt-flow (WS-D spec 2).- *- * Exercises the agent harness routing natural-language cron-management prompts- * through the mock LLM, which emits cron tool calls, and verifies that the- * in-process core actually mutates cron state (confirmed via oracle RPCs).- *- * Actual tool names discovered in crates/openhuman-core/src/tools/impl/cron/:- * - "cron_add" — create a new cron job- * - "cron_list" — list existing jobs- * - "cron_update" — change schedule / enabled flag- * - "cron_remove" — delete a job- * - "cron_run" — trigger a job immediately- * - "cron_runs" — list run history- *- * Scenarios:- * CR2.1 — Create via NL: "remind me every morning at 9am" → cron_add tool call- * → oracle RPC confirms job exists → UI shows creation confirmation- * CR2.2 — List jobs: pre-create 2 jobs via oracle RPC → "what are my scheduled tasks"- * → LLM returns content listing them (no tool call needed) → UI shows reply- * CR2.3 — Update schedule: pre-create job → "change my morning reminder to 8am"- * → cron_update tool call → oracle confirms schedule changed- * CR2.4 — Delete via prompt: pre-create job → "delete the morning reminder"- * → cron_remove tool call → oracle confirms job gone- *- * Note on tool call execution in E2E:- * Whether the core actually EXECUTES the cron tool (persisting the job) vs.- * merely routing it depends on the tool being registered in the harness's- * tool registry and the E2E app having all required config. Cron tools are- * core-domain operations that do not require external credentials, so they- * should execute against the in-process core.- *- * If a tool call does not persist (oracle RPC shows no change), we document- * it with a TODO comment and fall back to asserting the LLM-side behavior.- */-import { waitForApp } from '../helpers/app-helpers';-import {- chatMounted,- clickByTitle,- clickSend,- getSelectedThreadId,- typeIntoComposer,- waitForAssistantReplyContaining,- waitForSocketConnected,-} from '../helpers/chat-harness';-import { callOpenhumanRpc } from '../helpers/core-rpc';-import { textExists } from '../helpers/element-helpers';-import { resetApp } from '../helpers/reset-app';-import { navigateViaHash } from '../helpers/shared-flows';-import {- clearRequestLog,- resetMockBehavior,- setMockBehavior,- startMockServer,- stopMockServer,-} from '../mock-server';--const LOG_PREFIX = '[HarnessCron]';-const USER_ID = 'e2e-harness-cron-prompt-flow';--// ----------------------------------------------------------------------------// Oracle helpers-// -----------------------------------------------------------------------------/** Retrieve the current cron job list via oracle RPC. */-async function listCronJobs(): Promise<Array<{ id: string; name: string; schedule?: string }>> {- const out = await callOpenhumanRpc('openhuman.cron_list', {});- if (!out.ok) {- console.warn(`${LOG_PREFIX} cron_list RPC failed: ${JSON.stringify(out)}`);- return [];- }- const result = (out.result as { result?: unknown } | undefined)?.result ?? out.result;- return Array.isArray(result) ? result : [];-}--/** Create a cron job via oracle RPC. Returns the created job id.- *- * The `openhuman.cron_add` RPC requires either a `command` (shell job) or a- * `prompt` (agent job); with neither, it defaults to shell and rejects with- * `"'command' is required for shell jobs"`. This oracle seeds an agent job- * because the harness scenarios exercise agent-style scheduled reminders.- *- * `cron_add` has no way to seed a job disabled (the RPC hard-codes- * `enabled: true` for agent jobs; see `crates/openhuman-core/src/cron/schemas.rs:359`).- * Since scenarios seed schedules like `0 9 * * *` and `0 10 * * 5`, a run- * that crosses one of those times would otherwise let the scheduler fire- * the oracle job during a later scenario — consuming mock LLM responses- * and adding stray request-log entries. Immediately disable the job via- * `cron_update` so the seed stays inert; the CR2.3 / CR2.4 flows still- * exercise update/remove against a real stored job. */-async function createCronJobOracle(params: {- name: string;- schedule: string;- enabled?: boolean;-}): Promise<string | null> {- const out = await callOpenhumanRpc('openhuman.cron_add', {- name: params.name,- schedule: { kind: 'cron', expr: params.schedule },- job_type: 'agent',- prompt: `e2e oracle seed: ${params.name}`,- });- if (!out.ok) {- console.warn(`${LOG_PREFIX} cron_add oracle failed: ${JSON.stringify(out)}`);- return null;- }- const result = (out.result as { result?: unknown } | undefined)?.result ?? out.result;- const id = (result as { id?: string })?.id ?? null;- console.log(`${LOG_PREFIX} oracle cron_add: name=${params.name}, id=${id}`);- if (id) {- const disable = await callOpenhumanRpc('openhuman.cron_update', {- job_id: id,- patch: { enabled: false },- });- if (!disable.ok) {- console.warn(`${LOG_PREFIX} cron_update disable oracle failed: ${JSON.stringify(disable)}`);- } else {- console.log(`${LOG_PREFIX} oracle cron disabled: id=${id}`);- }- }- return id;-}--// ----------------------------------------------------------------------------// Navigation helper-// -----------------------------------------------------------------------------async function navigateChatAndSend(prompt: string): Promise<string | null> {- await navigateViaHash('/chat');- await browser.waitUntil(async () => await chatMounted(), {- timeout: 15_000,- timeoutMsg: 'Conversations panel did not mount',- });- expect(await clickByTitle('New thread', 8_000)).toBe(true);- const threadId = (await browser.waitUntil(async () => await getSelectedThreadId(), {- timeout: 8_000,- timeoutMsg: 'thread.selectedThreadId never populated',- })) as string;-- await typeIntoComposer(prompt);- const socketReady = await waitForSocketConnected(30_000);- if (!socketReady) {- console.warn(`${LOG_PREFIX} socket did not connect within 30s — send may fail`);- }- expect(- await browser.waitUntil(async () => await clickSend(), {- timeout: 15_000,- timeoutMsg: 'Send button never enabled',- })- ).toBe(true);- console.log(`${LOG_PREFIX} Sent: "${prompt.slice(0, 80)}"`);- return threadId;-}--// ----------------------------------------------------------------------------// Suite-// -----------------------------------------------------------------------------describe('Harness - Cron prompt-flow', () => {- before(async function beforeSuite() {- this.timeout(90_000);- console.log(`${LOG_PREFIX} Starting mock server and resetting app`);- await startMockServer();- await waitForApp();- await resetApp(USER_ID);- console.log(`${LOG_PREFIX} Suite setup complete`);- });-- after(async () => {- resetMockBehavior();- await stopMockServer();- console.log(`${LOG_PREFIX} Suite teardown complete`);- });-- // ── CR2.1 — Create cron via natural language ──────────────────────────────-- // TODO(#6391): the TinyAgents update no longer exposes write-tool approval prompts.- // Retired legacy direct cron_* call; the supported use_skill path is covered in Playwright.-- // ── CR2.2 — List jobs ─────────────────────────────────────────────────────-- it('CR2.2 — "what are my scheduled tasks" — LLM lists pre-seeded jobs in reply', async function () {- this.timeout(120_000);- console.log(`${LOG_PREFIX} CR2.2: begin`);-- clearRequestLog();- resetMockBehavior();-- // Pre-create two jobs via oracle so they exist in the in-process core.- await createCronJobOracle({ name: 'daily_standup', schedule: '0 9 * * 1-5' });- await createCronJobOracle({ name: 'weekly_review', schedule: '0 10 * * 5' });-- // Verify they exist.- const jobs = await listCronJobs();- console.log(`${LOG_PREFIX} CR2.2: pre-send jobs: ${jobs.map(j => j.name).join(', ')}`);-- // This scenario does not require a tool call — the LLM can simply return- // a content-only response that lists the job names.- const CANARY = 'canary-cron-list-c3d4';- const KEYWORD_RULES = [- {- keyword: 'scheduled tasks',- content: `You have 2 scheduled tasks: daily_standup (weekdays 9am) and weekly_review (Fridays 10am). ${CANARY}`,- },- ];- setMockBehavior('llmKeywordRules', JSON.stringify(KEYWORD_RULES));- setMockBehavior('llmStreamChunkDelayMs', '10');-- await navigateChatAndSend('what are my scheduled tasks');-- await browser.waitUntil(async () => await textExists(CANARY), {- timeout: 60_000,- timeoutMsg: `CR2.2: list-jobs canary "${CANARY}" never appeared`,- });- expect(await waitForAssistantReplyContaining('daily_standup', { logPrefix: LOG_PREFIX })).toBe(- true- );- expect(await waitForAssistantReplyContaining('weekly_review', { logPrefix: LOG_PREFIX })).toBe(- true- );-- // Oracle: jobs still exist after the query (no side effects).- const afterJobs = await listCronJobs();- const hasDailyStandup = afterJobs.some(j => j.name === 'daily_standup');- const hasWeeklyReview = afterJobs.some(j => j.name === 'weekly_review');- console.log(- `${LOG_PREFIX} CR2.2: oracle post-query — daily_standup=${hasDailyStandup}, weekly_review=${hasWeeklyReview}`- );- // Jobs were either created and still exist, or oracle is not available in this build.- // Either way, the UI assertion holds.-- console.log(`${LOG_PREFIX} CR2.2: PASSED`);- });-- // ── CR2.3 — Update schedule ───────────────────────────────────────────────-- // TODO(#6391): the TinyAgents update no longer exposes write-tool approval prompts.- // Retired legacy direct cron_* call; the supported use_skill path is covered in Playwright.-- // ── CR2.4 — Delete via prompt ─────────────────────────────────────────────-- // TODO(#6391): the TinyAgents update no longer exposes write-tool approval prompts.- // Retired legacy direct cron_* call; the supported use_skill path is covered in Playwright.-});diff --git a/app/test/playwright/specs/harness-cron-prompt-flow.spec.ts b/app/test/playwright/specs/harness-cron-prompt-flow.spec.tsdeleted file mode 100644index bb2a5fb052..0000000000--- a/app/test/playwright/specs/harness-cron-prompt-flow.spec.ts+++ /dev/null@@ -1,240 +0,0 @@-import { expect, type Page, test } from '@playwright/test';--import { agentMessageText } from '../helpers/chat-locators';-import {- bootAuthenticatedPage,- dismissWalkthroughIfPresent,- waitForAppReady,-} from '../helpers/core-rpc';--const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;-const USER_ID = 'pw-harness-cron-prompt-flow';--interface MockRequest {- method: string;- url: string;- body?: string;-}--async function resetMock(): Promise<void> {- await fetch(`${MOCK_ADMIN_BASE}/__admin/reset`, {- method: 'POST',- headers: { 'Content-Type': 'application/json' },- body: JSON.stringify({}),- });-}--async function setMockBehavior(key: string, value: string): Promise<void> {- await fetch(`${MOCK_ADMIN_BASE}/__admin/behavior`, {- method: 'POST',- headers: { 'Content-Type': 'application/json' },- body: JSON.stringify({ key, value }),- });-}--async function requests(): Promise<MockRequest[]> {- const response = await fetch(`${MOCK_ADMIN_BASE}/__admin/requests`);- const payload = (await response.json()) as { data?: MockRequest[] };- return Array.isArray(payload.data) ? payload.data : [];-}--async function openChat(page: Page): Promise<void> {- await bootAuthenticatedPage(page, USER_ID, '/chat');- await page.goto('/#/chat');- await waitForAppReady(page);- await dismissWalkthroughIfPresent(page);- await expect(page.getByTestId('chat-message-input')).toBeVisible();-}--async function selectedThreadId(page: Page): Promise<string | null> {- return page.evaluate(() => {- const store = (- window as unknown as {- __OPENHUMAN_STORE__?: {- getState?: () => { thread?: { selectedThreadId?: string | null } };- };- }- ).__OPENHUMAN_STORE__;- return store?.getState?.().thread?.selectedThreadId ?? null;- });-}--async function createNewThread(page: Page): Promise<string> {- const before = await selectedThreadId(page);- await dismissWalkthroughIfPresent(page);- const sidebarButton = page.getByTestId('new-thread-sidebar-button');- if (await sidebarButton.isVisible().catch(() => false)) {- await sidebarButton.click({ force: true });- } else {- await page.getByTestId('new-thread-button').click({ force: true });- }- await expect- .poll(async () => {- const current = await selectedThreadId(page);- return current && current !== before ? current : null;- })- .not.toBeNull();- const id = await selectedThreadId(page);- if (!id) throw new Error('selectedThreadId was not populated');- return id;-}--async function waitForSocketConnected(page: Page): Promise<void> {- await expect- .poll(- async () =>- page.evaluate(() => {- const store = (- window as unknown as {- __OPENHUMAN_STORE__?: {- getState?: () => { socket?: { byUser?: Record<string, { status?: string }> } };- };- }- ).__OPENHUMAN_STORE__;- const byUser = store?.getState?.().socket?.byUser ?? {};- return Object.values(byUser).some(entry => entry?.status === 'connected');- }),- { timeout: 30_000 }- )- .toBe(true);-}--async function sendMessage(page: Page, prompt: string): Promise<void> {- await waitForSocketConnected(page);- await dismissWalkthroughIfPresent(page);- await page.getByTestId('chat-message-input').fill(prompt);- await dismissWalkthroughIfPresent(page);- await expect(page.getByTestId('send-message-button')).toBeEnabled();- await page.getByTestId('send-message-button').click();-}--test.describe('Harness - Cron prompt-flow', () => {- test.beforeEach(async ({ page }) => {- await resetMock();- await openChat(page);- await createNewThread(page);- });-- test('natural-language create flow yields a final reply and may persist a job', async ({- page,- }) => {- const CANARY = 'canary-cron-create-a1b2';- await setMockBehavior(- 'llmForcedResponses',- JSON.stringify([- {- content: '',- toolCalls: [- {- id: 'call_cron_add_1',- name: 'use_skill',- arguments: JSON.stringify({- skill: 'scheduling',- tool: 'cron',- args: {- action: 'add',- name: 'morning_reminder',- schedule: { kind: 'cron', expr: '0 9 * * *' },- prompt: 'morning reminder',- enabled: true,- },- }),- },- ],- },- { content: `Done! I have set up a daily 9am morning reminder for you. ${CANARY}` },- ])- );- await setMockBehavior('llmStreamChunkDelayMs', '10');-- await sendMessage(page, 'remind me every morning at 9am');- await expect(agentMessageText(page, CANARY)).toBeVisible({ timeout: 60_000 });- await expect(- agentMessageText(page, /Done! I have set up a daily 9am morning reminder/i)- ).toBeVisible();- const log = await requests();- const llmHits = log.filter(- request => request.method === 'POST' && request.url.includes('/chat/completions')- );- expect(llmHits.length).toBeGreaterThanOrEqual(2);- });-- test('listing scheduled tasks returns the forced response', async ({ page }) => {- const CANARY = 'canary-cron-list-c3d4';- await setMockBehavior(- 'llmForcedResponses',- JSON.stringify([- {- content: `You have 2 scheduled tasks: daily_standup (weekdays 9am) and weekly_review (Fridays 10am). ${CANARY}`,- },- ])- );- await setMockBehavior('llmStreamChunkDelayMs', '10');-- await sendMessage(page, 'what are my scheduled tasks');- await expect(agentMessageText(page, CANARY)).toBeVisible({ timeout: 60_000 });- await expect(page.getByText(/You have 2 scheduled tasks/i)).toBeVisible();- });-- test('schedule update flow yields a final reply', async ({ page }) => {- const CANARY = 'canary-cron-update-e5f6';- await setMockBehavior(- 'llmForcedResponses',- JSON.stringify([- {- content: '',- toolCalls: [- {- id: 'call_cron_update_1',- name: 'use_skill',- arguments: JSON.stringify({- skill: 'scheduling',- tool: 'cron',- args: {- action: 'update',- job_id: 'morning_reminder_update_test',- patch: { schedule: { kind: 'cron', expr: '0 8 * * *' } },- },- }),- },- ],- },- { content: `Done! I have changed your morning reminder to 8am. ${CANARY}` },- ])- );- await setMockBehavior('llmStreamChunkDelayMs', '10');-- await sendMessage(page, 'change my morning reminder to 8am');- await expect(agentMessageText(page, CANARY)).toBeVisible({ timeout: 60_000 });- await expect(agentMessageText(page, /changed your morning reminder to 8am/i)).toBeVisible();- });-- test('delete flow yields a final reply', async ({ page }) => {- const CANARY = 'canary-cron-delete-g7h8';- await setMockBehavior(- 'llmForcedResponses',- JSON.stringify([- {- content: '',- toolCalls: [- {- id: 'call_cron_remove_1',- name: 'use_skill',- arguments: JSON.stringify({- skill: 'scheduling',- tool: 'cron',- args: { action: 'remove', job_id: 'morning_reminder_delete_test' },- }),- },- ],- },- { content: `Done! I have deleted the morning reminder. ${CANARY}` },- ])- );- await setMockBehavior('llmStreamChunkDelayMs', '10');-- await sendMessage(page, 'delete the morning reminder');- await expect(agentMessageText(page, CANARY)).toBeVisible({ timeout: 60_000 });- await expect(agentMessageText(page, /deleted the morning reminder/i)).toBeVisible();- });-});