From 6242f299eea516144127a243164a94ac35c185f9 Mon Sep 17 00:00:00 2001 From: Waishnav Date: Wed, 8 Jul 2026 02:28:47 +0530 Subject: [PATCH 1/2] Fix AGENTS realpath containment on CI --- src/workspaces.test.ts | 6 ++++++ src/workspaces.ts | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/workspaces.test.ts b/src/workspaces.test.ts index 7b8136f..9f7bc32 100644 --- a/src/workspaces.test.ts +++ b/src/workspaces.test.ts @@ -179,6 +179,12 @@ try { mode: "worktree", }); assert.equal(aliasWorkspace.workspace.sourceRoot, join(aliasRoot, "git-project")); + + const aliasCheckout = await new WorkspaceRegistry(aliasConfig).openWorkspace(aliasRoot); + assert.deepEqual( + aliasCheckout.agentsFiles.map((file) => file.content), + ["global instructions\n", "root instructions\n"], + ); } } finally { await rm(root, { recursive: true, force: true }); diff --git a/src/workspaces.ts b/src/workspaces.ts index 466b1b4..844ddab 100644 --- a/src/workspaces.ts +++ b/src/workspaces.ts @@ -248,12 +248,19 @@ export class WorkspaceRegistry { private async loadInitialAgentsFiles(root: string): Promise { const agentDir = resolve(this.config.agentDir); + const resolvedRoot = (await tryRealpath(root)) ?? root; + const resolvedAgentDir = (await tryRealpath(agentDir)) ?? agentDir; const loadedFiles: LoadedAgentsFile[] = []; for (const file of loadProjectContextFiles({ cwd: root, agentDir })) { const path = resolve(file.path); if (!isInitialAgentsFilePath(path, root, agentDir)) continue; - const content = await readResolvedContextFile(path, file.content, root, agentDir); + const content = await readResolvedContextFile( + path, + file.content, + resolvedRoot, + resolvedAgentDir, + ); if (content === undefined) continue; loadedFiles.push({ From 2fd5dc3fb36c3a13f89d801f361f6d83f554fe31 Mon Sep 17 00:00:00 2001 From: Waishnav Date: Wed, 8 Jul 2026 02:32:23 +0530 Subject: [PATCH 2/2] Fix Windows AGENTS fixture discovery --- src/workspaces.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/workspaces.test.ts b/src/workspaces.test.ts index 9f7bc32..9561123 100644 --- a/src/workspaces.test.ts +++ b/src/workspaces.test.ts @@ -16,11 +16,11 @@ const outsideRoot = await mkdtemp(join(tmpdir(), "devspace-workspace-outside-tes try { const agentDir = join(root, ".pi", "agent"); await mkdir(agentDir, { recursive: true }); - await mkdir(join(agentDir, "skills"), { recursive: true }); - await writeFile(join(agentDir, "skills", "AGENTS.md"), "global instructions\n"); if (platform() === "win32") { await writeFile(join(agentDir, "AGENTS.md"), "global instructions\n"); } else { + await mkdir(join(agentDir, "skills"), { recursive: true }); + await writeFile(join(agentDir, "skills", "AGENTS.md"), "global instructions\n"); await symlink("skills/AGENTS.md", join(agentDir, "AGENTS.md")); } await writeFile(join(root, "AGENTS.md"), "root instructions\n");