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
View File
@@ -21,6 +21,7 @@
- Fixed new session resets to clear cached label timestamps ([#6354](https://github.com/earendil-works/pi/issues/6354)). - Fixed new session resets to clear cached label timestamps ([#6354](https://github.com/earendil-works/pi/issues/6354)).
- Fixed auto-retry for Bun fetch socket-drop errors reported as `socket connection was closed`, so transient provider disconnects do not end headless runs without retrying ([#6431](https://github.com/earendil-works/pi/issues/6431)). - Fixed auto-retry for Bun fetch socket-drop errors reported as `socket connection was closed`, so transient provider disconnects do not end headless runs without retrying ([#6431](https://github.com/earendil-works/pi/issues/6431)).
- Fixed `models.json` `modelOverrides` to apply to extension-registered provider models ([#6367](https://github.com/earendil-works/pi/issues/6367)). - Fixed `models.json` `modelOverrides` to apply to extension-registered provider models ([#6367](https://github.com/earendil-works/pi/issues/6367)).
- Fixed project context file discovery to use stable parent traversal on Windows so startup no longer hangs while loading AGENTS.md or CLAUDE.md ([#6369](https://github.com/earendil-works/pi/issues/6369)).
### Removed ### Removed
@@ -1,5 +1,5 @@
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs"; 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 chalk from "chalk";
import { CONFIG_DIR_NAME } from "../config.ts"; import { CONFIG_DIR_NAME } from "../config.ts";
import { loadThemeFromPath, type Theme } from "../modes/interactive/theme/theme.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 }> = []; const ancestorContextFiles: Array<{ path: string; content: string }> = [];
let currentDir = resolvedCwd; let currentDir = resolvedCwd;
const root = resolve("/");
while (true) { while (true) {
const contextFile = loadContextFileFromDir(currentDir); const contextFile = loadContextFileFromDir(currentDir);
@@ -110,9 +109,7 @@ export function loadProjectContextFiles(options: {
seenPaths.add(contextFile.path); seenPaths.add(contextFile.path);
} }
if (currentDir === root) break; const parentDir = dirname(currentDir);
const parentDir = resolve(currentDir, "..");
if (parentDir === currentDir) break; if (parentDir === currentDir) break;
currentDir = parentDir; currentDir = parentDir;
} }