Skip to content

fix: default cron enabled to true when not provided#7077

Closed
akramcodez wants to merge 1 commit intoopenclaw:mainfrom
akramcodez:fix/cron-enabled-default
Closed

fix: default cron enabled to true when not provided#7077
akramcodez wants to merge 1 commit intoopenclaw:mainfrom
akramcodez:fix/cron-enabled-default

Conversation

@akramcodez
Copy link
Contributor

@akramcodez akramcodez commented Feb 2, 2026

Problem

Cron jobs created via API/tool without an explicit enabled flag are silently disabled. The scheduler treats undefined as disabled, causing jobs to never run with no error or warning.

Solution

Default enabled to true in normalizeCronJobInput when applyDefaults is true and enabled is not explicitly set as a boolean.

Changes

  • src/cron/normalize.ts: Add default enabled: true when not provided
  • src/cron/normalize.test.ts: Add tests for default behavior and explicit false override

Testing

npx vitest run src/cron/normalize.test.ts

fixes #6988

Greptile Overview

Greptile Summary

This PR changes cron job normalization so that when applyDefaults is enabled (used by normalizeCronJobCreate), a missing or non-boolean enabled value is defaulted to true. This aligns API/tool-created jobs (which may omit enabled) with the expected “jobs run by default” behavior, and adds Vitest coverage to ensure the default and an explicit enabled: false override are preserved.

The change is localized to src/cron/normalize.ts’s normalizeCronJobInput defaulting block, and tests are added in src/cron/normalize.test.ts under the existing normalizeCronJobCreate suite.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • The behavior change is narrowly scoped to the applyDefaults path in cron job normalization, matches the described bug, and is covered by targeted tests verifying both the new default and explicit false behavior.
  • No files require special attention

@akramcodez
Copy link
Contributor Author

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!

@adasowa
Copy link

adasowa commented Feb 3, 2026

Confirming this fix works!

I was hitting this issue where jobs created via the cron tool without explicit enabled: true were being created as disabled. This was particularly confusing because the UI didn't make it obvious the jobs were disabled.

With this fix, jobs default to enabled as expected. Running in production alongside #3335 and #7230 — everything working smoothly now.

@sebslight
Copy link
Member

Closing as duplicate of #8698. If this is incorrect, comment and we can reopen.

@sebslight sebslight closed this Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cron jobs created via API/tool don't run: enabled defaults to undefined instead of true

3 participants

Comments