fix(cron): propagate pre-run script failure to job status - #20323
Open
liuhao1024 wants to merge 2 commits into
Open
fix(cron): propagate pre-run script failure to job status#20323liuhao1024 wants to merge 2 commits into
liuhao1024 wants to merge 2 commits into
Conversation
Contributor
|
Thanks for tracking the cron status mismatch. The underlying bug is still present on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
When a cron job's pre-run script exits non-zero, the error was injected into the agent prompt but the job was still reported as success (status=ok). This hid silent data-collection failures from operators. Fix: track script failure via _script_failed flag and return False when the pre-run script fails, even if the agent runs successfully. Regression tests added: - test_script_failure_marks_job_as_failed: script exits 1 → job failed - test_script_success_marks_job_as_ok: script exits 0 → job ok - test_no_script_marks_job_as_ok: no script → job ok Fixes NousResearch#20301
When the pre-run script fails, run_job() now returns a non-empty error containing the script output instead of None. This ensures: - mark_job_run() can persist the script failure as last_error - _process_job() can deliver a meaningful failure message - Operators see the actual script failure, not "unknown error" Previously, the job was marked as failed (success=False) but error=None, causing mark_job_run() to persist no last_error and _process_job() to deliver a generic "unknown error" message. Also drops unrelated commits from this PR (WhatsApp npm timeout config and PATCH_SCHEMA changes) as requested by teknium1 review. Responds to teknium1 review on PR NousResearch#20323.
liuhao1024
force-pushed
the
fix/issue-20301-cron-script-failure-status
branch
from
July 12, 2026 23:29
72765ee to
5027801
Compare
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?
When a cron job's pre-run script exits non-zero, the error is injected into the agent prompt — but
run_job()still reports success (status=ok). Operators seeokand assume the job ran correctly, when the data-collection step actually failed.Root Cause
In
run_job(), the pre-run script result (_ran_ok) is only used to build the prompt content. The function always returnsTrueat the end, regardless of whether the script succeeded or failed.Related Issue
N/A
Type of Change
Changes Made
How to Test
pytest tests/ -q— all tests should passChecklist
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 and workflows — or N/A