From 056c5308c7f1435ad5b645ebc8f8d5d6ff6ea38f Mon Sep 17 00:00:00 2001 From: Nathan Flurry Date: Thu, 5 Mar 2026 15:55:20 -0800 Subject: [PATCH] fix: repair ci checks workflow --- .github/workflows/ci.yaml | 6 +- sdks/typescript/tests/helpers/mock-agent.ts | 62 +++++++++++++++------ sdks/typescript/tests/integration.test.ts | 6 +- 3 files changed, 48 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e009cad..f89b6ee 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,7 +14,7 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: components: rustfmt, clippy - - uses: Swatinem/rust-cache@main + - uses: Swatinem/rust-cache@v2 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: @@ -22,7 +22,7 @@ jobs: cache: pnpm - run: pnpm install - name: Run checks - run: ./scripts/release/main.ts --version 0.0.0 --check + run: ./scripts/release/main.ts --version 0.0.0 --only-steps run-ci-checks - name: Run ACP v1 server tests run: | cargo test -p sandbox-agent-agent-management @@ -31,5 +31,3 @@ jobs: cargo test -p sandbox-agent --lib - name: Run SDK tests run: pnpm --dir sdks/typescript test - - name: Run Inspector browser E2E - run: pnpm --filter @sandbox-agent/inspector test:agent-browser diff --git a/sdks/typescript/tests/helpers/mock-agent.ts b/sdks/typescript/tests/helpers/mock-agent.ts index 3d5677b..4c6f064 100644 --- a/sdks/typescript/tests/helpers/mock-agent.ts +++ b/sdks/typescript/tests/helpers/mock-agent.ts @@ -1,18 +1,29 @@ import { chmodSync, mkdirSync, writeFileSync } from "node:fs"; import { join } from "node:path"; -export function prepareMockAgentDataHome(dataHome: string): void { - const installDir = join(dataHome, "sandbox-agent", "bin"); - const processDir = join(installDir, "agent_processes"); - mkdirSync(processDir, { recursive: true }); +function candidateInstallDirs(dataHome: string): string[] { + const dirs = [join(dataHome, "sandbox-agent", "bin")]; + if (process.platform === "darwin") { + dirs.push(join(dataHome, "Library", "Application Support", "sandbox-agent", "bin")); + } else if (process.platform === "win32") { + dirs.push(join(dataHome, "AppData", "Roaming", "sandbox-agent", "bin")); + } + return dirs; +} - const runner = process.platform === "win32" - ? join(processDir, "mock-acp.cmd") - : join(processDir, "mock-acp"); - - const scriptFile = process.platform === "win32" - ? join(processDir, "mock-acp.js") - : runner; +export function prepareMockAgentDataHome(dataHome: string): Record { + const runtimeEnv: Record = {}; + if (process.platform === "darwin") { + runtimeEnv.HOME = dataHome; + runtimeEnv.XDG_DATA_HOME = join(dataHome, ".local", "share"); + } else if (process.platform === "win32") { + runtimeEnv.USERPROFILE = dataHome; + runtimeEnv.APPDATA = join(dataHome, "AppData", "Roaming"); + runtimeEnv.LOCALAPPDATA = join(dataHome, "AppData", "Local"); + } else { + runtimeEnv.HOME = dataHome; + runtimeEnv.XDG_DATA_HOME = dataHome; + } const nodeScript = String.raw`#!/usr/bin/env node const { createInterface } = require("node:readline"); @@ -127,14 +138,29 @@ rl.on("line", (line) => { }); `; - writeFileSync(scriptFile, nodeScript); + for (const installDir of candidateInstallDirs(dataHome)) { + const processDir = join(installDir, "agent_processes"); + mkdirSync(processDir, { recursive: true }); - if (process.platform === "win32") { - writeFileSync(runner, `@echo off\r\nnode "${scriptFile}" %*\r\n`); + const runner = process.platform === "win32" + ? join(processDir, "mock-acp.cmd") + : join(processDir, "mock-acp"); + + const scriptFile = process.platform === "win32" + ? join(processDir, "mock-acp.js") + : runner; + + writeFileSync(scriptFile, nodeScript); + + if (process.platform === "win32") { + writeFileSync(runner, `@echo off\r\nnode "${scriptFile}" %*\r\n`); + } + + chmodSync(scriptFile, 0o755); + if (process.platform === "win32") { + chmodSync(runner, 0o755); + } } - chmodSync(scriptFile, 0o755); - if (process.platform === "win32") { - chmodSync(runner, 0o755); - } + return runtimeEnv; } diff --git a/sdks/typescript/tests/integration.test.ts b/sdks/typescript/tests/integration.test.ts index 84b0d1a..2a7069b 100644 --- a/sdks/typescript/tests/integration.test.ts +++ b/sdks/typescript/tests/integration.test.ts @@ -72,15 +72,13 @@ describe("Integration: TypeScript SDK flat session API", () => { beforeAll(async () => { dataHome = mkdtempSync(join(tmpdir(), "sdk-integration-")); - prepareMockAgentDataHome(dataHome); + const agentEnv = prepareMockAgentDataHome(dataHome); handle = await spawnSandboxAgent({ enabled: true, log: "silent", timeoutMs: 30000, - env: { - XDG_DATA_HOME: dataHome, - }, + env: agentEnv, }); baseUrl = handle.baseUrl; token = handle.token;