hermes - 💡(How to fix) Fix LocalEnvironment: repeated 'cwd missing on disk' warning on Windows with git-bash MSYS paths [2 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

On Windows when running Hermes under git-bash (MSYS2), os.getcwd() returns MSYS-style paths like /c/Users/user. The _resolve_safe_cwd() function in tools/environments/local.py calls os.path.isdir() which does NOT understand MSYS paths — it returns False because Windows doesn't have a literal /c/ directory.

This triggers the following WARNING on every terminal command:

WARNING tools.environments.local: LocalEnvironment cwd '/c/Users/user' is missing on disk;
  falling back to '/' so terminal commands keep working.

Root Cause

In tools/environments/local.py:21-45:

def _resolve_safe_cwd(cwd: str) -> str:
    if cwd and os.path.isdir(cwd):
        return cwd
    parent = os.path.dirname(cwd) if cwd else ""
    while parent:
        if os.path.isdir(parent):
            return parent
        ...
    return tempfile.gettempdir()

When cwd = '/c/Users/user', os.path.isdir('/c/Users/user') is False on Windows. It then walks up to /c/ and eventually falls back to tempfile.gettempdir(). Adding MSYS-to-Windows path normalization before the isdir check would fix this.

Fix Action

Fixed

Code Example

WARNING tools.environments.local: LocalEnvironment cwd '/c/Users/user' is missing on disk;
  falling back to '/' so terminal commands keep working.

---

def _resolve_safe_cwd(cwd: str) -> str:
    if cwd and os.path.isdir(cwd):
        return cwd
    parent = os.path.dirname(cwd) if cwd else ""
    while parent:
        if os.path.isdir(parent):
            return parent
        ...
    return tempfile.gettempdir()

---

# On Windows, self.cwd may be a Git Bash-style path (/c/Users/...)
# from pwd output. subprocess.Popen needs a native Windows path.
RAW_BUFFERClick to expand / collapse

Description

On Windows when running Hermes under git-bash (MSYS2), os.getcwd() returns MSYS-style paths like /c/Users/user. The _resolve_safe_cwd() function in tools/environments/local.py calls os.path.isdir() which does NOT understand MSYS paths — it returns False because Windows doesn't have a literal /c/ directory.

This triggers the following WARNING on every terminal command:

WARNING tools.environments.local: LocalEnvironment cwd '/c/Users/user' is missing on disk;
  falling back to '/' so terminal commands keep working.

Environment

  • Windows 11
  • Hermes running under git-bash (MSYS2 terminal)
  • os.getcwd() returns MSYS-format paths

Expected Behavior

_resolve_safe_cwd() should handle MSYS-style paths on Windows by converting them to native Windows paths (e.g., /c/Users/userC:\Users\user) before checking os.path.isdir().

The downstream code at local.py:457-459 already has a comment noting this is a Git Bash path and does the conversion for subprocess.Popen's cwd. The _resolve_safe_cwd() function should apply the same conversion.

Actual Behavior

The WARNING message fires once per terminal tool call. It's cosmetic (the actual command still works because the fallback / works as a working directory), but it creates log noise in the Dashboard's log viewer.

Root Cause

In tools/environments/local.py:21-45:

def _resolve_safe_cwd(cwd: str) -> str:
    if cwd and os.path.isdir(cwd):
        return cwd
    parent = os.path.dirname(cwd) if cwd else ""
    while parent:
        if os.path.isdir(parent):
            return parent
        ...
    return tempfile.gettempdir()

When cwd = '/c/Users/user', os.path.isdir('/c/Users/user') is False on Windows. It then walks up to /c/ and eventually falls back to tempfile.gettempdir(). Adding MSYS-to-Windows path normalization before the isdir check would fix this.

Related

See also: the downstream code at local.py:457-459 already has this comment:

# On Windows, self.cwd may be a Git Bash-style path (/c/Users/...)
# from pwd output. subprocess.Popen needs a native Windows path.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix LocalEnvironment: repeated 'cwd missing on disk' warning on Windows with git-bash MSYS paths [2 pull requests]