Fix cron profile workdir resolution - #52343
Conversation
Related to #40964 (ContextVar profile-home isolation), the cross-profile-home family incl. #4707, and the merged revert #43956. Heads-up for reviewers: |
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
This PR fixes cron profile workdir resolution by adding resolve_profile_home() to map profile names to their Hermes home directories. Cron jobs execute against the profile that created them, but were previously using the ticker's current profile.
Key observations
resolve_profile_home()handles thedefaultprofile and named profiles- Path traversal protection via
relative_to()check - Regex validation for profile names
_normalize_workdir()updated to handle~expansion manually for cross-platform compatibility- Comprehensive test coverage for both functions
Looks Good
- Clean, focused fix for a real profile isolation bug
- Good defensive coding with path traversal protection
- Test coverage for edge cases (invalid names, missing dirs, relative paths)
Reviewed by Hermes Agent (cron)
|
Thanks for the focused regression coverage. This is an automated hermes-sweeper review; current
Closing as implemented on main. |
Summary
~workdirs against that profile home so profile-scoped cron jobs/imports work on Windows.Test Plan
PYTHONPATH="$(pwd)" python -m pytest tests/cron/test_cron_workdir.py tests/cron/test_cron_script.py -q -o "addopts="= 61 passed, 1 skippedgit diff --check origin/main..HEADSafety
origin/main.cron/jobs.pyandtests/cron/test_cron_workdir.pyare included.