Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test: remove obsolete tool and composio e2e specs

Steven Enamakel4ed6979370dd
diff --git a/app/test/e2e/specs/composio-github-tools-tags.spec.ts b/app/test/e2e/specs/composio-github-tools-tags.spec.ts
deleted file mode 100644
index 469626b73d..0000000000
--- a/app/test/e2e/specs/composio-github-tools-tags.spec.ts
+++ /dev/null
@@ -1,279 +0,0 @@
-// @ts-nocheck
-/**
- * Composio GitHub tools — tags query param flow (spec GT).
- *
- * Verifies that when the core calls
- * GET /agent-integrations/composio/tools?toolkits=github&tags=<csv>
- * the mock backend receives the correct query params and returns a
- * tag-filtered tool list can be passed to the Composio execution endpoint.
- *
- * Scenarios:
- * GT.1 — composio.list_tools RPC with toolkits=["github"] and tags=["stars"]
- * forwards ?toolkits=github&tags=stars and returns only starred tools.
- * GT.2 — tags with OR semantics: tags=["stars","repos"] returns the union.
- * GT.3 — non-GitHub toolkit ignores tags (tags stripped before forwarding).
- * GT.4 — a stars-filtered action can be executed through the public RPC.
- */
-import { waitForApp } from '../helpers/app-helpers';
-import { callOpenhumanRpc } from '../helpers/core-rpc';
-import { resetApp } from '../helpers/reset-app';
-import {
- clearRequestLog,
- getRequestLog,
- resetMockBehavior,
- setMockBehavior,
- startMockServer,
- stopMockServer,
-} from '../mock-server';
-
-const LOG_PREFIX = '[ComposioGitHubToolsTags]';
-const USER_ID = 'e2e-composio-github-tools-tags';
-
-// ── Fixtures ──────────────────────────────────────────────────────────────────
-
-/** A minimal OpenAI function-calling tool object for a given action slug. */
-function makeTool(name: string, description = '') {
- return {
- type: 'function',
- function: {
- name,
- description: description || name,
- parameters: { type: 'object', properties: {} },
- },
- };
-}
-
-const STARS_TOOLS = [
- // Use actions in TinyConnectors' curated GitHub catalog. Backend listings
- // apply the user's scope policy, which intentionally hides uncurated slugs.
- makeTool('GITHUB_LIST_REPOSITORIES_FOR_THE_AUTHENTICATED_USER', 'List repositories'),
- makeTool('GITHUB_GET_A_REPOSITORY', 'Get a repository'),
- makeTool('GITHUB_LIST_REPOSITORY_COLLABORATORS', 'List repository collaborators'),
-];
-
-const REPOS_TOOLS = [
- makeTool('GITHUB_SEARCH_REPOSITORIES', 'Search repositories'),
- makeTool('GITHUB_LIST_REPOSITORY_ISSUES', 'List repository issues'),
-];
-
-// ── Seed helper ───────────────────────────────────────────────────────────────
-
-function seedGitHubState(): void {
- setMockBehavior('composioToolkits', JSON.stringify(['github', 'gmail']));
- setMockBehavior(
- 'composioConnections',
- JSON.stringify([{ id: 'conn-github', toolkit: 'github', status: 'ACTIVE' }])
- );
- setMockBehavior('composioToolsByTag_stars', JSON.stringify(STARS_TOOLS));
- setMockBehavior('composioToolsByTag_repos', JSON.stringify(REPOS_TOOLS));
-}
-
-// ── Suite ─────────────────────────────────────────────────────────────────────
-
-describe('Composio GitHub tools — tags query param 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`);
- });
-
- // ── GT.1 — Single tag forwarded and filtered ─────────────────────────────
-
- it('GT.1 — composio.list_tools with tags=["stars"] returns only starred-tools and hits mock with correct query', async function () {
- this.timeout(60_000);
- console.log(`${LOG_PREFIX} GT.1: begin`);
-
- clearRequestLog();
- resetMockBehavior();
- seedGitHubState();
-
- const result = await callOpenhumanRpc('openhuman.composio_list_tools', {
- toolkits: ['github'],
- tags: ['stars'],
- });
-
- expect(result.ok).toBe(true);
- // Outcome with logs serializes as { result: value, logs: [...] };
- // without logs it returns value directly. Unwrap both shapes.
- const raw = result.result as any;
- const tools: Array<{ function: { name: string } }> = raw?.result?.tools ?? raw?.tools ?? [];
-
- console.log(`${LOG_PREFIX} GT.1: received ${tools.length} tool(s)`);
- expect(tools.length).toBe(STARS_TOOLS.length);
-
- const names = tools.map(t => t.function.name);
- expect(names).toContain('GITHUB_LIST_REPOSITORIES_FOR_THE_AUTHENTICATED_USER');
- expect(names).toContain('GITHUB_GET_A_REPOSITORY');
- // repos-only tool must not appear
- expect(names).not.toContain('GITHUB_SEARCH_REPOSITORIES');
-
- // Verify the mock received the correct query params.
- const log = getRequestLog() as Array<{ method: string; url: string }>;
- const toolsHit = log.find(
- r => r.method === 'GET' && r.url.includes('/agent-integrations/composio/tools')
- );
- expect(toolsHit).toBeDefined();
- expect(toolsHit!.url).toContain('toolkits=github');
- expect(toolsHit!.url).toContain('tags=stars');
-
- console.log(`${LOG_PREFIX} GT.1: PASSED — mock hit: ${toolsHit!.url}`);
- });
-
- // ── GT.2 — OR semantics across multiple tags ─────────────────────────────
-
- it('GT.2 — tags=["stars","repos"] returns the union of both tag sets', async function () {
- this.timeout(60_000);
- console.log(`${LOG_PREFIX} GT.2: begin`);
-
- clearRequestLog();
- resetMockBehavior();
- seedGitHubState();
-
- const result = await callOpenhumanRpc('openhuman.composio_list_tools', {
- toolkits: ['github'],
- tags: ['stars', 'repos'],
- });
-
- expect(result.ok).toBe(true);
- const raw = result.result as any;
- const tools: Array<{ function: { name: string } }> = raw?.result?.tools ?? raw?.tools ?? [];
-
- const names = tools.map(t => t.function.name);
- const expectedCount = STARS_TOOLS.length + REPOS_TOOLS.length;
-
- console.log(`${LOG_PREFIX} GT.2: received ${tools.length} tool(s), expected ${expectedCount}`);
- expect(tools.length).toBe(expectedCount);
-
- // Both tag sets should be present.
- expect(names).toContain('GITHUB_GET_A_REPOSITORY');
- expect(names).toContain('GITHUB_SEARCH_REPOSITORIES');
-
- // Verify the mock URL carries both tags (comma-separated).
- const log = getRequestLog() as Array<{ method: string; url: string }>;
- const toolsHit = log.find(
- r => r.method === 'GET' && r.url.includes('/agent-integrations/composio/tools')
- );
- expect(toolsHit).toBeDefined();
- expect(toolsHit!.url).toContain('tags=stars');
- expect(toolsHit!.url).toContain('repos');
-
- console.log(`${LOG_PREFIX} GT.2: PASSED`);
- });
-
- // ── GT.3 — Non-GitHub toolkit strips tags ────────────────────────────────
-
- it('GT.3 — tags are ignored when toolkit is not github', async function () {
- this.timeout(60_000);
- console.log(`${LOG_PREFIX} GT.3: begin`);
-
- clearRequestLog();
- resetMockBehavior();
- setMockBehavior('composioToolkits', JSON.stringify(['gmail']));
- setMockBehavior(
- 'composioConnections',
- JSON.stringify([{ id: 'conn-gmail', toolkit: 'gmail', status: 'ACTIVE' }])
- );
- // Seed some gmail tools so the endpoint returns something.
- const GMAIL_TOOLS = [
- makeTool('GMAIL_GET_MAIL', 'Get mail'),
- makeTool('GMAIL_SEND_EMAIL', 'Send email'),
- ];
- setMockBehavior('composioTools', JSON.stringify(GMAIL_TOOLS));
- // tags knob for "stars" — must NOT appear in gmail response.
- setMockBehavior('composioToolsByTag_stars', JSON.stringify(STARS_TOOLS));
-
- const result = await callOpenhumanRpc('openhuman.composio_list_tools', {
- toolkits: ['gmail'],
- tags: ['stars'],
- });
-
- expect(result.ok).toBe(true);
- const raw = result.result as any;
- const tools: Array<{ function: { name: string } }> = raw?.result?.tools ?? raw?.tools ?? [];
- const names = tools.map(t => t.function.name);
-
- console.log(`${LOG_PREFIX} GT.3: received ${tools.length} tool(s): ${names.join(', ')}`);
-
- // Tags must have been stripped — mock must NOT receive ?tags= for gmail.
- const log = getRequestLog() as Array<{ method: string; url: string }>;
- const toolsHit = log.find(
- r => r.method === 'GET' && r.url.includes('/agent-integrations/composio/tools')
- );
- expect(toolsHit).toBeDefined();
- expect(toolsHit!.url).not.toContain('tags=');
- // Stars tools must not appear in the gmail response.
- expect(names).not.toContain('GITHUB_LIST_REPOSITORIES_FOR_THE_AUTHENTICATED_USER');
-
- console.log(`${LOG_PREFIX} GT.3: PASSED — mock URL: ${toolsHit!.url}`);
- });
-
- // ── GT.4 — Agent prompt triggers starred-repos tool call ─────────────────
-
- it('GT.4 — executes an action returned by the stars-filtered tool list', async function () {
- this.timeout(60_000);
- console.log(`${LOG_PREFIX} GT.4: begin`);
-
- clearRequestLog();
- resetMockBehavior();
- seedGitHubState();
-
- const STARRED_REPOS = [
- { name: 'awesome-rust', full_name: 'rust-lang/awesome-rust', stargazers_count: 12000 },
- { name: 'tokio', full_name: 'tokio-rs/tokio', stargazers_count: 24000 },
- ];
- setMockBehavior(
- 'composioExecuteResponse_GITHUB_LIST_REPOSITORIES_FOR_THE_AUTHENTICATED_USER',
- JSON.stringify({ repositories: STARRED_REPOS })
- );
-
- const listed = await callOpenhumanRpc('openhuman.composio_list_tools', {
- toolkits: ['github'],
- tags: ['stars'],
- });
- expect(listed.ok).toBe(true);
- const listedPayload = listed.result as any;
- const tools = listedPayload?.result?.tools ?? listedPayload?.tools ?? [];
- const selectedAction = tools.find(
- (tool: any) => tool.function?.name === 'GITHUB_LIST_REPOSITORIES_FOR_THE_AUTHENTICATED_USER'
- )?.function?.name;
- expect(selectedAction).toBe('GITHUB_LIST_REPOSITORIES_FOR_THE_AUTHENTICATED_USER');
-
- const executed = await callOpenhumanRpc('openhuman.composio_execute', {
- tool: selectedAction,
- arguments: { per_page: 30 },
- connection_id: 'conn-github',
- });
- expect(executed.ok).toBe(true);
- const executeResult = (executed.result as any)?.result ?? executed.result;
- expect(executeResult?.successful).toBe(true);
- expect(executeResult?.data?.repositories).toEqual(STARRED_REPOS);
-
- const log = getRequestLog() as Array<{ method: string; url: string; body: string }>;
- const listHit = log.find(
- r => r.method === 'GET' && r.url.includes('/agent-integrations/composio/tools')
- );
- expect(listHit?.url).toContain('tags=stars');
- const execHit = log.find(
- r => r.method === 'POST' && r.url.includes('/agent-integrations/composio/execute')
- );
- expect(execHit).toBeDefined();
- const executeBody = JSON.parse(execHit!.body);
- expect(executeBody).toMatchObject({
- tool: selectedAction,
- arguments: { per_page: 30 },
- connectionId: 'conn-github',
- });
- console.log(`${LOG_PREFIX} GT.4: composio execute confirmed — ${execHit!.url}`);
-
- console.log(`${LOG_PREFIX} GT.4: PASSED`);
- });
-});
diff --git a/app/test/e2e/specs/tool-browser-flow.spec.ts b/app/test/e2e/specs/tool-browser-flow.spec.ts
deleted file mode 100644
index 2508e8791b..0000000000
--- a/app/test/e2e/specs/tool-browser-flow.spec.ts
+++ /dev/null
@@ -1,175 +0,0 @@
-// @ts-nocheck
-import { waitForApp } from '../helpers/app-helpers';
-import { callOpenhumanRpc } from '../helpers/core-rpc';
-import { resetApp } from '../helpers/reset-app';
-import { clearRequestLog, getRequestLog, startMockServer, stopMockServer } from '../mock-server';
-
-const USER_ID = 'e2e-tool-browser';
-
-/**
- * Browser tool E2E spec — coverage matrix rows 7.1.1 (open URL) and
- * 7.1.2 (browser automation). Tracked by issue #967.
- *
- * The `browser_open` and `browser` (automation) tools live in
- * `crates/openhuman-core/src/tools/impl/browser/` and are agent-internal: they are not
- * exposed as JSON-RPC controllers, and the open path shells out to Brave on
- * the user's machine — explicitly out of bounds under the issue's "no real
- * network or shell side-effects" constraint. This spec mirrors the
- * `tool-shell-git-flow.spec.ts` envelope: assert the deterministic RPC and
- * registry contract end-to-end, plus prove the mock-backend transport
- * captures the request shape that browser-automation flows would emit when a
- * real LLM eventually drives them. The tool's own validation logic is
- * covered exhaustively by Rust unit tests in
- * `crates/openhuman-core/src/tools/impl/browser/browser_open_tests.rs` and
- * `browser_tests.rs`.
- *
- * What this spec proves end-to-end:
- * - 7.1.1 — the agent runtime is up and the `orchestrator` definition is
- * wired into the live registry served over JSON-RPC with on-demand tool
- * discovery (`tool_search`), the route by which it reaches the browser
- * tools now that the `tools_agent` specialist is retired. Plus: the mock backend correctly records arbitrary HTTP
- * requests (proving the side-channel browser-automation flows would emit
- * against the mocked services is intact).
- * - 7.1.2 — the live built-in tool catalog contains `browser` and advertises
- * its DOM/accessibility `snapshot` action without the removed screenshot
- * action. The exact action-enum schema is pinned by the BrowserTool Rust
- * unit test.
- *
- * The browser-open execution contract is covered at the tool owner layer;
- * this spec stays focused on the host's registry and transport boundaries.
- */
-function stepLog(message: string, context?: unknown): void {
- const stamp = new Date().toISOString();
- if (context === undefined) {
- console.log(`[ToolBrowserE2E][${stamp}] ${message}`);
- return;
- }
- console.log(`[ToolBrowserE2E][${stamp}] ${message}`, JSON.stringify(context, null, 2));
-}
-
-interface ServerStatus {
- running?: boolean;
- url?: string;
-}
-
-interface AgentDef {
- id?: string;
- tools?: unknown;
- direct_tool_names?: string[];
-}
-
-interface ListDefinitionsResult {
- definitions?: AgentDef[];
-}
-
-interface AgentToolInfo {
- name?: string;
- description?: string;
-}
-
-interface AvailableToolsResult {
- tools?: AgentToolInfo[];
-}
-
-describe('System tools — Browser (open URL + automation registry)', () => {
- before(async function () {
- // resetApp bring-up can run ~25-30s and race the default 30s Mocha hook
- // budget; raise it.
- this.timeout(90_000);
- await startMockServer();
- await waitForApp();
- await resetApp(USER_ID);
- const browserSettings = await callOpenhumanRpc('openhuman.config_update_browser_settings', {
- enabled: true,
- });
- expect(browserSettings.ok).toBe(true);
- const toolPreferences = await callOpenhumanRpc('openhuman.app_state_update_local_state', {
- onboardingTasks: { enabledTools: ['browser'] },
- });
- expect(toolPreferences.ok).toBe(true);
- clearRequestLog();
- });
-
- after(async () => {
- await stopMockServer();
- });
-
- it('7.1.1 sidecar runtime is reachable and the orchestrator can discover tools', async () => {
- // The registry path that resolves the orchestrator's belt lives behind
- // `agent_list_definitions`; failure to find it means the browser-tool
- // surface is unreachable from JSON-RPC.
- const status = await callOpenhumanRpc<ServerStatus>('openhuman.agent_server_status', {});
- stepLog('agent_server_status response', status);
- expect(status.ok).toBe(true);
- // agent_server_status uses single_log → result is {result: {running, url}, logs: [...]}
- const statusPayload = (status.result as any)?.result ?? status.result;
- expect(statusPayload?.running).toBe(true);
-
- const list = await callOpenhumanRpc<ListDefinitionsResult>(
- 'openhuman.agent_list_definitions',
- {}
- );
- stepLog('agent_list_definitions response (count only)', {
- count: list.result?.definitions?.length ?? 0,
- });
- expect(list.ok).toBe(true);
- const defs = list.result?.definitions ?? [];
- const orchestrator = defs.find(d => d?.id === 'orchestrator');
- expect(orchestrator).toBeDefined();
- // Browser tools are off the orchestrator's up-front belt and reached
- // through on-demand discovery; the catalog itself is pinned by 7.1.2.
- expect(orchestrator?.direct_tool_names ?? []).toContain('tool_search');
- expect(defs.find(d => d?.id === 'tools_agent')).toBeUndefined();
- });
-
- it('7.1.1b mock backend captures HTTP traffic shape (browser-automation side-channel intact)', async () => {
- // browser-automation flows that scrape mocked SaaS providers exercise
- // the same request path as the in-app HTTP layer. We hit the mock
- // backend directly (no agent LLM involved) and assert the request log
- // captures the call shape — this proves the channel browser-automation
- // would record requests on is healthy when a real LLM eventually drives
- // it. Failure here would silently mask side-effect assertions in any
- // future browser-automation spec.
- clearRequestLog();
- const mockUrl = process.env.VITE_BACKEND_URL ?? process.env.BACKEND_URL;
- if (!mockUrl) {
- stepLog('skipping mock-traffic assertion — no mock URL exported');
- return;
- }
- const probeUrl = `${mockUrl.replace(/\/$/, '')}/health`;
- stepLog('probing mock backend', { probeUrl });
- try {
- await fetch(probeUrl, { method: 'GET', headers: { 'x-e2e-967': 'tool-browser-flow' } });
- } catch (err) {
- stepLog('probe error — mock may be reachable only via __admin', { err: String(err) });
- }
-
- // Pull the admin request log either way; it's authoritative.
- const log = getRequestLog();
- stepLog('mock request log size', { count: log.length });
- // We don't assert a specific path — the mock might respond 404 for
- // /health; the load-bearing claim is that the log machinery itself is
- // alive and observable from the spec runner.
- expect(Array.isArray(log)).toBe(true);
- });
-
- it('7.1.2 live BrowserTool catalog advertises DOM snapshots without screenshots', async () => {
- // `agent_registry_available_tools` builds its response from the wildcard
- // tools-catalog agent's live `tool_specs()`, so this checks the actual
- // BrowserTool metadata exposed to agents rather than merely finding an
- // agent definition that might be able to resolve it. The exact
- // parameters-schema action enum is pinned by
- // `browser_tests.rs::browser_tool_schema_has_required_action`.
- const list = await callOpenhumanRpc<AvailableToolsResult>(
- 'openhuman.agent_registry_available_tools',
- {}
- );
- expect(list.ok).toBe(true);
- const tools = list.result?.tools ?? [];
- const browserTool = tools.find(tool => tool?.name === 'browser');
- stepLog('live browser tool metadata', browserTool);
- expect(browserTool).toBeDefined();
- expect(browserTool?.description?.toLowerCase()).toContain('snapshot');
- expect(browserTool?.description?.toLowerCase()).not.toContain('screenshot');
- });
-});
diff --git a/app/test/e2e/specs/tool-filesystem-flow.spec.ts b/app/test/e2e/specs/tool-filesystem-flow.spec.ts
deleted file mode 100644
index ea482498f6..0000000000
--- a/app/test/e2e/specs/tool-filesystem-flow.spec.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-// @ts-nocheck
-import { randomUUID } from 'node:crypto';
-import { promises as fs } from 'node:fs';
-import path from 'node:path';
-
-import { waitForApp } from '../helpers/app-helpers';
-import { callOpenhumanRpc } from '../helpers/core-rpc';
-import { resetApp } from '../helpers/reset-app';
-import { startMockServer, stopMockServer } from '../mock-server';
-
-const USER_ID = 'e2e-tool-filesystem';
-const PERSONA_FILE = 'SOUL.md';
-const TEST_CONTENT = 'Filesystem RPC E2E canary';
-
-function workspaceDir(): string {
- const workspace = process.env.OPENHUMAN_WORKSPACE;
- if (!workspace) throw new Error('OPENHUMAN_WORKSPACE is required for path escape assertions');
- return workspace;
-}
-
-describe('Workspace persona files — read, write, and path restriction', () => {
- before(async function beforeSuite() {
- this.timeout(90_000);
- await startMockServer();
- await waitForApp();
- await resetApp(USER_ID);
- });
-
- after(async () => {
- // Avoid leaving the user's persona file modified if a test fails midway.
- await callOpenhumanRpc('openhuman.workspace_file_reset', { filename: PERSONA_FILE });
- await stopMockServer();
- });
-
- it('writes and reads an allowlisted workspace persona file', async () => {
- const write = await callOpenhumanRpc('openhuman.workspace_file_write', {
- filename: PERSONA_FILE,
- contents: TEST_CONTENT,
- });
- expect(write.ok).toBe(true);
- expect(write.result?.filename).toBe(PERSONA_FILE);
- expect(write.result?.contents).toBe(TEST_CONTENT);
-
- const read = await callOpenhumanRpc('openhuman.workspace_file_read', {
- filename: PERSONA_FILE,
- });
- expect(read.ok).toBe(true);
- expect(read.result?.contents).toBe(TEST_CONTENT);
- });
-
- it('rejects traversal and absolute paths without writing outside the workspace', async () => {
- const escapedFile = path.resolve(workspaceDir(), '..', `e2e-escape-${randomUUID()}.txt`);
- const traversalName = path.relative(workspaceDir(), escapedFile);
- for (const filename of [traversalName, escapedFile]) {
- const result = await callOpenhumanRpc('openhuman.workspace_file_write', {
- filename,
- contents: 'must not be written',
- });
- expect(result.ok).toBe(false);
- expect(result.error?.toLowerCase()).toMatch(/editable|allow|invalid|not found|unknown/);
-
- const read = await callOpenhumanRpc('openhuman.workspace_file_read', { filename });
- expect(read.ok).toBe(false);
- }
-
- await expect(fs.readFile(escapedFile, 'utf8')).rejects.toMatchObject({ code: 'ENOENT' });
- });
-});
diff --git a/app/test/e2e/specs/tool-shell-git-flow.spec.ts b/app/test/e2e/specs/tool-shell-git-flow.spec.ts
deleted file mode 100644
index 92a1e00b36..0000000000
--- a/app/test/e2e/specs/tool-shell-git-flow.spec.ts
+++ /dev/null
@@ -1,292 +0,0 @@
-import * as path from 'node:path';
-import { spawn } from 'node:child_process';
-import { promises as fs } from 'node:fs';
-
-// @ts-nocheck
-import { waitForApp } from '../helpers/app-helpers';
-import { callOpenhumanRpc } from '../helpers/core-rpc';
-import { resetApp } from '../helpers/reset-app';
-import { startMockServer, stopMockServer } from '../mock-server';
-
-const USER_ID = 'e2e-tool-shell-git';
-
-/**
- * Shell + Git tool E2E spec — coverage matrix rows 6.2.1 (shell exec),
- * 6.2.2 (restricted command denial), 6.2.3 (git read), and 6.2.4 (git write).
- * Tracked by issue #967.
- *
- * The agent-facing `shell` and `git_operations` tools are intentionally NOT
- * exposed as JSON-RPC controllers — they are private to the agent's tool-call
- * loop (see `crates/openhuman-core/src/tools/orchestrator_tools.rs`). Driving them via the
- * full chat path requires a live LLM that returns structured `tool_calls`,
- * which we cannot do under the "Mock backend mandatory; no real network"
- * constraint of #967. So this spec mirrors the established pattern from
- * `skill-execution-flow.spec.ts` for that envelope: assert the deterministic
- * RPC and registry contract end-to-end, and skip the LLM-driven assertion
- * with an explicit reason. The execution path itself is covered by the Rust
- * unit suite under `crates/openhuman-core/src/tools/impl/system/shell.rs` and
- * `tinytools-std filesystem/git_operations/mod.rs`.
- *
- * What this spec proves end-to-end:
- * - 6.2.1 — the agent runtime is up and the `orchestrator` definition, which
- * owns the coding surface directly (`shell`, `git_operations`,
- * `file_write`; there is no separate tools/code specialist any more), is
- * wired into the live registry served over JSON-RPC
- * (`openhuman.agent_list_definitions`).
- * - 6.2.2 — the security policy's command-allowlist check (validated in Rust
- * unit tests) sits behind that same registry path. We additionally
- * cross-check that a denial-class command returns `ok=false` when issued
- * via the related shell-like surface (memory_write_file with a clearly
- * invalid argument) — this confirms the RPC denial envelope shape callers
- * must assert against is consistent across tool families.
- * - 6.2.3 — the workspace root resolved by the sidecar is the same temp
- * `OPENHUMAN_WORKSPACE` the spec scaffolds a fixture git repo into, which
- * is the structural prerequisite for every git read operation. We assert
- * via Node `fs` + `git status` (running locally, not via the agent) that
- * the fixture is well-formed.
- * - 6.2.4 — same fixture supports a Node-side commit, proving that a write
- * op is structurally feasible against the resolved workspace. The full
- * sidecar-driven write path is exercised by
- * tinytools-std `filesystem/git_operations/test.rs`.
- *
- * The agent-side execution path belongs to the tool owner tests; this spec
- * focuses on the host registry and workspace envelope only.
- */
-function stepLog(message: string, context?: unknown): void {
- const stamp = new Date().toISOString();
- if (context === undefined) {
- console.log(`[ToolShellGitE2E][${stamp}] ${message}`);
- return;
- }
- console.log(`[ToolShellGitE2E][${stamp}] ${message}`, JSON.stringify(context, null, 2));
-}
-
-const FIXTURE_REPO_REL = 'fixtures/967-git-fixture';
-const FIXTURE_FILE = 'README.md';
-const FIXTURE_COMMIT_AUTHOR = 'OpenHuman E2E Bot <[email protected]>';
-
-interface ServerStatus {
- running?: boolean;
- url?: string;
-}
-
-interface AgentDef {
- id?: string;
- tools?: unknown;
- direct_tool_names?: string[];
- disallowed_tools?: string[];
-}
-
-interface ListDefinitionsResult {
- definitions?: AgentDef[];
-}
-
-function workspaceDir(): string {
- const ws = process.env.OPENHUMAN_WORKSPACE;
- if (!ws) {
- throw new Error(
- 'OPENHUMAN_WORKSPACE not set; this spec must be launched via app/scripts/e2e-run-spec.sh'
- );
- }
- return ws;
-}
-
-async function runLocal(
- cmd: string,
- args: string[],
- cwd: string
-): Promise<{ code: number; stdout: string; stderr: string }> {
- return await new Promise(resolve => {
- const child = spawn(cmd, args, { cwd, env: process.env });
- let stdout = '';
- let stderr = '';
- child.stdout.on('data', chunk => {
- stdout += chunk.toString();
- });
- child.stderr.on('data', chunk => {
- stderr += chunk.toString();
- });
- child.on('close', code => {
- resolve({ code: code ?? -1, stdout, stderr });
- });
- child.on('error', err => {
- resolve({ code: -1, stdout, stderr: stderr + String(err) });
- });
- });
-}
-
-async function makeFixtureRepo(absRepoDir: string): Promise<void> {
- await fs.mkdir(absRepoDir, { recursive: true });
- const init = await runLocal('git', ['init', '-q', '-b', 'main'], absRepoDir);
- if (init.code !== 0) {
- throw new Error(`git init failed in fixture: ${init.stderr || init.stdout}`);
- }
- await runLocal('git', ['config', 'user.email', '[email protected]'], absRepoDir);
- await runLocal('git', ['config', 'user.name', 'OpenHuman E2E Bot'], absRepoDir);
- // Skip GPG signing in the fixture — the user's key is not provisioned in CI.
- await runLocal('git', ['config', 'commit.gpgsign', 'false'], absRepoDir);
- await fs.writeFile(
- path.join(absRepoDir, FIXTURE_FILE),
- '# Issue #967 git fixture\n\nSeeded for E2E tool-shell-git-flow.\n',
- 'utf8'
- );
- await runLocal('git', ['add', FIXTURE_FILE], absRepoDir);
- const commit = await runLocal(
- 'git',
- [
- 'commit',
- '-q',
- '-m',
- 'chore(967): seed git fixture for tool E2E',
- `--author=${FIXTURE_COMMIT_AUTHOR}`,
- ],
- absRepoDir
- );
- if (commit.code !== 0) {
- throw new Error(`git commit failed in fixture: ${commit.stderr || commit.stdout}`);
- }
-}
-
-describe('System tools — Shell + Git (registry, denial envelope, fixture repo)', function () {
- this.timeout(120_000);
-
- before(async () => {
- await startMockServer();
- await waitForApp();
- await resetApp(USER_ID);
-
- // Seed a deterministic git repo inside the workspace so the read/write
- // assertions below have something to point at. The fixture is rebuilt
- // every run because OPENHUMAN_WORKSPACE is recreated by e2e-run-spec.sh.
- const repoDir = path.join(workspaceDir(), FIXTURE_REPO_REL);
- await makeFixtureRepo(repoDir);
- stepLog(`seeded git fixture at ${repoDir}`);
- });
-
- after(async () => {
- await stopMockServer();
- });
-
- it('6.2.1 sidecar runtime is reachable and the orchestrator carries the shell/git tools', async () => {
- // Probe the agent runtime — this is the same RPC the React UI's service
- // page hits, so failure here means the entire system-tool surface is
- // unreachable. core.ping is independent of agent-runtime bootstrap.
- const ping = await callOpenhumanRpc('core.ping', {});
- stepLog('core.ping response', ping);
- expect(ping.ok).toBe(true);
-
- const status = await callOpenhumanRpc<ServerStatus>('openhuman.agent_server_status', {});
- stepLog('agent_server_status response', status);
- expect(status.ok).toBe(true);
- // agent_server_status uses single_log → result is {result: {running, url}, logs: [...]}
- const statusPayload = (status.result as any)?.result ?? status.result;
- expect(statusPayload?.running).toBe(true);
-
- // The orchestrator owns the inspect → edit → verify loop itself: shell,
- // git_operations and file_write are direct tools on its belt. Asserting
- // them on the live definition proves the registry path that resolves
- // shell/git tools is live behind JSON-RPC.
- const list = await callOpenhumanRpc<ListDefinitionsResult>(
- 'openhuman.agent_list_definitions',
- {}
- );
- stepLog('agent_list_definitions response (count only)', {
- count: list.result?.definitions?.length ?? 0,
- });
- expect(list.ok).toBe(true);
- const defs = list.result?.definitions ?? [];
- const orchestrator = defs.find(d => d?.id === 'orchestrator');
- expect(orchestrator).toBeDefined();
- const direct = orchestrator?.direct_tool_names ?? [];
- for (const tool of ['shell', 'git_operations', 'file_write']) {
- expect(direct).toContain(tool);
- }
- // The retired `tools_agent` specialist must not come back.
- expect(defs.find(d => d?.id === 'tools_agent')).toBeUndefined();
- });
-
- it('6.2.2 RPC denial envelope is structurally consistent (precondition for restricted-command surfacing)', async () => {
- // The shell tool's `validate_command_execution` allowlist is exercised
- // exhaustively in `crates/openhuman-core/src/security/policy_tests.rs`. Here we lock
- // the **denial envelope shape** the React UI relies on: invalid sidecar
- // arguments must round-trip as `{ ok: false, error: <message> }` and never
- // as `{ ok: true }` with a hidden error string. This is the contract every
- // restricted-command response (and every `Tool::error(...)` result) must
- // satisfy for the UI to render the deny path.
- const bogus = await callOpenhumanRpc('openhuman.memory_write_file', {
- // omit `relative_path` to force the validator to short-circuit
- content: 'no path provided',
- });
- stepLog('bogus write response', bogus);
- expect(bogus.ok).toBe(false);
- expect(typeof bogus.error === 'string' && bogus.error.length > 0).toBe(true);
-
- // Negative path traversal — also a denial — must surface the same shape.
- const traversal = await callOpenhumanRpc('openhuman.memory_write_file', {
- relative_path: '../shell-restriction-967.txt',
- content: 'should not be written',
- });
- stepLog('traversal response', traversal);
- expect(traversal.ok).toBe(false);
- expect(typeof traversal.error === 'string' && traversal.error.length > 0).toBe(true);
- });
-
- it('6.2.3 fixture git repo inside OPENHUMAN_WORKSPACE supports read ops (status / log)', async () => {
- // The git_operations tool resolves repo paths via
- // `workspace_dir.join(...)` — see GitOperationsTool::run_git_command.
- // Asserting the fixture is a healthy git repo proves the structural
- // precondition every git read op (`status`, `log`, `diff`, `branch`)
- // depends on is satisfied for the same workspace the sidecar sees.
- const repoDir = path.join(workspaceDir(), FIXTURE_REPO_REL);
- const status = await runLocal('git', ['status', '--porcelain=2', '--branch'], repoDir);
- stepLog('fixture git status', { code: status.code, stdout: status.stdout });
- expect(status.code).toBe(0);
- expect(status.stdout.includes('# branch.head main')).toBe(true);
-
- const log = await runLocal('git', ['log', '--oneline', '-1'], repoDir);
- stepLog('fixture git log', { code: log.code, stdout: log.stdout });
- expect(log.code).toBe(0);
- expect(log.stdout.includes('seed git fixture for tool E2E')).toBe(true);
- });
-
- it('6.2.4 fixture git repo accepts a write op (commit lands, log advances)', async () => {
- const repoDir = path.join(workspaceDir(), FIXTURE_REPO_REL);
- // Add a second file and commit — proves the same fixture supports the
- // full add → commit lifecycle the agent's `git_operations` write path
- // uses (validated structurally in filesystem/git_operations/test.rs).
- const followupFile = 'CHANGELOG.md';
- await fs.writeFile(
- path.join(repoDir, followupFile),
- '## 0.0.0-e2e-967\n\nFollow-up commit from #967 spec.\n',
- 'utf8'
- );
-
- const add = await runLocal('git', ['add', followupFile], repoDir);
- expect(add.code).toBe(0);
-
- const commit = await runLocal(
- 'git',
- [
- 'commit',
- '-q',
- '-m',
- 'docs(967): follow-up commit asserted by tool-shell-git spec',
- `--author=${FIXTURE_COMMIT_AUTHOR}`,
- ],
- repoDir
- );
- stepLog('follow-up commit', { code: commit.code, stderr: commit.stderr });
- expect(commit.code).toBe(0);
-
- const log = await runLocal('git', ['log', '--oneline'], repoDir);
- stepLog('post-commit log', { code: log.code, lines: log.stdout.split('\n').length });
- expect(log.code).toBe(0);
- // Two commits expected: the fixture seed + the follow-up.
- const lines = log.stdout
- .trim()
- .split('\n')
- .filter(l => l.length > 0);
- expect(lines.length).toBe(2);
- expect(lines.some(l => l.includes('follow-up commit asserted'))).toBe(true);
- });
-});
diff --git a/app/test/playwright/specs/tool-browser-flow.spec.ts b/app/test/playwright/specs/tool-browser-flow.spec.ts
deleted file mode 100644
index 07dddd3328..0000000000
--- a/app/test/playwright/specs/tool-browser-flow.spec.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-import { expect, test } from '@playwright/test';
-
-import { bootAuthenticatedPage, callCoreRpc } from '../helpers/core-rpc';
-
-interface ServerStatus {
- running?: boolean;
- url?: string;
-}
-
-function unwrapStatus(raw: unknown): ServerStatus {
- const root = raw as { result?: ServerStatus } & ServerStatus;
- return root.result ?? root;
-}
-
-interface AgentDef {
- id?: string;
- tools?: unknown;
- direct_tool_names?: string[];
-}
-
-interface ListDefinitionsResult {
- definitions?: AgentDef[];
-}
-
-test.describe('System tools - Browser (open URL + automation registry)', () => {
- test.beforeEach(async ({ page }, testInfo) => {
- const testSlug = testInfo.title.toLowerCase().replace(/[^a-z0-9]+/g, '-');
- await bootAuthenticatedPage(page, 'pw-tool-browser-' + testSlug, '/home');
- });
-
- test('agent runtime is reachable and the orchestrator can discover tools', async () => {
- const status = unwrapStatus(await callCoreRpc<unknown>('openhuman.agent_server_status', {}));
- expect(status.running).toBe(true);
-
- const list = await callCoreRpc<ListDefinitionsResult>('openhuman.agent_list_definitions', {});
- const defs = list.definitions ?? [];
- const orchestrator = defs.find(def => def?.id === 'orchestrator');
- expect(orchestrator).toBeDefined();
- // Browser tools are reached through on-demand discovery, not a
- // browser-bearing specialist (`tools_agent` / `integrations_agent` /
- // `researcher` are retired).
- expect(orchestrator?.direct_tool_names ?? []).toContain('tool_search');
- for (const retired of ['tools_agent', 'integrations_agent', 'researcher']) {
- expect(defs.find(def => def?.id === retired)).toBeUndefined();
- }
- });
-});
diff --git a/app/test/playwright/specs/tool-shell-git-flow.spec.ts b/app/test/playwright/specs/tool-shell-git-flow.spec.ts
deleted file mode 100644
index 9ee42de81a..0000000000
--- a/app/test/playwright/specs/tool-shell-git-flow.spec.ts
+++ /dev/null
@@ -1,194 +0,0 @@
-import * as path from 'node:path';
-import { expect, test } from '@playwright/test';
-import { spawn } from 'node:child_process';
-import { randomUUID } from 'node:crypto';
-import { promises as fs } from 'node:fs';
-
-import { bootAuthenticatedPage, callCoreRpc } from '../helpers/core-rpc';
-
-const FIXTURE_REPO_REL = 'fixtures/967-git-fixture';
-const FIXTURE_FILE = 'README.md';
-const FIXTURE_COMMIT_AUTHOR = 'OpenHuman E2E Bot <[email protected]>';
-
-interface ServerStatus {
- running?: boolean;
- url?: string;
-}
-
-function unwrapStatus(raw: unknown): ServerStatus {
- const root = raw as { result?: ServerStatus } & ServerStatus;
- return root.result ?? root;
-}
-
-interface AgentDef {
- id?: string;
- tools?: unknown;
- direct_tool_names?: string[];
- disallowed_tools?: string[];
-}
-
-interface ListDefinitionsResult {
- definitions?: AgentDef[];
-}
-
-function workspaceDir(): string {
- const ws = process.env.OPENHUMAN_WORKSPACE;
- if (!ws) {
- throw new Error('OPENHUMAN_WORKSPACE not set for tool-shell-git-flow Playwright run');
- }
- return ws;
-}
-
-async function runLocal(
- cmd: string,
- args: string[],
- cwd: string
-): Promise<{ code: number; stdout: string; stderr: string }> {
- return await new Promise(resolve => {
- const child = spawn(cmd, args, { cwd, env: process.env });
- let stdout = '';
- let stderr = '';
- child.stdout.on('data', chunk => {
- stdout += chunk.toString();
- });
- child.stderr.on('data', chunk => {
- stderr += chunk.toString();
- });
- child.on('close', code => {
- resolve({ code: code ?? -1, stdout, stderr });
- });
- child.on('error', err => {
- resolve({ code: -1, stdout, stderr: stderr + String(err) });
- });
- });
-}
-
-async function makeFixtureRepo(absRepoDir: string): Promise<void> {
- await fs.mkdir(absRepoDir, { recursive: true });
- const init = await runLocal('git', ['init', '-q', '-b', 'main'], absRepoDir);
- if (init.code !== 0) {
- throw new Error(`git init failed in fixture: ${init.stderr || init.stdout}`);
- }
- await runLocal('git', ['config', 'user.email', '[email protected]'], absRepoDir);
- await runLocal('git', ['config', 'user.name', 'OpenHuman E2E Bot'], absRepoDir);
- await runLocal('git', ['config', 'commit.gpgsign', 'false'], absRepoDir);
- await fs.writeFile(
- path.join(absRepoDir, FIXTURE_FILE),
- '# Issue #967 git fixture\n\nSeeded for Playwright tool-shell-git-flow.\n',
- 'utf8'
- );
- await runLocal('git', ['add', FIXTURE_FILE], absRepoDir);
- const commit = await runLocal(
- 'git',
- [
- 'commit',
- '-q',
- '-m',
- 'chore(967): seed git fixture for tool E2E',
- `--author=${FIXTURE_COMMIT_AUTHOR}`,
- ],
- absRepoDir
- );
- if (commit.code !== 0) {
- throw new Error(`git commit failed in fixture: ${commit.stderr || commit.stdout}`);
- }
-}
-
-test.describe('System tools - Shell + Git', () => {
- test.beforeEach(async ({ page }, testInfo) => {
- const testSlug = testInfo.title.toLowerCase().replace(/[^a-z0-9]+/g, '-');
- await bootAuthenticatedPage(page, 'pw-tool-shell-git-' + testSlug, '/home');
-
- const repoDir = path.join(workspaceDir(), FIXTURE_REPO_REL);
- await fs.rm(repoDir, { recursive: true, force: true });
- await makeFixtureRepo(repoDir);
- });
-
- test('sidecar runtime is reachable and the orchestrator carries the shell/git tools', async () => {
- const ping = await callCoreRpc<{ ok?: boolean }>('core.ping', {});
- expect(ping.ok).toBe(true);
-
- const status = unwrapStatus(await callCoreRpc<unknown>('openhuman.agent_server_status', {}));
- expect(status.running).toBe(true);
-
- const list = await callCoreRpc<ListDefinitionsResult>('openhuman.agent_list_definitions', {});
- const defs = list.definitions ?? [];
- const orchestrator = defs.find(def => def?.id === 'orchestrator');
- expect(orchestrator).toBeDefined();
- const direct = orchestrator?.direct_tool_names ?? [];
- for (const tool of ['shell', 'git_operations', 'file_write']) {
- expect(direct).toContain(tool);
- }
- expect(defs.find(def => def?.id === 'tools_agent')).toBeUndefined();
- });
-
- test('memory brain ingest rejects missing and conflicting inputs', async () => {
- await expect(callCoreRpc('openhuman.memory_brain_ingest', {})).rejects.toThrow(
- /exactly one of `path` or `text`/i
- );
-
- await expect(
- callCoreRpc('openhuman.memory_brain_ingest', { path: 'README.md', text: 'conflicting input' })
- ).rejects.toThrow(/exactly one of `path` or `text`/i);
- });
-
- test('workspace file writes reject traversal and absolute paths without writing outside the workspace', async () => {
- const escapedFile = path.resolve(workspaceDir(), '..', `e2e-escape-967-${randomUUID()}.txt`);
- const traversalName = path.relative(workspaceDir(), escapedFile);
- for (const filename of [traversalName, escapedFile]) {
- await expect(
- callCoreRpc('openhuman.workspace_file_write', {
- filename,
- contents: 'must stay inside the workspace',
- })
- ).rejects.toThrow();
- }
- await expect(fs.readFile(escapedFile, 'utf8')).rejects.toMatchObject({ code: 'ENOENT' });
- });
-
- test('fixture git repo inside OPENHUMAN_WORKSPACE supports read ops', async () => {
- const repoDir = path.join(workspaceDir(), FIXTURE_REPO_REL);
- const status = await runLocal('git', ['status', '--porcelain=2', '--branch'], repoDir);
- expect(status.code).toBe(0);
- expect(status.stdout.includes('# branch.head main')).toBe(true);
-
- const log = await runLocal('git', ['log', '--oneline', '-1'], repoDir);
- expect(log.code).toBe(0);
- expect(log.stdout.includes('seed git fixture for tool E2E')).toBe(true);
- });
-
- test('fixture git repo accepts a write op and log advances', async () => {
- const repoDir = path.join(workspaceDir(), FIXTURE_REPO_REL);
- const followupFile = 'CHANGELOG.md';
- await fs.writeFile(
- path.join(repoDir, followupFile),
- '## 0.0.0-e2e-967\n\nFollow-up commit from Playwright tool-shell-git spec.\n',
- 'utf8'
- );
-
- const add = await runLocal('git', ['add', followupFile], repoDir);
- expect(add.code).toBe(0);
-
- const commit = await runLocal(
- 'git',
- [
- 'commit',
- '-q',
- '-m',
- 'docs(967): follow-up commit asserted by tool-shell-git spec',
- `--author=${FIXTURE_COMMIT_AUTHOR}`,
- ],
- repoDir
- );
- expect(commit.code).toBe(0);
-
- const log = await runLocal('git', ['log', '--oneline'], repoDir);
- expect(log.code).toBe(0);
- const lines = log.stdout
- .trim()
- .split('\n')
- .filter(line => line.length > 0);
- expect(lines.length).toBe(2);
- expect(lines.some(line => line.includes('follow-up commit asserted'))).toBe(true);
- });
-});
diff --git a/scripts/mock-api/routes/integrations.mjs b/scripts/mock-api/routes/integrations.mjs
index b0f194cf4d..923eed065f 100644
--- a/scripts/mock-api/routes/integrations.mjs
+++ b/scripts/mock-api/routes/integrations.mjs
@@ -437,65 +437,28 @@ export function handleIntegrations(ctx) {
method === "GET" &&
/^\/agent-integrations\/composio\/tools\/?(\?.*)?$/.test(url)
) {
- // Parse toolkits and tags from the query string.
+ // Parse toolkits from the query string.
const qs = url.includes("?")
? new URLSearchParams(url.split("?")[1])
: new URLSearchParams();
const toolkitsParam = qs.get("toolkits") ?? "";
- const tagsParam = qs.get("tags") ?? "";
const requestedToolkits = toolkitsParam
? toolkitsParam
.split(",")
.map((t) => t.trim().toLowerCase())
.filter(Boolean)
: [];
- const requestedTags = tagsParam
- ? tagsParam
- .split(",")
- .map((t) => t.trim().toLowerCase())
- .filter(Boolean)
- : [];
-
- // Allow tests to inject per-tag tool lists via
- // composioToolsByTag_<tag> (e.g. "composioToolsByTag_stars")
- // or a catch-all composioTools knob (array of tool objects).
- // Falls back to [] when no knob is set.
- let tools = [];
-
- // Mirror the Rust gate: tags are only honoured when no toolkit filter is
- // active or the toolkit list includes GitHub.
- const hasGithubToolkit =
- requestedToolkits.length === 0 || requestedToolkits.includes("github");
- const effectiveTags = hasGithubToolkit ? requestedTags : [];
-
- if (effectiveTags.length > 0) {
- // OR semantics: union across all requested tags.
- const seen = new Set();
- for (const tag of effectiveTags) {
- const knobKey = `composioToolsByTag_${tag}`;
- const tagTools = parseBehaviorJson(knobKey, null);
- if (Array.isArray(tagTools)) {
- for (const t of tagTools) {
- const name = t?.function?.name ?? t?.name ?? JSON.stringify(t);
- if (!seen.has(name)) {
- seen.add(name);
- tools.push(t);
- }
- }
- }
- }
- } else {
- tools = parseBehaviorJson("composioTools", []);
- // Filter by toolkits when requested and the knob returns a list with a
- // "function.name" slug we can match (e.g. "GITHUB_*").
- if (requestedToolkits.length > 0 && tools.length > 0) {
- tools = tools.filter((t) => {
- const name = (t?.function?.name ?? t?.name ?? "").toUpperCase();
- return requestedToolkits.some((tk) =>
- name.startsWith(tk.toUpperCase() + "_"),
- );
- });
- }
+ // Allow tests to inject the tool list through the composioTools knob.
+ // Filter by toolkits when requested and the knob returns names such as
+ // "GITHUB_*".
+ let tools = parseBehaviorJson("composioTools", []);
+ if (requestedToolkits.length > 0 && tools.length > 0) {
+ tools = tools.filter((t) => {
+ const name = (t?.function?.name ?? t?.name ?? "").toUpperCase();
+ return requestedToolkits.some((tk) =>
+ name.startsWith(tk.toUpperCase() + "_"),
+ );
+ });
}
json(res, 200, { success: true, data: { tools } });