From ff3e9df5f5b32368c20b0ef553a6834b3dee9350 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Sat, 6 Jun 2026 22:32:35 +0200 Subject: [PATCH] fix(coding-agent): make trust input traversal portable --- packages/coding-agent/src/core/trust-manager.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/coding-agent/src/core/trust-manager.ts b/packages/coding-agent/src/core/trust-manager.ts index 59abcc926..e8e593234 100644 --- a/packages/coding-agent/src/core/trust-manager.ts +++ b/packages/coding-agent/src/core/trust-manager.ts @@ -1,5 +1,5 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; -import { dirname, join, resolve } from "node:path"; +import { dirname, join } from "node:path"; import lockfile from "proper-lockfile"; import { CONFIG_DIR_NAME } from "../config.ts"; import { canonicalizePath, resolvePath } from "../utils/paths.ts"; @@ -95,12 +95,11 @@ function withTrustFileLock(path: string, fn: () => T): T { } export function hasProjectTrustInputs(cwd: string): boolean { - let currentDir = resolvePath(cwd); + let currentDir = canonicalizePath(resolvePath(cwd)); if (existsSync(join(currentDir, CONFIG_DIR_NAME))) { return true; } - const root = resolve("/"); while (true) { for (const filename of CONTEXT_FILE_NAMES) { if (existsSync(join(currentDir, filename))) { @@ -111,11 +110,7 @@ export function hasProjectTrustInputs(cwd: string): boolean { return true; } - if (currentDir === root) { - return false; - } - - const parentDir = resolve(currentDir, ".."); + const parentDir = dirname(currentDir); if (parentDir === currentDir) { return false; }