fix(coding-agent): avoid Windows context file walk hang

closes #6369
This commit is contained in:
Mario Zechner
2026-07-09 11:30:59 +02:00
parent c6251a866b
commit 2170363af4
2 changed files with 3 additions and 5 deletions
@@ -1,5 +1,5 @@
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
import { join, resolve, sep } from "node:path";
import { dirname, join, resolve, sep } from "node:path";
import chalk from "chalk";
import { CONFIG_DIR_NAME } from "../config.ts";
import { loadThemeFromPath, type Theme } from "../modes/interactive/theme/theme.ts";
@@ -101,7 +101,6 @@ export function loadProjectContextFiles(options: {
const ancestorContextFiles: Array<{ path: string; content: string }> = [];
let currentDir = resolvedCwd;
const root = resolve("/");
while (true) {
const contextFile = loadContextFileFromDir(currentDir);
@@ -110,9 +109,7 @@ export function loadProjectContextFiles(options: {
seenPaths.add(contextFile.path);
}
if (currentDir === root) break;
const parentDir = resolve(currentDir, "..");
const parentDir = dirname(currentDir);
if (parentDir === currentDir) break;
currentDir = parentDir;
}