Skip to content

fix(cron): resolve relative script paths at job creation to prevent cross-profile breakage - #2

Merged
ARC345 merged 1 commit into
ARC345:mainfrom
arc-butler:fix/cron-script-path-per-profile
Jul 3, 2026
Merged

fix(cron): resolve relative script paths at job creation to prevent cross-profile breakage#2
ARC345 merged 1 commit into
ARC345:mainfrom
arc-butler:fix/cron-script-path-per-profile

Conversation

@arc-butler

Copy link
Copy Markdown

Summary

Relative script paths in cron jobs were stored as-is and resolved against whatever profile's HERMES_HOME happened to be active when the tick executed. With multiple gateways running different profiles, the same relative path (e.g. backup.sh) resolved to different directories on different ticks, causing script-not-found errors.

Changes

  • Added _normalize_script() function: resolves relative script paths against the creating profile's HERMES_DIR/scripts/ at creation time and stores the absolute path
  • Wired _normalize_script() into both create_job() and update_job()
  • Relaxed _run_job_script() security check: accepts scripts from any scripts/ directory (not just the current profile's). Paths validated at creation time; still blocks arbitrary absolute paths
  • Updated tests to expect absolute stored paths

Root cause

_run_job_script() resolved relative paths against _get_hermes_home() / "scripts" at tick execution time. _get_hermes_home() varies per-profile, so the same relative path resolved to different locations depending on which profile's gateway happened to win the tick lock.

Test plan

pytest tests/cron/  # 612 passed
ruff check cron/jobs.py cron/scheduler.py tests/cron/  # All checks passed

Closes NousResearch#57608.

Refs https://github.com/arc-butler/hermes-agent/pull/1 (previous PR for NousResearch#57683 — abandoned due to duplicate).

…ross-profile breakage

Relative script paths in cron jobs were stored as-is and resolved against whatever profile's HERMES_HOME happened to be active when the tick executed. With multiple gateways running different profiles, the same relative path (e.g. "backup.sh") resolved to different directories on different ticks, causing script-not-found errors.

Changes:

- Add _normalize_script() which resolves relative paths against the creating profile's HERMES_DIR/scripts/ at create time

- Wire _normalize_script() into create_job() and update_job()

- Relax _run_job_script() security check to accept scripts from any scripts/ directory (not just the current profile's), since paths are now validated at creation time

- Update tests to expect absolute stored paths
@ARC345
ARC345 merged commit 1b705ac into ARC345:main Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cron job script path resolves against wrong profile when multiple gateways are running

2 participants