fix(cron): resolve dynamic paths at runtime for profile isolation (#4707)#4729
Open
devorun wants to merge 2 commits into
Open
fix(cron): resolve dynamic paths at runtime for profile isolation (#4707)#4729devorun wants to merge 2 commits into
devorun wants to merge 2 commits into
Conversation
3 tasks
|
Dropping a friendly note from a duplicate PR (#19375, now closed): great work here @devorun — our approaches converged on the same One small, optional suggestion if you ever revisit this: my version kept the old module-level names ( def __getattr__(name):
if name == 'JOBS_FILE': return _get_cron_paths()[1]
if name == 'CRON_DIR': return _get_cron_paths()[0]
if name == 'OUTPUT_DIR': return _get_cron_paths()[2]
if name == 'HERMES_DIR': return get_hermes_home().resolve()
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")Totally optional — feel free to ignore if you'd rather treat the removal as a clean break. Either way, hope this lands soon! |
11 tasks
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.
What does this PR do?
Description
This PR fixes a critical profile isolation issue where background cron jobs incorrectly resolved to the default
~/.hermesenvironment instead of the active profile's scopedHERMES_HOME.Fixes #4707
Root Cause
The
cron/scheduler.pyandcron/jobs.pymodules were defining absolute path constants (_hermes_home,CRON_DIR,JOBS_FILE,_LOCK_FILE, etc.) at the module level. Because Python evaluates and caches these at import time, they were permanently frozen to the default~/.hermespath before the profile-scoped gateway could dynamically apply itsHERMES_HOMEenvironment override.Changes
cron/jobs.py: Removed statically evaluated global path constants. Introduced the_get_cron_paths()helper to dynamically resolvecron_dir,jobs_file, andoutput_dirvia lazy evaluation.cron/scheduler.py: Removed module-level lock paths. Updated thetick()andrun_job()functions to compute the activeHERMES_HOMEand lock directory dynamically at runtime.HERMES_HOMEdictated by the active gateway environment.Related Issue
Fixes #
Type of Change
Changes Made
How to Test
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
hermes --toolsets skills -q "Use the X skill to do Y"Screenshots / Logs