fix: default cron enabled to true when not provided#7077
fix: default cron enabled to true when not provided#7077akramcodez wants to merge 1 commit intoopenclaw:mainfrom
Conversation
|
Hi @gumadeiras @thewilloftheshadow @cpojer, Would appreciate a review when you get a chance. This fixes an issue where cron jobs created without an explicit enabled flag were silently disabled, causing them to never run. The change defaults enabled to true when applying defaults, while preserving explicit false, and adds test coverage for both cases. Thanks! |
|
Confirming this fix works! I was hitting this issue where jobs created via the cron tool without explicit With this fix, jobs default to enabled as expected. Running in production alongside #3335 and #7230 — everything working smoothly now. |
|
Closing as duplicate of #8698. If this is incorrect, comment and we can reopen. |
Problem
Cron jobs created via API/tool without an explicit
enabledflag are silently disabled. The scheduler treatsundefinedas disabled, causing jobs to never run with no error or warning.Solution
Default
enabledtotrueinnormalizeCronJobInputwhenapplyDefaultsis true andenabledis not explicitly set as a boolean.Changes
src/cron/normalize.ts: Add defaultenabled: truewhen not providedsrc/cron/normalize.test.ts: Add tests for default behavior and explicitfalseoverrideTesting
fixes #6988
Greptile Overview
Greptile Summary
This PR changes cron job normalization so that when
applyDefaultsis enabled (used bynormalizeCronJobCreate), a missing or non-booleanenabledvalue is defaulted totrue. This aligns API/tool-created jobs (which may omitenabled) with the expected “jobs run by default” behavior, and adds Vitest coverage to ensure the default and an explicitenabled: falseoverride are preserved.The change is localized to
src/cron/normalize.ts’snormalizeCronJobInputdefaulting block, and tests are added insrc/cron/normalize.test.tsunder the existingnormalizeCronJobCreatesuite.Confidence Score: 5/5
applyDefaultspath in cron job normalization, matches the described bug, and is covered by targeted tests verifying both the new default and explicitfalsebehavior.