From d87e8fb7ef536370ec3b82f72b66e4485a9c85ae Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Fri, 20 Mar 2026 08:20:40 -0700 Subject: [PATCH] fix: isolate E2E tests from production telemetry E2E test runner now sets GSTACK_STATE_DIR to a temp directory so skill preamble telemetry goes to /tmp/ instead of ~/.gstack/. Prevents test runs from polluting production Supabase with fake crash events (was causing 252 spurious "timeout" crashes from a single test session). Co-Authored-By: Claude Opus 4.6 (1M context) --- test/helpers/session-runner.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/helpers/session-runner.ts b/test/helpers/session-runner.ts index 6654df5f..99c17669 100644 --- a/test/helpers/session-runner.ts +++ b/test/helpers/session-runner.ts @@ -155,10 +155,16 @@ export async function runSkillTest(options: { const promptFile = path.join(workingDirectory, '.prompt-tmp'); fs.writeFileSync(promptFile, prompt); + // Isolate telemetry: E2E tests use a temp state dir so they don't pollute + // production telemetry with test events (e.g. fake timeout crashes). + const testStateDir = path.join(os.tmpdir(), `gstack-e2e-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`); + fs.mkdirSync(testStateDir, { recursive: true }); + const proc = Bun.spawn(['sh', '-c', `cat "${promptFile}" | claude ${args.map(a => `"${a}"`).join(' ')}`], { cwd: workingDirectory, stdout: 'pipe', stderr: 'pipe', + env: { ...process.env, GSTACK_STATE_DIR: testStateDir }, }); // Race against timeout