fix(cron): resolve relative script paths relative to job workdir instead of cwd (#59599) - #60475
Open
webtecnica wants to merge 1 commit into
Open
webtecnica wants to merge 1 commit into
webtecnica wants to merge 1 commit into
Conversation
…ead of cwd (cherry picked from commit 6c575c850b4ae3908ba94eeab6003690c6d59581)
webtecnica
force-pushed
the
fix/59599-cron-script-paths
branch
from
July 11, 2026 12:49
6c575c8 to
5592315
Compare
teknium1
reviewed
Jul 15, 2026
teknium1
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for tackling cron script-path handling. The current patch needs rework before it can provide the stated behavior.
Problems
- The new
base_dirresolution still flows into the existingscripts_dircontainment check atcron/scheduler.py:2059. Therefore a script under a job workdir outsideHERMES_HOME/scriptsremains blocked; the new branch does not enable the advertised./scripts/foo.shcase. - Current main executes scripts through
_run_job_script_with_claim_heartbeat(cron/scheduler.py:2611,2758), whose internal calls at2162,2193, and2196do not pass a base directory. The PR's older direct-call edits do not cover those paths. - #59599 asks to accept absolute/home-relative paths already under
~/.hermes/scripts, buttools/cronjob_tools.py:546-550rejects those values before the scheduler runs. This PR does not touch that boundary.
Suggested changes
- Decide whether the intended scope is #59599's scripts-directory normalization or a broader workdir execution policy; the latter must preserve the containment guarantees introduced by
878b1d3d3. - Carry any approved resolution context through the heartbeat wrapper and add agent/no-agent regression coverage.
Automated hermes-sweeper review.
| raw = Path(script_path).expanduser() | ||
| if raw.is_absolute(): | ||
| path = raw.resolve() | ||
| elif base_dir: |
Collaborator
There was a problem hiding this comment.
This resolution is immediately rejected by the unchanged path.relative_to(scripts_dir_resolved) guard below whenever base_dir is outside HERMES_HOME/scripts. Thus the advertised job-workdir-relative path still cannot run; the resolution and containment policy need to be designed together.
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolve relative cron script paths relative to job workdir instead of cwd. All 3 _run_job_script call sites now pass base_dir from job's workdir. Closes #59599