From b5604e91becbca6e57c0559d2a87a199808984f1 Mon Sep 17 00:00:00 2001 From: garrytan Date: Thu, 8 Oct 2026 06:45:08 +0000 Subject: [PATCH] test(browse): run watchdog test servers under a private HOME The headed-mode case starts a real server with BROWSE_HEADED=1, and its headed launch writes ~/.gstack/.auth.json for the extension. With the caller's HOME, a slow kill let that write reach the real home and failed the free runner's home-containment check (free-suite shard 5 on #3075). Give each spawned server a private HOME and GSTACK_HOME, keeping Playwright's browser cache path. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- browse/test/watchdog.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/browse/test/watchdog.test.ts b/browse/test/watchdog.test.ts index eabf465a9..05b90c3f7 100644 --- a/browse/test/watchdog.test.ts +++ b/browse/test/watchdog.test.ts @@ -51,9 +51,19 @@ afterEach(async () => { function spawnServer(env: Record): Subprocess { const stateFile = path.join(tmpDir, 'browse-state.json'); + const home = path.join(tmpDir, 'home'); + fs.mkdirSync(home, { recursive: true }); return spawn(['bun', 'run', SERVER_SCRIPT], { env: { ...process.env, + // The headed server writes ~/.gstack/.auth.json for its extension. + HOME: home, + USERPROFILE: home, + GSTACK_HOME: path.join(home, '.gstack'), + PLAYWRIGHT_BROWSERS_PATH: process.env.PLAYWRIGHT_BROWSERS_PATH || path.join( + process.env.XDG_CACHE_HOME || path.join(os.homedir(), process.platform === 'darwin' ? 'Library/Caches' : '.cache'), + 'ms-playwright', + ), BROWSE_STATE_FILE: stateFile, BROWSE_PORT: '0', // Use the existing available-port allocator; fixed ports can collide across shards. ...env,