Skip to content

fix(windows): bash-safe paths for init_session and mixed MSYS paths - #63470

Closed
xxxigm wants to merge 2 commits into
NousResearch:mainfrom
xxxigm:fix/windows-bash-path-followup
Closed

xxxigm wants to merge 2 commits into
NousResearch:mainfrom
xxxigm:fix/windows-bash-path-followup

Conversation

@xxxigm

@xxxigm xxxigm commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #63113 — users on upstream 7b5ba205 still hit \drivers\etc on Windows Desktop after that merge.

Root cause: #63113 only rewrote native C:\... paths in ShellFileOperations._escape_shell_arg. Two gaps remained:

  • init_session / _wrap_command snapshot pathsC:\Users\...\hermes-snap-*.sh still reached bash with backslashes, so snapshot bootstrap failed every turn.
  • Mixed MSYS paths/c/Users\Alexander\Documents\... bypassed _windows_to_msys_path (no C: prefix) but still carried \U backslashes bash mangled.

This PR adds _bash_safe_path / _quote_bash_path in local.py and wires them into file_operations + base.py snapshot quoting.

Test plan

  • scripts/run_tests.sh tests/tools/test_local_env_windows_msys.py tests/tools/test_file_operations.py::TestShellArgEscaping tests/tools/test_init_session_cwd_respect.py -q
  • On Windows + Git Bash: write_file to C:\Users\<user>\Documents\NewTEST\readme.txt succeeds
  • init_session no longer fails with snapshot bootstrap exit 1 on first tool use
  • User fully quits/reopens Hermes Desktop after update before retesting

Made with Cursor

xxxigm added 2 commits July 13, 2026 06:53
Add _bash_safe_path and _quote_bash_path to normalize native and mixed
/c/Users\... paths before they are embedded in Git Bash scripts.
Wire _bash_safe_path into ShellFileOperations shell args and normalize
snapshot/cwd-file paths in init_session/_wrap_command so Windows Git Bash
no longer sees native backslashes in bootstrap or mixed /c/Users\... paths.
@alt-glitch alt-glitch added type/bug Something isn't working tool/terminal Terminal execution and process management backend/local Local shell execution platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows P2 Medium — degraded but workaround exists labels Jul 13, 2026
@OutThisLife

Copy link
Copy Markdown
Contributor

Superseded by a scoped salvage that keeps your diagnosis and helpers, with two deltas:

  1. BaseEnvironment._quote_shell_path override on LocalEnvironment instead of base.py importing from local.py (layering).
  2. Explicit coverage for production C:/... snapshot paths from get_temp_dir — that's the shape users actually hit; MSYS still arg-converts C:/... during bash -l, which is why relative write_file kept failing after fix(windows): normalize native paths before bash file ops (supersedes #55481) #63113.

Closing in favor of that PR (Co-authored-by preserved). Thanks for the sharp follow-up on the Discord logs.

@OutThisLife

Copy link
Copy Markdown
Contributor

Superseded — see the salvage PR linked above.

OutThisLife added a commit that referenced this pull request Jul 13, 2026
fix(windows): bash-safe snapshot paths after #63113 (supersedes #63470)
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
…470-bash-paths

fix(windows): bash-safe snapshot paths after NousResearch#63113 (supersedes NousResearch#63470)
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
…470-bash-paths

fix(windows): bash-safe snapshot paths after NousResearch#63113 (supersedes NousResearch#63470)
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
…470-bash-paths

fix(windows): bash-safe snapshot paths after NousResearch#63113 (supersedes NousResearch#63470)
prmartinow pushed a commit to prmartinow/hermes-agent that referenced this pull request Aug 26, 2026
…470-bash-paths

fix(windows): bash-safe snapshot paths after NousResearch#63113 (supersedes NousResearch#63470)
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
…470-bash-paths

fix(windows): bash-safe snapshot paths after NousResearch#63113 (supersedes NousResearch#63470)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend/local Local shell execution P2 Medium — degraded but workaround exists platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows tool/terminal Terminal execution and process management type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants