Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

test(ts/e2e): reproduced #2336

jkomyno3a00ddde55c3
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index a6a81a671..8abfe8bc8 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -313,14 +313,17 @@ importers:
specifier: workspace:*
version: link:../../../../packages/core
- ts/e2e-tests/runtimes/node/typescript-mjs-import-nodenext:
+ ts/e2e-tests/runtimes/node/openai-zod4-compat:
devDependencies:
- '@composio/cli':
- specifier: workspace:*
- version: link:../../../../packages/cli
- typescript:
- specifier: ^5.9.2
- version: 5.9.3
+ '@effect/platform':
+ specifier: ^0.85.2
+ version: 0.85.2([email protected])
+ '@effect/platform-node':
+ specifier: ^0.85.2
+ effect:
+ specifier: ^3.16.16
+ version: 3.16.16
ts/examples/anthropic:
dependencies:
@@ -1784,6 +1787,15 @@ packages:
'@effect/sql': ^0.38.2
effect: ^3.16.8
+ '@effect/[email protected]':
+ resolution: {integrity: sha512-aJ7jVm9V+SEeNumRmHb+TxD0C38uv/1LLfBHB2Qg+xb5UjnZhak8SzwolAgSKkMNDFpAAdF2AlxZ1tO/HfhCiw==}
+ peerDependencies:
+ '@effect/cluster': ^0.38.16
+ '@effect/platform': ^0.84.11
+ '@effect/rpc': ^0.61.15
+ '@effect/sql': ^0.37.12
+ effect: ^3.16.7
+
'@effect/[email protected]':
resolution: {integrity: sha512-EfnRTSHKs33OTfKN9pF+G2AyxMXm/+4rKrGM8yEw56Ij6QV5dq2g28yi0eOH7BytvilnreVmcbAec7M77EArgg==}
peerDependencies:
@@ -1802,6 +1814,15 @@ packages:
'@effect/sql': ^0.38.2
effect: ^3.16.8
+ '@effect/[email protected]':
+ resolution: {integrity: sha512-d1vAuQxLXLEiN/kGAlmXy357xXgInLZIT8BfCLcOdmc6yCWFs4n5shxWEhgMAwsgPNiMI4pFDE/2c3g2DZzR3w==}
+ peerDependencies:
+ '@effect/cluster': ^0.38.16
+ '@effect/platform': ^0.84.11
+ '@effect/rpc': ^0.61.15
+ '@effect/sql': ^0.37.12
+ effect: ^3.16.7
+
'@effect/[email protected]':
resolution: {integrity: sha512-zIRixbQeO6QniR0k2mwR7DmR2HO1w6+qQlzQ5nb8lyPyPgd1gV9wo/9yBeB6zRC+CGnxiUiYsRMamclVISuxLw==}
peerDependencies:
@@ -8505,6 +8526,20 @@ snapshots:
- bufferutil
- utf-8-validate
+ dependencies:
+ '@effect/platform': 0.85.2([email protected])
+ '@effect/rpc': 0.62.4(@effect/[email protected]([email protected]))([email protected])
+ '@parcel/watcher': 2.5.1
+ effect: 3.16.16
+ multipasta: 0.2.5
+ ws: 8.18.2
+ transitivePeerDependencies:
+ - bufferutil
+ - utf-8-validate
+
dependencies:
@@ -8533,6 +8568,21 @@ snapshots:
- bufferutil
- utf-8-validate
+ dependencies:
+ '@effect/platform': 0.85.2([email protected])
+ '@effect/rpc': 0.62.4(@effect/[email protected]([email protected]))([email protected])
+ effect: 3.16.16
+ mime: 3.0.0
+ undici: 7.14.0
+ ws: 8.18.2
+ transitivePeerDependencies:
+ - bufferutil
+ - utf-8-validate
+
dependencies:
effect: 3.16.16
diff --git a/ts/e2e-tests/runtimes/node/openai-zod4-compat/README.md b/ts/e2e-tests/runtimes/node/openai-zod4-compat/README.md
new file mode 100644
index 000000000..5447681bd
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-zod4-compat/README.md
@@ -0,0 +1,24 @@
+# OpenAI v6 + Zod v4 Compatibility Test
+
+Verifies that `@composio/core` works correctly with `openai@6` and `zod@4`.
+
+## Background
+
+Issue [#2336](https://github.com/ComposioHQ/composio/issues/2336) reported that `@composio/core` depended on `openai@5`, which only supported `zod@3`. This caused peer dependency conflicts for users with `zod@4`.
+
+The fix upgraded `openai` to v6, which supports `zod@4`.
+
+## What It Tests
+
+The test (`test-peer-deps.mjs`) simulates a fresh user installation:
+
+- Creates an isolated temp directory from `fixtures/`
+- Runs `npm install` with `@composio/core`, `openai@6`, and `zod@4`
+- Checks stderr for peer dependency conflict patterns
+- Runs `fixtures/index.mjs` to verify packages work together
+
+## Running
+
+```bash
+pnpm test:e2e:node --filter @test-e2e/node-openai-zod4-compat
+```
diff --git a/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/index.mjs b/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/index.mjs
new file mode 100644
index 000000000..ab8c51e2b
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/index.mjs
@@ -0,0 +1,39 @@
+/**
+ * Simple test script to verify @composio/core works with openai@5 and zod@4
+ */
+import { z } from 'zod';
+import OpenAI from 'openai';
+import { Composio, OpenAIProvider } from '@composio/core';
+
+// Parse and validate environment variables
+const EnvSchema = z.object({
+ COMPOSIO_API_KEY: z.string().min(1, 'COMPOSIO_API_KEY is required'),
+});
+
+const env = EnvSchema.parse(process.env);
+
+// Verify zod@4 works
+const schema = z.object({ name: z.string() });
+console.log('✅ zod@4 works');
+
+// Verify openai@5 works
+const openai = new OpenAI({ apiKey: 'test-key' });
+console.log('✅ openai@5 works');
+
+// Verify @composio/core works with API key from env
+const provider = new OpenAIProvider();
+const composio = new Composio({
+ provider,
+ apiKey: env.COMPOSIO_API_KEY,
+});
+console.log('✅ @composio/core works');
+
+// Verify wrapTool works
+const _tool = provider.wrapTool({
+ slug: 'TEST',
+ description: 'Test tool',
+ inputParameters: { type: 'object', properties: {} }
+});
+console.log('✅ wrapTool works');
+
+console.log('\n🎉 All packages work together!');
diff --git a/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/package.json b/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/package.json
new file mode 100644
index 000000000..2741f6ef5
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-zod4-compat/fixtures/package.json
@@ -0,0 +1,10 @@
+{
+ "name": "peer-deps-test",
+ "private": true,
+ "type": "module",
+ "dependencies": {
+ "@composio/core": "/app/ts/packages/core",
+ "openai": "^5.16.0",
+ "zod": "^4.3.5"
+ }
+}
diff --git a/ts/e2e-tests/runtimes/node/openai-zod4-compat/package.json b/ts/e2e-tests/runtimes/node/openai-zod4-compat/package.json
new file mode 100644
index 000000000..8caed1bd2
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-zod4-compat/package.json
@@ -0,0 +1,15 @@
+{
+ "name": "@test-e2e/node-openai-zod4-compat",
+ "version": "0.0.0",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "test:e2e": "bash run-docker-test.sh",
+ "test:e2e:node": "bash run-docker-test.sh"
+ },
+ "devDependencies": {
+ "@effect/platform": "^0.85.2",
+ "@effect/platform-node": "^0.85.2",
+ "effect": "^3.16.16"
+ }
+}
diff --git a/ts/e2e-tests/runtimes/node/openai-zod4-compat/run-docker-test.sh b/ts/e2e-tests/runtimes/node/openai-zod4-compat/run-docker-test.sh
new file mode 100755
index 000000000..ea342c76d
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-zod4-compat/run-docker-test.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+# OpenAI v6 + Zod v4 compatibility e2e test runner
+# Verifies fix for https://github.com/ComposioHQ/composio/issues/2336
+
+set -e
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+UTILS_DIR="$SCRIPT_DIR/../../../_utils"
+
+"$UTILS_DIR/run-docker-test.sh" \
+ --name "composio-openai-zod4-compat-${NODE_VERSION}" \
+ --dir "ts/e2e-tests/runtimes/node/openai-zod4-compat" \
+ --cmd "node test.mjs"
diff --git a/ts/e2e-tests/runtimes/node/openai-zod4-compat/test.mjs b/ts/e2e-tests/runtimes/node/openai-zod4-compat/test.mjs
new file mode 100644
index 000000000..cdb6384c2
--- /dev/null
+++ b/ts/e2e-tests/runtimes/node/openai-zod4-compat/test.mjs
@@ -0,0 +1,130 @@
+/**
+ * Peer dependency conflict detection test for @composio/core
+ *
+ * Verifies that installing @composio/core alongside openai@6 and zod@4
+ * does NOT produce peer dependency conflict warnings.
+ *
+ * Docker provides isolation - no temp directory needed.
+ *
+ * @see https://github.com/ComposioHQ/composio/issues/2336
+ */
+
+import * as Command from '@effect/platform/Command';
+import * as NodeCommandExecutor from '@effect/platform-node/NodeCommandExecutor';
+import * as NodeFileSystem from '@effect/platform-node/NodeFileSystem';
+import * as Effect from 'effect/Effect';
+import * as Layer from 'effect/Layer';
+import * as Stream from 'effect/Stream';
+import * as Chunk from 'effect/Chunk';
+import { pipe } from 'effect/Function';
+import { fileURLToPath } from 'node:url';
+import { dirname, join } from 'node:path';
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
+const FIXTURES_DIR = join(__dirname, 'fixtures');
+
+const TestLive = NodeCommandExecutor.layer.pipe(
+ Layer.provideMerge(NodeFileSystem.layer)
+);
+
+/**
+ * Collects a stream of Uint8Array chunks into a string.
+ */
+const collectStreamToString = (stream) =>
+ pipe(
+ stream,
+ Stream.runCollect,
+ Effect.map((chunks) => {
+ const decoder = new TextDecoder('utf-8');
+ return Chunk.toReadonlyArray(chunks)
+ .map((chunk) => decoder.decode(chunk))
+ .join('');
+ })
+ );
+
+/**
+ * Runs a command and captures both stdout and stderr.
+ * Returns the combined output and exit code regardless of success/failure.
+ */
+const runCommandWithOutput = (cmd, args, cwd, env = {}) =>
+ Effect.gen(function* () {
+ const command = pipe(
+ Command.make(cmd, ...args),
+ Command.workingDirectory(cwd),
+ Command.env({ ...process.env, ...env })
+ );
+
+ const process_ = yield* Command.start(command);
+
+ // Collect stdout and stderr in parallel (MUST use concurrency to avoid deadlock)
+ const [stdout, stderr] = yield* Effect.all(
+ [
+ collectStreamToString(process_.stdout),
+ collectStreamToString(process_.stderr),
+ ],
+ { concurrency: 'unbounded' }
+ );
+
+ const exitCode = yield* process_.exitCode;
+
+ return { stdout, stderr, exitCode };
+ }).pipe(Effect.scoped);
+
+/**
+ * Logs command output in a formatted way.
+ */
+const logOutput = (label, stdout, stderr) =>
+ Effect.sync(() => {
+ if (stderr.trim()) {
+ console.log(`\n--- ${label} stderr ---`);
+ console.log(stderr);
+ console.log(`--- end stderr ---\n`);
+ }
+
+ console.log(`--- ${label} stdout ---`);
+ console.log(stdout);
+ console.log(`--- end stdout ---`);
+ });
+
+const main = Effect.gen(function* () {
+ console.log('🧪 Testing @composio/core + openai + zod@4 compatibility...\n');
+ console.log(`Fixtures directory: ${FIXTURES_DIR}\n`);
+
+ // Install dependencies in fixtures directory (ignore workspace to download from npm)
+ console.log('Installing fixtures dependencies...');
+ const installResult = yield* runCommandWithOutput('npm', ['install', '--legacy-peer-deps=false'], FIXTURES_DIR, {
+ npm_config_yes: 'true',
+ });
+
+ // Always log output (captured by DEBUG.log via Docker)
+ yield* logOutput('pnpm install', installResult.stdout, installResult.stderr);
+
+ if (installResult.exitCode !== 0) {
+ console.error('❌ pnpm install failed');
+ return yield* Effect.fail(new Error('pnpm install failed'));
+ }
+ console.log('✅ Dependencies installed\n');
+
+ // Run the compatibility check script
+ console.log('Running compatibility check...');
+ const nodeResult = yield* runCommandWithOutput('node', ['index.mjs'], FIXTURES_DIR);
+
+ // Always log output (captured by DEBUG.log via Docker)
+ yield* logOutput('node', nodeResult.stdout, nodeResult.stderr);
+
+ if (nodeResult.exitCode !== 0) {
+ console.error('❌ Compatibility check failed');
+ return yield* Effect.fail(new Error('Compatibility check failed'));
+ }
+
+ console.log('\n========================================');
+ console.log('🎉 All tests passed!');
+ console.log('========================================');
+
+ return { stdout: nodeResult.stdout, stderr: nodeResult.stderr };
+});
+
+Effect.runPromise(Effect.provide(main, TestLive)).catch((error) => {
+ console.error('Test failed:', error.message);
+ process.exit(1);
+});