Bug Description
In tools/checkpoint_manager.py, the _run_git() helper passes cwd=str(Path(working_dir).resolve()) to subprocess.run(). On Linux/macOS, Path.resolve() succeeds even when the directory does not exist — it just resolves symlinks. This means cwd can point to a non-existent path, causing subprocess.run to raise FileNotFoundError (errno 2: No such file or directory).
The FileNotFoundError is silently caught and logged, but it means checkpoints are silently disabled on any directory that happens to not exist at the time ensure_checkpoint is called.
Steps to Reproduce
- Use Hermes in an environment where
os.getcwd() returns a path that does not exist on disk (e.g., WSL with a deleted Windows directory, Docker volume, or cross-environment paths like /mnt/c/Users/... on a Linux host).
- Attempt any file-mutating tool call that would trigger
ensure_checkpoint.
- Observe
FileNotFoundError in logs:
FileNotFoundError: [Errno 2] No such file or directory: /mnt/c/Users/angel/~/.hermes/job-scraper
(from actual error in errors.log on 2026-04-09 03:30:45)
Relevant Code
_run_git() at line ~107 of tools/checkpoint_manager.py:
result = subprocess.run(
cmd,
capture_output=True,
text=True,
timeout=timeout,
env=env,
cwd=str(Path(working_dir).resolve()), # ← resolves but directory may not exist
)
The _git_available lazy probe at line ~223 only checks shutil.which("git"), but does not validate that working_dir exists. The error occurs inside the try block in _run_git, where it is caught as a generic FileNotFoundError.
Expected Behavior
_run_git should validate that working_dir exists before passing it as cwd to subprocess.run, and gracefully return (False, "", "working directory not found") instead of raising FileNotFoundError.
Suggestion
Add an existence check in _run_git before calling subprocess.run:
if not Path(working_dir).resolve().exists():
return False, "", f"working directory not found: {working_dir}"
Or use _GIT_TIMEOUT and let the subprocess fail gracefully with a more descriptive error.
Additional Context
Bug Description
In
tools/checkpoint_manager.py, the_run_git()helper passescwd=str(Path(working_dir).resolve())tosubprocess.run(). On Linux/macOS,Path.resolve()succeeds even when the directory does not exist — it just resolves symlinks. This meanscwdcan point to a non-existent path, causingsubprocess.runto raiseFileNotFoundError(errno 2: No such file or directory).The
FileNotFoundErroris silently caught and logged, but it means checkpoints are silently disabled on any directory that happens to not exist at the timeensure_checkpointis called.Steps to Reproduce
os.getcwd()returns a path that does not exist on disk (e.g., WSL with a deleted Windows directory, Docker volume, or cross-environment paths like/mnt/c/Users/...on a Linux host).ensure_checkpoint.FileNotFoundErrorin logs:(from actual error in
errors.logon 2026-04-09 03:30:45)Relevant Code
_run_git()at line ~107 oftools/checkpoint_manager.py:The
_git_availablelazy probe at line ~223 only checksshutil.which("git"), but does not validate thatworking_direxists. The error occurs inside thetryblock in_run_git, where it is caught as a genericFileNotFoundError.Expected Behavior
_run_gitshould validate thatworking_direxists before passing it ascwdtosubprocess.run, and gracefully return(False, "", "working directory not found")instead of raisingFileNotFoundError.Suggestion
Add an existence check in
_run_gitbefore callingsubprocess.run:Or use
_GIT_TIMEOUTand let the subprocess fail gracefully with a more descriptive error.Additional Context
_run_gitnot the mainos.getcwd()