Fix cron dashboard trigger-now execution - #46956
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating profile routing and adding regression coverage. The reported gap remains on current main: hermes_cli/web_server.py:10478-10485 only calls trigger_job, and cron/jobs.py:1428-1442 only updates next_run_at.
Problems
- The proposed global
CRON_DIR/JOBS_FILE/OUTPUT_DIRmutation conflicts with current profile-safe routing. Current main requiresuse_cron_store()for cross-profile calls (cron/jobs.py:67-69,118-134) and scopes execution in_fire_cron_job_for_profile(hermes_cli/web_server.py:10511-10534). scheduler.tick()processes every due job (cron/scheduler.py:3593) and defaults to synchronous completion (cron/scheduler.py:3747-3757), so this action can run unrelated jobs and block on agent execution.
Suggested changes
- Route the selected job through
_fire_cron_job_for_profile, preserve_run_cron_dashboard_io, then reload that job for the response. - Replace the mocked tick regression with coverage for current profile context, selected-job-only firing, and refreshed run state.
Automated hermes-sweeper review.
| old_jobs_file = cron_jobs.JOBS_FILE | ||
| old_output_dir = cron_jobs.OUTPUT_DIR | ||
| old_scheduler_home = cron_scheduler._hermes_home | ||
| cron_jobs.CRON_DIR = home / "cron" |
There was a problem hiding this comment.
Current main deliberately makes these globals fallback-only and routes cross-profile calls through use_cron_store() to avoid retargeting concurrent ticker I/O (cron/jobs.py:67-69, 118-134). Please rework this around the existing profile-scoped _fire_cron_job_for_profile path instead of restoring process-global routing.
| _call_cron_scheduler_for_profile(selected, "tick") | ||
| refreshed = _call_cron_for_profile(selected, "get_job", job_id) | ||
| return refreshed or job | ||
|
|
There was a problem hiding this comment.
tick() fires every due job, not just this job (cron/scheduler.py:3593), and its default synchronous mode waits for all dispatched jobs (cron/scheduler.py:3747-3757). This route should fire only the selected job through the existing profile-safe helper.
Fixes #46918.
Summary
triggerroute tick the selected profile scheduler immediately instead of only updatingnext_run_atlast_run_atandlast_statusVerification
python3 -m py_compile hermes_cli/web_server.py tests/hermes_cli/test_web_server_cron_profiles.pypython3 -m pytest tests/hermes_cli/test_web_server_cron_profiles.py -q -o addopts=''ruff check hermes_cli/web_server.py tests/hermes_cli/test_web_server_cron_profiles.pygit diff --check