Skip to content

fix(os): normalize Windows drive-root paths for fs.watch - #2967

Open
ktz03 wants to merge 3 commits into
MoonshotAI:mainfrom
ktz03:fix/normalize-windows-drive-watch-root
Open

fix(os): normalize Windows drive-root paths for fs.watch#2967
ktz03 wants to merge 3 commits into
MoonshotAI:mainfrom
ktz03:fix/normalize-windows-drive-watch-root

Conversation

@ktz03

@ktz03 ktz03 commented Aug 16, 2026

Copy link
Copy Markdown

Summary

  • On Windows, starting from a drive root CWD such as D: can produce a POSIX-ish watch path /D:.
  • fs.watch('/D:') then fails with ENOENT: no such file or directory, watch '/D:'.
  • Normalize drive-only roots to D:\ before creating native/chokidar watchers.
  • Add a regression test for /D: and E:.

Related: MoonshotAI/kimi-cli#2600

Testing plan

  • Added unit test that watchNative receives D:\\ when given /D: / E: on win32.
  • Manual: set PowerShell start directory to D:\ (drive root), launch Kimi Code, confirm no watch '/D:' crash.

@changeset-bot

changeset-bot Bot commented Aug 16, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: dd4de95

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d2aeef7be

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +249 to +250
// Windows drive roots must be `D:\` (not `D:` or POSIX-ish `/D:`), otherwise
// `fs.watch` throws ENOENT: watch '/D:' when the process CWD is a drive root.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Move the implementation comment to the file header

Move this explanation into the top-of-file module header or make the helper self-explanatory without it. The package explicitly prohibits comments beside functions or statements, and these newly added lines narrate the normalization implementation inside the module body.

AGENTS.md reference: packages/agent-core-v2/AGENTS.md:L36-L38

Useful? React with 👍 / 👎.

@ktz03

ktz03 commented Aug 16, 2026

Copy link
Copy Markdown
Author

Addressed Codex P1: moved the Windows drive-root explanation into the file header and removed the inline comments per packages/agent-core-v2/AGENTS.md comment conventions.

Re: changeset — this is a bugfix; no package version bump intended, so no changeset added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant