From 9e5048cf9cd2b087297034466e14dc1813b5e80f Mon Sep 17 00:00:00 2001 From: garrytan Date: Sat, 3 Oct 2026 20:59:04 +0000 Subject: [PATCH] fix(design): keep iterate sessions in the OS temp dir and normalize tripwire paths on Windows --- design/src/session.ts | 5 +++-- design/test/models.test.ts | 2 +- test/design-printed-paths.test.ts | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/design/src/session.ts b/design/src/session.ts index 01986618e..57fc2bcd4 100644 --- a/design/src/session.ts +++ b/design/src/session.ts @@ -1,9 +1,10 @@ /** * Session state management for multi-turn design iteration. - * Session files are JSON in /tmp, keyed by PID + timestamp. + * Session files are JSON in the OS temp directory, keyed by PID + timestamp. */ import fs from "fs"; +import os from "os"; import path from "path"; export interface DesignSession { @@ -27,7 +28,7 @@ export function createSessionId(): string { * Get the file path for a session. */ export function sessionPath(sessionId: string): string { - return path.join("/tmp", `design-session-${sessionId}.json`); + return path.join(os.tmpdir(), `design-session-${sessionId}.json`); } /** diff --git a/design/test/models.test.ts b/design/test/models.test.ts index 404eb9435..57565c230 100644 --- a/design/test/models.test.ts +++ b/design/test/models.test.ts @@ -167,7 +167,7 @@ describe("image-generation call sites (Responses API)", () => { test("iterate: threaded and fresh fallback", async () => { const id = `models-test-${process.pid}-${Date.now()}`; - const session = path.join("/tmp", `design-session-${id}.json`); + const session = path.join(os.tmpdir(), `design-session-${id}.json`); const write = () => fs.writeFileSync(session, JSON.stringify({ id, lastResponseId: "resp_prev", originalBrief: "b", feedbackHistory: [], outputPaths: [], createdAt: "", updatedAt: "" })); try { write(); diff --git a/test/design-printed-paths.test.ts b/test/design-printed-paths.test.ts index aa16fb8fa..4546d2188 100644 --- a/test/design-printed-paths.test.ts +++ b/test/design-printed-paths.test.ts @@ -25,14 +25,14 @@ function flowFiles(): string[] { const out: string[] = []; for (const entry of fs.readdirSync(ROOT, { withFileTypes: true })) { if (!entry.isDirectory() || entry.name.startsWith('.') || entry.name === 'node_modules') continue; - const skill = path.join(entry.name, 'SKILL.md'); + const skill = `${entry.name}/SKILL.md`; if (fs.existsSync(path.join(ROOT, skill))) out.push(skill); - const sections = path.join(entry.name, 'sections'); + const sections = `${entry.name}/sections`; if (fs.existsSync(path.join(ROOT, sections))) { - for (const f of fs.readdirSync(path.join(ROOT, sections))) if (f.endsWith('.md')) out.push(path.join(sections, f)); + for (const f of fs.readdirSync(path.join(ROOT, sections))) if (f.endsWith('.md')) out.push(`${sections}/${f}`); } } - for (const f of fs.readdirSync(path.join(ROOT, 'scripts/resolvers'))) if (f.endsWith('.ts')) out.push(path.join('scripts/resolvers', f)); + for (const f of fs.readdirSync(path.join(ROOT, 'scripts/resolvers'))) if (f.endsWith('.ts')) out.push(`scripts/resolvers/${f}`); return out; }