fix(cron): normalize repeat integer updates to dict format - #15590
Closed
liuhao1024 wants to merge 4 commits into
Closed
liuhao1024 wants to merge 4 commits into
liuhao1024 wants to merge 4 commits into
Conversation
…INSTALL_TIMEOUT Increase the default npm install timeout for WhatsApp bridge from 60s to 300s (5 minutes) to accommodate slower systems like Unraid NAS. Make it configurable via WHATSAPP_NPM_INSTALL_TIMEOUT environment variable for users who need even longer timeouts. Closes NousResearch#14980
- Add 'path', 'old_string', 'new_string', and 'patch' to required list - Update description to clarify mode-specific parameter requirements - This addresses issue where LLMs would omit these parameters because they were not marked as required in the schema, even though they are required depending on the mode Fixes NousResearch#15524
API PATCH /api/jobs/{job_id} accepts raw integer repeat values,
but update_job() forwards them directly without normalization. create_job()
stores repeat as dict ({"times": n, "completed": count}), and
mark_job_run() calls .get() on it. Updating with an integer
causes AttributeError on next run.
Normalize integer repeat values to dict format in update_job(),
matching create_job() behavior. Preserve existing completed count and
reject non-positive values (<= 0).
Fixes NousResearch#15582
Contributor
Author
|
Closing inactive PR with no discussion. Opened 2026-04-25 with 0 comments. Will reopen if still relevant. |
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
Fixes
cron.jobs.update_job()to normalize raw integerrepeatvalues from API PATCH requests into the internal dict format ({"times": n, "completed": count}). Previously, the API would forward raw integers directly toupdate_job(), causingmark_job_run()to crash withAttributeError: 'int' object has no attribute 'get'.Root Cause
create_job()storesrepeatas a dict:{"times": n, "completed": 0}/api/jobs/{job_id}acceptsrepeatas a raw integer (e.g.,{"repeat": 2})update_job()incron/jobs.pymerged updates directly without special handling forrepeatmark_job_run()assumedjob["repeat"]is a dict and called.get("completed")on itjob["repeat"]became an integer, causingmark_job_run()to crash on next runFix
Add
repeatnormalization inupdate_job(), mirroring the existingschedulefield handling:repeatis an integer> 0, normalize to{"times": value, "completed": existing_count}repeatis<= 0, normalize toNone(matchingcreate_job()behavior)completedcount from job's current repeat stateAffected Files
cron/jobs.py- Addrepeat_changedflag and normalization logic inupdate_job()tests/gateway/test_api_server_jobs_update_repeat.py- Add regression coverage for update pathRegression Coverage
test_update_job_repeat_normalizes_integer_to_dict()- Verifies integer→dict normalization andcompletedpreservationtest_update_job_repeat_negative_or_zero_is_rejected()- Verifiesrepeat <= 0is normalized toNoneTesting
Closes #15582