Skip to content

fix(agent-core): tolerate unreadable .git probes on UNC workspaces - #2546

Open
djfch wants to merge 1 commit into
MoonshotAI:mainfrom
djfch:fix/unc-git-probe
Open

fix(agent-core): tolerate unreadable .git probes on UNC workspaces#2546
djfch wants to merge 1 commit into
MoonshotAI:mainfrom
djfch:fix/unc-git-probe

Conversation

@djfch

@djfch djfch commented Aug 3, 2026

Copy link
Copy Markdown

Related Issue

Resolve #2540

Problem

See linked issue. On Windows, workspaces opened via a UNC path (network share, e.g. a NAS) that are not git repositories cannot send any chat message: the project-root walk stats \\server\.git past the share root, Node/libuv reports UNKNOWN instead of ENOENT, and the probe helper rethrew it, failing the whole chat preflight.

What changed

  • The .git marker probe in the MCP config loader's project-root walk now treats any stat failure as "not found" instead of rethrowing non-ENOENT/ENOTDIR errors — a probe for an optional marker file should never throw. This matches the existing probe helpers elsewhere in the repo (e.g. workspace-local config, profile context) and also covers EPERM-style failures, not just UNKNOWN.
  • Removed the now-unused error-code helper from the same file.
  • Added regression tests that simulate UNKNOWN and EPERM probe failures and assert the walk falls back to the starting directory (platform-independent via a partial node:fs/promises mock).

The sibling probe copies in the agent-file root resolvers (both engines) were left untouched: their callers already catch and downgrade probe errors to warnings, so they never had this crash.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7e912cf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

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

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.

Chat preflight fails on UNC (network share) workspaces: stat '\\server\.git\' throws UNKNOWN (Windows)

1 participant