From 35759e409a3ece98da84da6c58f400b0f7876148 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 8 Jan 2026 03:19:43 +0000 Subject: [PATCH] fix(ci): harden windows tests --- src/agents/bash-tools.test.ts | 4 ++-- src/agents/pi-embedded-runner.ts | 16 ---------------- src/agents/pi-tools-agent-config.test.ts | 8 +++++++- src/commands/doctor.test.ts | 2 +- 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/agents/bash-tools.test.ts b/src/agents/bash-tools.test.ts index abc10f815..ae407d9c6 100644 --- a/src/agents/bash-tools.test.ts +++ b/src/agents/bash-tools.test.ts @@ -17,7 +17,7 @@ const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); async function waitForCompletion(sessionId: string) { let status = "running"; - const deadline = Date.now() + 2000; + const deadline = Date.now() + (process.platform === "win32" ? 8000 : 2000); while (Date.now() < deadline && status === "running") { const poll = await processTool.execute("call-wait", { action: "poll", @@ -47,7 +47,7 @@ describe("bash tool backgrounding", () => { let status = "running"; let output = ""; - const deadline = Date.now() + 2000; + const deadline = Date.now() + (process.platform === "win32" ? 8000 : 2000); while (Date.now() < deadline && status === "running") { const poll = await processTool.execute("call2", { diff --git a/src/agents/pi-embedded-runner.ts b/src/agents/pi-embedded-runner.ts index 0f7ace97a..449e55b88 100644 --- a/src/agents/pi-embedded-runner.ts +++ b/src/agents/pi-embedded-runner.ts @@ -901,13 +901,6 @@ export async function compactEmbeddedPiSession(params: { sandboxEnabled: !!sandbox?.enabled, }); - const extraParams = resolveExtraParams({ - cfg: params.config, - provider, - modelId, - thinkLevel: params.thinkLevel, - }); - let session: Awaited>["session"]; ({ session } = await createAgentSession({ cwd: resolvedWorkspace, @@ -924,7 +917,6 @@ export async function compactEmbeddedPiSession(params: { skills: [], contextFiles: [], additionalExtensionPaths, - extraParams, })); try { @@ -1220,13 +1212,6 @@ export async function runEmbeddedPiAgent(params: { sandboxEnabled: !!sandbox?.enabled, }); - const extraParams = resolveExtraParams({ - cfg: params.config, - provider, - modelId, - thinkLevel, - }); - let session: Awaited< ReturnType >["session"]; @@ -1247,7 +1232,6 @@ export async function runEmbeddedPiAgent(params: { skills: [], contextFiles: [], additionalExtensionPaths, - extraParams, })); try { diff --git a/src/agents/pi-tools-agent-config.test.ts b/src/agents/pi-tools-agent-config.test.ts index a89b27c69..e79173573 100644 --- a/src/agents/pi-tools-agent-config.test.ts +++ b/src/agents/pi-tools-agent-config.test.ts @@ -3,6 +3,12 @@ import type { ClawdbotConfig } from "../config/config.js"; import { createClawdbotCodingTools } from "./pi-tools.js"; import type { SandboxDockerConfig } from "./sandbox.js"; +const nodePath = process.execPath.includes(" ") + ? `"${process.execPath}"` + : process.execPath; +const nodeEval = (script: string) => + `${nodePath} -e "${script.replaceAll('"', '\\"')}"`; + describe("Agent-specific tool filtering", () => { it("should apply global tool policy when no agent-specific policy exists", () => { const cfg: ClawdbotConfig = { @@ -233,7 +239,7 @@ describe("Agent-specific tool filtering", () => { expect(bash).toBeDefined(); const result = await bash?.execute("call1", { - command: "node -e \"setTimeout(() => { console.log('done') }, 50)\"", + command: nodeEval("setTimeout(function(){ console.log('done') }, 50)"), yieldMs: 10, }); diff --git a/src/commands/doctor.test.ts b/src/commands/doctor.test.ts index bd9f98291..523199fff 100644 --- a/src/commands/doctor.test.ts +++ b/src/commands/doctor.test.ts @@ -532,7 +532,7 @@ describe("doctor", () => { ([message, title]) => title === "Legacy workspace" && typeof message === "string" && - message.includes(path.join("/Users/steipete", "clawdis")), + message.includes(path.resolve("/Users/steipete/clawdis")), ), ).toBe(true);