Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
fix(e2e): handle Docker build race condition and bump openai-zod4-compat timeout
Concurrent e2e test suites building the same Docker image can race, causing "already exists" errors. Now ensureNodeImage/ensureDenoImage gracefully handle this by rechecking image availability on failure. Also bump openai-zod4-compat beforeAll timeout from 60s to 300s since npm install inside Docker can exceed the FIXTURE timeout in CI.
jkomyno committed
Feb 18, 2026 at 01:35 UTC
955892a2ff20c64899b9d30735bbd2a5dbaac3bb
2 files changed
+24
-4
ts/e2e-tests/_utils/src/image-lifecycle.ts
+22
-2
@@ -202,8 +202,18 @@ export async function ensureNodeImage(
202
203
const built = await exec('docker', buildArgs, { cwd: repoRoot });
204
if (built.exitCode !== 0) {
205
+ // Handle race condition: concurrent builds may fail because another build
206
+ // already tagged the image. If the image now exists, treat it as success.
207
+ const output = built.stderr || built.stdout;
208
+ if (output.includes('already exists')) {
209
+ const recheck = await exec('docker', ['image', 'inspect', imageTag], { cwd: repoRoot });
210
+ if (recheck.exitCode === 0) {
211
+ return imageTag;
212
+ }
213
+ }
214
+
215
const err = new Error(`Failed to build Docker image ${imageTag}`);
206
- (err as Error & { cause: Error }).cause = new Error(built.stderr || built.stdout);
216
+ (err as Error & { cause: Error }).cause = new Error(output);
217
throw err;
218
}
219
@@ -366,8 +376,18 @@ export async function ensureDenoImage(
376
377
const built = await exec('docker', buildArgs, { cwd: repoRoot });
378
if (built.exitCode !== 0) {
379
+ // Handle race condition: concurrent builds may fail because another build
380
+ // already tagged the image. If the image now exists, treat it as success.
381
+ const output = built.stderr || built.stdout;
382
+ if (output.includes('already exists')) {
383
+ const recheck = await exec('docker', ['image', 'inspect', imageTag], { cwd: repoRoot });
384
+ if (recheck.exitCode === 0) {
385
+ return imageTag;
386
+ }
387
+ }
388
+
389
const err = new Error(`Failed to build Docker image ${imageTag}`);
370
- (err as Error & { cause: Error }).cause = new Error(built.stderr || built.stdout);
390
+ (err as Error & { cause: Error }).cause = new Error(output);
391
throw err;
392
}
393
ts/e2e-tests/runtimes/node/openai-zod4-compat/e2e.test.ts
+2
-2
@@ -6,7 +6,6 @@
6
*/
7
8
import { e2e, type E2ETestResultWithSetup } from '@e2e-tests/utils';
9
-import { TIMEOUTS } from '@e2e-tests/utils/const';
9
import { describe, it, expect, beforeAll } from 'bun:test';
10
11
declare module 'bun' {
@@ -24,12 +23,13 @@ e2e(import.meta.url, {
23
defineTests: ({ runFixture }) => {
24
let result: E2ETestResultWithSetup;
25
26
+ // npm install inside Docker needs more time than the default TIMEOUTS.FIXTURE (60s)
27
beforeAll(async () => {
28
result = await runFixture({
29
filename: 'index.mjs',
30
setup: 'npm install --legacy-peer-deps',
31
});
32
- }, TIMEOUTS.FIXTURE);
32
+ }, 300_000);
33
34
describe('setup', () => {
35
it('npm install completes successfully', () => {