code-yeongyu / code-yeongyu/senpi

Windows cross-drive project-root traversal fix

Open Beginner friendly
#518 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
429
Forks
98
Avg merge
5h 3m
Merged PRs (30d)
526

Description

### What happened?

On Windows, `findProjectRoot()` can enter a synchronous infinite loop when Senpi is launched from one drive and a rules lookup targets a path on another drive.

`resolve("/")` points to the current working drive, while `dirname()` of the target drive root returns the same path. The traversal therefore never progresses or reaches its existing root check. The session freezes without an error, potentially using 100% CPU.

This reproduced with `senpi -ne`, so it was not caused by a user-loaded extension.

### Steps to reproduce

1. On Windows, launch Senpi from the `C:` drive:

`senpi -ne`

2. Read, edit, or write a file on another drive, such as `D:\senpi-repro\file.txt`, where no project marker exists in its parent directories.
3. Observe that the session hangs indefinitely during project-root discovery.

### Expected behavior

Project-root traversal should stop when `dirname(currentDirectory) === currentDirectory` and return `null` if no marker was found:

```ts
const parentDirectory = dirname(currentDirectory);

if (
currentDirectory === filesystemRoot ||
parentDirectory === currentDirectory
) {
return null;
}

### Version

2026.7.29-6

Contributor guide

Open the contributing guide

Research direction

Locate the TypeScript implementation of findProjectRoot and trace its traversal from the cross-drive reproduction described above. Verify the parent-directory stop condition on Windows, then add or update coverage for a target drive with no project marker and confirm the lookup returns null instead of hanging.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.