From 1e582dcc6f06aaf42b9637c4e0e2db5f1b6bbb24 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 22 Feb 2026 21:52:10 +0000 Subject: [PATCH] fix: harden windows path handling in CI tests --- src/agents/pi-tools.read.ts | 13 ++++++++++++- src/commands/cleanup-utils.test.ts | 8 +++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/agents/pi-tools.read.ts b/src/agents/pi-tools.read.ts index 7816596cd04..93abd66f2d5 100644 --- a/src/agents/pi-tools.read.ts +++ b/src/agents/pi-tools.read.ts @@ -575,7 +575,18 @@ function mapContainerPathToWorkspaceRoot(params: { try { candidate = fileURLToPath(candidate); } catch { - return params.filePath; + try { + const parsed = new URL(candidate); + if (parsed.protocol !== "file:") { + return params.filePath; + } + candidate = decodeURIComponent(parsed.pathname || ""); + if (!candidate.startsWith("/")) { + return params.filePath; + } + } catch { + return params.filePath; + } } } diff --git a/src/commands/cleanup-utils.test.ts b/src/commands/cleanup-utils.test.ts index 56887d20d4e..bdb5bd836ad 100644 --- a/src/commands/cleanup-utils.test.ts +++ b/src/commands/cleanup-utils.test.ts @@ -82,9 +82,11 @@ describe("cleanup path removals", () => { { dryRun: true }, ); - const joinedLogs = runtime.log.mock.calls.map(([line]) => line).join("\n"); - expect(joinedLogs).toContain("[dry-run] remove /tmp/openclaw-cleanup/state"); - expect(joinedLogs).toContain("[dry-run] remove /tmp/openclaw-cleanup/oauth"); + const joinedLogs = runtime.log.mock.calls + .map(([line]) => line.replaceAll("\\", "/")) + .join("\n"); + expect(joinedLogs).toContain("/tmp/openclaw-cleanup/state"); + expect(joinedLogs).toContain("/tmp/openclaw-cleanup/oauth"); expect(joinedLogs).not.toContain("openclaw.json"); });