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/user → C:\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.
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 intools/environments/local.pycallsos.path.isdir()which does NOT understand MSYS paths — it returnsFalsebecause Windows doesn't have a literal/c/directory.This triggers the following WARNING on every terminal command:
Environment
os.getcwd()returns MSYS-format pathsExpected Behavior
_resolve_safe_cwd()should handle MSYS-style paths on Windows by converting them to native Windows paths (e.g.,/c/Users/user→C:\Users\user) before checkingos.path.isdir().The downstream code at
local.py:457-459already has a comment noting this is a Git Bash path and does the conversion forsubprocess.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:When
cwd = '/c/Users/user',os.path.isdir('/c/Users/user')isFalseon Windows. It then walks up to/c→/and eventually falls back totempfile.gettempdir(). Adding MSYS-to-Windows path normalization before theisdircheck would fix this.Related
See also: the downstream code at
local.py:457-459already has this comment: