GitHub Issue:cron.add 后任务“消失”时的 enabled 默认值修复清单
解决“cron.add 成功但 cron.list 看不到任务”的场景:统一把缺省 enabled 视为 true,并用显式比较替代 truthy 判断,避免任务被误判为禁用。
GITHUBDiscovered 2026-02-13Author abelsu7
Prerequisites
- You can inspect `~/.openclaw/cron/jobs.json` and run `cron.add` / `cron.list` repeatedly.
- Your deployment includes cron jobs created via API/tooling, not only manually edited files.
Steps
- Create a minimal cron job with `cron.add`, then immediately run `cron.list` to check visibility.
- Inspect `jobs.json`; if the new job lacks `enabled`, treat it as a normalization bug path.
- Patch logic to use explicit checks (`enabled === false` means disabled; otherwise enabled).
- Re-run add/list/due-run paths and confirm jobs are discoverable/executable without waiting for forceReload.
Commands
openclaw gateway statusopenclaw logs --local-timecat ~/.openclaw/cron/jobs.jsonVerify
A newly added cron job appears in `cron.list` immediately and executes when due, even if `enabled` was omitted at write time.
Caveats
- Do not bulk-edit production jobs.json without backup and schema check.
- Issue/patch state may evolve quickly; re-check merged commits before removing temporary safeguards(需验证)。
Source attribution
This tip is aggregated from community/public sources and preserved with attribution.
Open original source ↗