Skip to content

fix(tools): use display_hermes_home() in cron script validation error messages - #38695

Open
goktug7913 wants to merge 1 commit into
NousResearch:mainfrom
goktug7913:fix/cronjob-hardcoded-hermes-home-error-msg
Open

goktug7913 wants to merge 1 commit into
NousResearch:mainfrom
goktug7913:fix/cronjob-hardcoded-hermes-home-error-msg

Conversation

@goktug7913

Copy link
Copy Markdown

What changed and why

_validate_cron_script_path in tools/cronjob_tools.py correctly resolves the scripts directory via get_hermes_home() / "scripts" at runtime, but the error messages it returns hardcoded ~/.hermes/scripts/. When HERMES_HOME points to a non-default location (e.g. /opt/data in Docker), users received misleading guidance directing them to the wrong directory.

The fix replaces the hardcoded string with display_hermes_home(), which already existed for exactly this purpose — its docstring says "Use this in user-facing print/log messages instead of hardcoding ~/.hermes" — and was already used in the schema description on line 795 of the same file.

Changes

  • tools/cronjob_tools.py: replaced hardcoded ~/.hermes/scripts/ with f"{display_hermes_home()}/scripts" in the two error message lines inside _validate_cron_script_path
  • tests/cron/test_cron_script.py: added test_absolute_path_error_references_actual_hermes_home regression test that sets HERMES_HOME to a temp path and asserts the error message reflects the configured path, not the default ~/.hermes

How to test

  1. Set HERMES_HOME=/tmp/custom-home and attempt to create a cron job with script="/tmp/evil.py" — the error should reference /tmp/custom-home/scripts/, not ~/.hermes/scripts/.
  2. Run pytest tests/cron/test_cron_script.py::TestCronjobToolScriptValidation -v — all 8 tests should pass.

Platforms tested

  • macOS (Apple Silicon)

Fixes #38693

… messages

Hardcoded ~/.hermes/scripts/ references in _validate_cron_script_path
gave misleading guidance when HERMES_HOME points to a non-default
location (e.g. /opt/data in Docker). display_hermes_home() already
existed for exactly this purpose and was already used in the schema
description for this same tool (line 795).

Added a regression test that sets HERMES_HOME to a temp path and asserts
the error message reflects the configured path, not the default.

Fixes NousResearch#38693
@teknium1

Copy link
Copy Markdown
Collaborator

Thanks for the focused regression fix. Current main still has the incorrect hardcoded guidance at tools/cronjob_tools.py:548-550, while validation resolves the actual script root through get_hermes_home() at tools/cronjob_tools.py:556. The proposed use of the already-imported display_hermes_home() matches its documented user-facing contract in hermes_constants.py:631-648 and covers both create and update, which call the validator at tools/cronjob_tools.py:714 and :900.

This is an automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users labels Jul 14, 2026
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 P3 Low — cosmetic, nice to have sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades 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]: Cron script validation error message hardcodes ~/.hermes/scripts/ instead of using $HERMES_HOME/scripts/

3 participants