From afc2bd370e0b7d495dc45ff7751d2fcaae9a7c34 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 10 Jun 2026 20:09:18 +0200 Subject: [PATCH] fix(coding-agent): use physical temp paths in session-id-readonly test On macOS tmpdir() is a symlink (/var -> /private/var) while the spawned CLI's process.cwd() is physical, so session cwd filtering never matched the fixtures and the fork-target rejection test failed locally. --- .../test/session-id-readonly.test.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/coding-agent/test/session-id-readonly.test.ts b/packages/coding-agent/test/session-id-readonly.test.ts index b6e97ce83..47537b604 100644 --- a/packages/coding-agent/test/session-id-readonly.test.ts +++ b/packages/coding-agent/test/session-id-readonly.test.ts @@ -1,5 +1,14 @@ import { spawn } from "node:child_process"; -import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { + existsSync, + mkdirSync, + mkdtempSync, + readdirSync, + readFileSync, + realpathSync, + rmSync, + writeFileSync, +} from "node:fs"; import { tmpdir } from "node:os"; import { join, resolve } from "node:path"; import { afterEach, describe, expect, it } from "vitest"; @@ -15,7 +24,10 @@ afterEach(() => { }); function createTempDir(): string { - const dir = mkdtempSync(join(tmpdir(), "pi-session-id-readonly-")); + // realpath: on macOS tmpdir() is a symlink (/var -> /private/var), but the + // spawned CLI sees the physical path via process.cwd(). Session cwd + // filtering compares paths textually, so the fixture must use physical paths. + const dir = realpathSync(mkdtempSync(join(tmpdir(), "pi-session-id-readonly-"))); tempDirs.push(dir); return dir; }