Skip to content

fix(cron): pass Git Bash-friendly paths for Windows .sh jobs - #64257

Closed
Bartok9 wants to merge 1 commit into
NousResearch:mainfrom
Bartok9:fix/60857-windows-cron-bash-paths
Closed

fix(cron): pass Git Bash-friendly paths for Windows .sh jobs#64257
Bartok9 wants to merge 1 commit into
NousResearch:mainfrom
Bartok9:fix/60857-windows-cron-bash-paths

Conversation

@Bartok9

@Bartok9 Bartok9 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Convert Windows paths to Git Bash-friendly /c/Users/... form when cron runs .sh/.bash scripts
  • Fixes script-not-found errors where backslashes are stripped (C:\Users → C:Users)

Motivation

Closes #60857.

On Windows with Git Bash, _run_job_script passed native Windows backslash paths as bash argv. Git Bash re-parses those backslashes as escapes, so the effective path becomes C:Users... and the job fails with No such file or directory.

Verification

  • pytest tests/cron/test_cron_script.py::TestBashFriendlyPath — 3 passed
  • Helper unit: C:/Users/.../script.sh → /c/Users/.../script.sh under win32
  • Did NOT change: Python cron script execution, scripts-dir containment

Test plan

  • Windows + Git Bash: no_agent cron job with script: hello.sh succeeds

Closes NousResearch#60857

Root cause: on Windows, Git Bash re-parses backslash Windows paths in
argv and strips escapes (C:\\Users\\... → C:Users...), so cron .sh jobs
fail with "No such file or directory".

Fix: convert script and cwd to /c/Users/... POSIX drive form before
invoking bash; leave Python script runs unchanged.

Verification:
- pytest tests/cron/test_cron_script.py::TestBashFriendlyPath (3 passed)
@alt-glitch alt-glitch added type/bug Something isn't working comp/cron Cron scheduler and job management 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 duplicate This issue or pull request already exists labels Jul 14, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #23405 (earliest-open canonical for the Windows git-bash cron .sh backslash-path cluster; same code site cron/scheduler.py::_run_job_script, same MSYS/POSIX-path mechanism). Siblings: #62516, #60892, #44350, #46364. Related spec issue: #60857.

@Bartok9

Bartok9 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @alt-glitch — agreed, #23405 is the earlier canonical for the git-bash _run_job_script backslash-path cluster. Closing this in favor of it to keep the triage queue clean.

If useful to the canonical, the TestBashFriendlyPath cases here (C:/Users/.../script.sh/c/Users/.../script.sh under win32, plus the containment-unchanged assertion) are easy to port over — happy to open a tests-only follow-up against #23405's branch if @CalmProton wants them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management duplicate This issue or pull request already exists 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 type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Windows cron scheduler loses backslashes in script paths (C:\Users → C:Users)

2 participants