Repository navigation
Conversation
…repo root _launch_external_cron_worker builds the worker env through the shared subprocess sanitizer, which strips Hermes-owned PYTHONPATH entries -- the repo root AND the runtime's own site-packages -- correctly for a genuine user child (#3bbec90f2, tools/environments/local_pythonpath.py). The external cron worker is not a user child, it IS Hermes (`sys.executable -m cron.scheduler`), and needs both back. pin_hermes_tree_on_pythonpath (NousResearch#112729) already re-pins the repo root, which is why cron/utils/agent.* import fine, but left site-packages stripped. The moment anything on that import chain needs a third-party dependency -- hermes_yaml.py importing ruamel.yaml (#284dbaf5), hermes_cli/env_loader.py importing dotenv -- the worker dies with ModuleNotFoundError before it can send its ownership acknowledgement. This broke nearly every cron job on a managed (systemd) gateway install. Fix: also pin tools.environments.local_pythonpath::_get_hermes_site_packages onto the worker's PYTHONPATH, alongside the repo root. Fixes NousResearch#125999.
Author
|
Closing as duplicate — #122222 already has the same root-cause analysis with independent confirmations from multiple installs, and three open PRs proposing the same class of fix at this exact call site: #122238, #122290, #122382. No need for a fourth. Linking here for anyone who lands on this PR from #125999. |
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.
Summary
PYTHONPATHpin ([Bug]: Restart-safe external cron worker fails on dispatch due to symlink resolution in sys.executable #112729 follow-up) restored the repo root but not the runtime's ownsite-packages, so any third-party import on the worker's bootstrap path (ruamel.yamlviahermes_yaml.py,dotenvviahermes_cli/env_loader.py) died withModuleNotFoundErrorbefore the worker could send its ownership acknowledgement._launch_external_cron_worker— confirmed on my own install across contract audits, backups, WhatsApp/Matrix monitoring, DNS checks, and the transcription pipeline.pin_hermes_tree_on_pythonpathnow also re-pinstools.environments.local_pythonpath::_get_hermes_site_packagesonto the worker'sPYTHONPATH, alongside the repo root, since this worker legitimately needs both (it IS Hermes, not a user child — the case the sanitizer's stripping is meant to guard).Test plan
tests/cron/test_scheduler_worker_env_site_packages.py: proves the pin restores both repo root and site-packages while preserving pre-existingPYTHONPATHentries, and that the wheel/pipx purelib no-op path is untouched.ruamel.yaml/dotenvimport successfully in the pinned env; failed before the fix).scripts/run_tests.sh tests/cron/test_scheduler_worker_env_site_packages.py— not run in this environment (no local dev venv set up); please run in CI.🤖 Generated with Claude Code