From 39a1c13635b4a770711e0fa9661448a39079c15e Mon Sep 17 00:00:00 2001 From: Gustavo Madeira Santana Date: Thu, 26 Feb 2026 00:39:18 -0500 Subject: [PATCH] chore(ci): fix cross-platform symlink path assertions in agents file tests --- src/gateway/server-methods/agents-mutate.test.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gateway/server-methods/agents-mutate.test.ts b/src/gateway/server-methods/agents-mutate.test.ts index a4fddea633a..26503db553c 100644 --- a/src/gateway/server-methods/agents-mutate.test.ts +++ b/src/gateway/server-methods/agents-mutate.test.ts @@ -1,3 +1,4 @@ +import path from "node:path"; import { describe, expect, it, vi, beforeEach } from "vitest"; /* ------------------------------------------------------------------ */ @@ -515,7 +516,7 @@ describe("agents.files.get/set symlink safety", () => { it("rejects agents.files.get when allowlisted file symlink escapes workspace", async () => { const workspace = "/workspace/test-agent"; - const candidate = `${workspace}/AGENTS.md`; + const candidate = path.resolve(workspace, "AGENTS.md"); mocks.fsRealpath.mockImplementation(async (p: string) => { if (p === workspace) { return workspace; @@ -548,7 +549,7 @@ describe("agents.files.get/set symlink safety", () => { it("rejects agents.files.set when allowlisted file symlink escapes workspace", async () => { const workspace = "/workspace/test-agent"; - const candidate = `${workspace}/AGENTS.md`; + const candidate = path.resolve(workspace, "AGENTS.md"); mocks.fsRealpath.mockImplementation(async (p: string) => { if (p === workspace) { return workspace; @@ -583,8 +584,8 @@ describe("agents.files.get/set symlink safety", () => { it("allows in-workspace symlink targets for get/set", async () => { const workspace = "/workspace/test-agent"; - const candidate = `${workspace}/AGENTS.md`; - const target = `${workspace}/policies/AGENTS.md`; + const candidate = path.resolve(workspace, "AGENTS.md"); + const target = path.resolve(workspace, "policies", "AGENTS.md"); const targetStat = makeFileStat({ size: 7, mtimeMs: 1700, dev: 9, ino: 42 }); mocks.fsRealpath.mockImplementation(async (p: string) => {