From e13f3c201247ad0ae1937424fa3923798c61d268 Mon Sep 17 00:00:00 2001 From: Lily Shen <115414357+lilyshen0722@users.noreply.github.com> Date: Mon, 26 Oct 2026 23:48:53 -0700 Subject: [PATCH 1/2] fix(cli): keep the temp-cleanup guard's probe root short (TASK-436) The guard runs each CLI file under a probe TMPDIR. On macOS that root sits deep under /var/folders, and the provider-proxy tests bind Unix sockets inside it, so the socket path exceeds the ~104-byte limit and three opencode tests fail with listen EINVAL. Create the probe root under /tmp, which is also the default TMPDIR on the Linux CI runner. Measured: npm run test:temp-cleanup -- __tests__/adapters.opencode.test.mjs passes 70/70 twice, with 0 dirs / 0 bytes surviving each pass. Co-Authored-By: Claude Haiku 5.5 Co-authored-by: dart Agent-Model: claude/claude-haiku-5-5/default --- cli/scripts/verify-temp-cleanup.mjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cli/scripts/verify-temp-cleanup.mjs b/cli/scripts/verify-temp-cleanup.mjs index f6121d5d18..9d0e344ea6 100644 --- a/cli/scripts/verify-temp-cleanup.mjs +++ b/cli/scripts/verify-temp-cleanup.mjs @@ -7,7 +7,6 @@ */ import { spawn } from 'node:child_process'; import { lstat, mkdtemp, readdir, rm } from 'node:fs/promises'; -import { tmpdir } from 'node:os'; import { join } from 'node:path'; const target = process.argv[2] || '__tests__/adapters.claude.environment.test.mjs'; @@ -53,7 +52,10 @@ const run = (probeRoot) => new Promise((resolve, reject) => { }); }); -const probeRoot = await mkdtemp(join(tmpdir(), 'commonly-cli-temp-guard-')); +// Short root on purpose: the provider-proxy tests bind Unix sockets under the +// probe TMPDIR, and macOS caps a socket path at ~104 bytes, so a deep +// $TMPDIR makes them fail with EINVAL. CI runs on Linux where /tmp is the default. +const probeRoot = await mkdtemp(join('/tmp', 'commonly-cli-temp-guard-')); try { for (let pass = 1; pass <= 2; pass += 1) { const before = await snapshot(probeRoot); From c3a828682706908472615f3a9c26d1bec8c7685b Mon Sep 17 00:00:00 2001 From: Lily Shen <115414357+lilyshen0722@users.noreply.github.com> Date: Mon, 26 Oct 2026 23:50:30 -0700 Subject: [PATCH 2/2] fix(cli): use /tmp for the temp guard probe only on macOS (TASK-436) Hardcoding /tmp breaks native Windows, which has no /tmp. The short root is only needed where the socket path limit bites (macOS), so use it there and fall back to os.tmpdir() elsewhere. Co-Authored-By: Claude Haiku 5.5 Co-authored-by: dart Agent-Model: claude/claude-haiku-5-5/default --- cli/scripts/verify-temp-cleanup.mjs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cli/scripts/verify-temp-cleanup.mjs b/cli/scripts/verify-temp-cleanup.mjs index 9d0e344ea6..1a0ccbf297 100644 --- a/cli/scripts/verify-temp-cleanup.mjs +++ b/cli/scripts/verify-temp-cleanup.mjs @@ -7,6 +7,7 @@ */ import { spawn } from 'node:child_process'; import { lstat, mkdtemp, readdir, rm } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; import { join } from 'node:path'; const target = process.argv[2] || '__tests__/adapters.claude.environment.test.mjs'; @@ -52,10 +53,11 @@ const run = (probeRoot) => new Promise((resolve, reject) => { }); }); -// Short root on purpose: the provider-proxy tests bind Unix sockets under the -// probe TMPDIR, and macOS caps a socket path at ~104 bytes, so a deep -// $TMPDIR makes them fail with EINVAL. CI runs on Linux where /tmp is the default. -const probeRoot = await mkdtemp(join('/tmp', 'commonly-cli-temp-guard-')); +// Short root on macOS on purpose: the provider-proxy tests bind Unix sockets +// under the probe TMPDIR, and macOS caps a socket path at ~104 bytes, so the +// deep $TMPDIR there makes them fail with EINVAL. Elsewhere the default is fine. +const probeBase = process.platform === 'darwin' ? '/tmp' : tmpdir(); +const probeRoot = await mkdtemp(join(probeBase, 'commonly-cli-temp-guard-')); try { for (let pass = 1; pass <= 2; pass += 1) { const before = await snapshot(probeRoot);